ATMega 1280 Linux Connection Problem

Hello Arduino Gods,
I am currently having problems uploading programs to my ATMega 1280 on a openSUSE Linux machine. First off I'll say I have tried multiple things to get this working so I'm going to list everything that either hasn't worked or that I am doing wrong. Also, one issue is that I need definite connection from the Mega to the computer as this Mega is for running a Reprap machine. The Mega will be getting constant info from the computer so doing the reset button dance isn't even an option. I am a Linux newb so it is possible I'm missing something staring me right in the face. Thank you in advance for any help.

  1. First off, the Mega is working perfectly fine. I can very easily upload programs and send info through USB to the Mega using Windows XP and Windows 7. Truthfully I would just stick with Windows but the Gcode Interpreter I'm using for my Reprap machine is not currently being updated for Windows, so there is that.

  2. On to what is happening when I try to upload to the Mega on openSUSE: In the Arduino IDE I can select the correct serial port (/dev/ttyUSB0) and am selecting the correct board (Arduino Mega (ATMega 1280). The program compiles perfectly fine. When I select to upload the first thing I notice is that the rx tx lights do not blink. Within a few seconds the Arduino IDE errors out with this error:

Binary sketch size: 14992 bytes (of a 126976 byte maximum)
/home/steven/bin/arduino-0022/hardware/tools/avrdude -C/home/steven/bin/arduino-0022/hardware/tools/avrdude.conf -v -v -v -v -patmega1280 -cstk500v1 -P/dev/ttyUSB0 -b115200 -D -Uflash:w:/tmp/build3442533860849584296.tmp/Tonokip_Firmware.cpp.hex:i 

avrdude: Version 5.4-arduino, compiled on Oct 22 2007 at 13:15:12
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/home/steven/bin/arduino-0022/hardware/tools/avrdude.conf"
         User configuration file is "/home/steven/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : /dev/ttyUSB0
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 115200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: Send: Q [51]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
  1. Here are some of the things I have already tried.
    A. First off with the original install of Arduino IDE I followed this: Arduino Playground - OpenSUSE
    B. That didn't work so I tried the steps in the following link which did make the serial port appear but still did not fix the avrdude error: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268008565
    C. Next I tried changing the connection rate in the Arduino IDE preferences.txt file. I switched the baud rate to 115200 as this is the speed I normally use to connect the Mega to the gcode interpreter (Repsnapper). This changed nothing.
    D. Lastly I even tried the dumb resetting of the board right before the upload, and right after pressing upload, and after the first return line appears. None of this works.

  2. Also, info about the install: Arduino IDE is installed in the bin folder in the "home" folder. In following the information in the install tutorial I followed it word for word. So, if there is something that a Linux user would automatically do when installing Arduino IDE with out needing to be told so, I did not.

  3. I've seen the error I'm getting appear in many forum posts with no definite answers. I'm guessing this error is generic and could be caused by many things. With this said, if you have any questions that may lead to getting this working, please ask away.

Which version on openSuse, rxtx, java, etc... are you using?

mrtaylor, thanks for your response. I'm not sure what exactly you mean by etc. so I put version numbers for what I thought was needed. If you need more please list which info is needed.

openSUSE: 11.3
rxtx-java: 2.2pre2-4.6
java-1_6_0-openjdk: 1.6.0.0_b20.1.9.4-1.2.1
avrdude: 5.10-44.9
cross-avr-binutils: 2.19.1-32.1
cross-avr-gcc: 4.3.3_20100125-27.2
avr-libc: 1.7.0-3.5
arduino: 0022-6.1

If this is 64 bit linux, you must use arduino 0021 software version. The new 0022 version is not yet properly ported to 64 bit linux systems.
-Igor

OS: Linux 2.6.34.7-0.7-desktop i686
System: openSUSE 11.3 (i586)

Please open a terminal and run this command. Post the result:
find / -ls 2>&1 | grep -i rxtxSerial

2492889   48 -rw-r--r--   1 steven   users       48304 Dec 24 17:12 /home/steven/bin/arduino-0022/lib/librxtxSerial.so
2491909   48 -rw-r--r--   1 steven   users       48304 Dec 24 17:12 /home/steven/.local/share/Trash/files/arduino-0022/lib/librxtxSerial.so
803369   68 -rwxr-xr-x   1 root     root        68023 Dec 12 16:43 /usr/lib/librxtxSerial-2.2pre1.so
803372    0 lrwxrwxrwx   1 root     root           24 Jan 26 20:57 /usr/lib/librxtxSerial.so -> librxtxSerial-2.2pre1.so
1067340    0 lrwxrwxrwx   1 root     root           29 Jan 26 21:04 /usr/share/arduino-0022/lib/librxtxSerial.so -> ../../../lib/librxtxSerial.so

let try replacing librxtxSerial. Execute the following commands

// backup original library
mv /home/steven/bin/arduino-0022/lib/librxtxSerial.so /home/steven/bin/arduino-0022/lib/librxtxSerial.so.orig
// copy library found on system to arduino library directory
cp /usr/lib/librxtxSerial.so /home/steven/bin/arduino-0022/lib/librxtxSerial.so

cd /home/steven/bin/arduino-0022
./arduino

mrtaylor, sorry but I am still getting the same error after replacing librxtxSerial.

I am running out of ideas, so double check you have the correct board and port selected under the tools menu, try running a root.

mrtaylor, the port and board is right. How would I go about running it as root? I've heard someone else say this is one way they got it working but I do not know to do it.

You will need the root password

cd to the arduino directory
sudo ./arduino

another thing to try see if it still works under window xp if it does not reburn the bootloader.

Weird, getting an error from trying to open in root.

steven@linux-ov9v:~/bin/arduino-0022> sudo ./arduino
root's password:
Exception in thread "main" java.lang.ExceptionInInitializerError
        at processing.app.Base.main(Base.java:112)
Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
        at processing.core.PApplet.<clinit>(Unknown Source)
        ... 1 more

edited:
try this might work might not

sudo bash
export DISPLAY=:0.0
./arduino

steven@linux-ov9v:~/bin/arduino-0022> sudo bash
linux-ov9v:/home/steven/bin/arduino-0022 # export DISPLAY=:0.0
linux-ov9v:/home/steven/bin/arduino-0022 # ./arduino
No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:62)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:178)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:142)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.Toolkit$2.run(Toolkit.java:849)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
        at processing.core.PApplet.<clinit>(Unknown Source)
        at processing.app.Base.main(Base.java:112)

close the terminal and open a new one

Is you window manager kde? if so :
cd to the arduino directory
kdesu ./arduino

It looks like he is using it on the kernel console i.e. no GUI.
Type startx

Ok, in a terminal in X, type:
sudo su
Enter the password if prompted. Now you should be in a root environment with the root profile. Now try typing arduino to start the IDE and see what happens.

HTH
-Igor

mrtaylor: I am using KDE. 'kdesu ./arduino' gives no output. I ran './arduino' after and still no rxtx lights and the same avrdude error.

smeezekitty: 'startx' gives:

steven@linux-ov9v:~> startx
xauth:  creating new authority file /home/steven/.serverauth.6193


Fatal server error:
Server is already active for display 0
        If this server is no longer running, remove /tmp/.X0-lock
        and start again.


Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 

No protocol specified
giving up.                                                                             
xinit:  Resource temporarily unavailable (errno 11):  unable to connect to X server    
xinit:  No such process (errno 3):  Server error.

Igor86: I'm not sure what you mean by a terminal in X. I'm using the terminal found in the favorites (Konsole).

steven@linux-ov9v:~> sudo su
root's password:
linux-ov9v:/home/steven # cd /home/steven/bin/arduino-0022
linux-ov9v:/home/steven/bin/arduino-0022 # ./arduino
Exception in thread "main" java.lang.ExceptionInInitializerError
        at processing.app.Base.main(Base.java:112)
Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at sun.awt.HeadlessToolkit.getMenuShortcutKeyMask(HeadlessToolkit.java:231)
        at processing.core.PApplet.<clinit>(Unknown Source)
        ... 1 more

Whats happening is that the DISPLAY environment variable (ans probably others) are not getting set correctly for the root account so that it doesn't give you acces to the display to open the arduino IDE window.

Try this:
xhost +localhost
xhost +root
sudo su
enter password
arduino

If that does not work (some xhost implementations do not accept usernames anymore, only hosts), then you must give us some more details about the system. Do you login from the console then start X windows by startx? Do you login via login manager (graphical login)? In any case, login as root and then do the same as you would as a normal user. I've never used SUSE linux so I have no idea how far it has deviated form the purist linux distros such as Arch or Slackware and so I don't know what access mechanisms it uses.

Hopefully some of this advice will bring you closer...
-Igor