Go Down

Topic: Arduino on Linux (Read 30270 times) previous topic - next topic

erich

Oct 11, 2005, 06:12 pm Last Edit: Oct 11, 2005, 07:04 pm by erich Reason: 1
hi,
first I have to say thx to the arduino developers to make the effort of having their app cross OS.

here some steps i had to take to make arduino work on linux.

i  m running debian unstable.
open a xterm:

- to get java add the following line to /etc/apt/sources.list
or substitute the url with another mirror from http://www.blackdown.org:
deb ftp://ftp.easynet.be/blackdown/debian unstable main non-free

- install avr-gcc (debian package is gcc-avr), avr-libc, binutils-avr and jikes

- add the path tojava/bin and rt.jar to your CLASSPATH:
in my case this looks like:
export CLASSPATH=/usr/java/jre1.5.0_02/bin:/usr/java/jre1.5.0_02/lib/rt.jar

-add the path to avr-gcc to DIRAVR, note the deafault for that iis /bin, and at the moment this will be added to what stands in DIRAVR, so i needed to add:
export DIRAVR=/usr

you can check on this variables with the env command
note that as soon as you close your xterm this settings are gone. for a tutorial on environment variables look at:
http://www.dynamic-apps.com/tutorials/classpath.jsp

got to trunk/build/linux:
compile it:
./make.sh
start it:
./run.sh

now the ide is running.
if i now try to compile a sketch i get an error that avr-gcc
is not found and i should add it to the PATH which i do
not understand as /usr/bin is in my PATH

any ideas ?

another thing is that at the moment i do no tknow how to tell
the app that my serial port is at /dev/ttyUSB0 as it is not descoverd and i can not add it by hand.

erich


mellis

#1
Oct 11, 2005, 08:40 pm Last Edit: Oct 11, 2005, 09:07 pm by mellis Reason: 1
Thanks for the great instructions.  I'll add them to the documentation soon.

Right now, the IDE looks for avr-gcc in ARDUINO/tools/avr/bin, so you'll need to create a symbolic link to /usr/bin from that directory.  You may also need to install the libc-avr (or avr-libc) package, which contains the standard C library for the AVRs (and which doesn't seem to be a prerequisite for avr-gcc).

To upload code to the board, you'll need the uisp package.  Make sure that the binary (or a link to it) is in the same directory as avr-gcc (e.g. /usr/bin).

The serial library we're using (RXTX) doesn't seem to know about serial ports named USB.  Try creating a symbolic link from /dev/ttyS48 (for example) to /dev/ttyUSB0.

Also, remember to switch the baud rate in the "Tools | Serial port speed" menu to 9600.

I'm sorry this is so hard to get working.  Is anyone interested in helping create a debian (or redhat or ...) package for Arduino?  It could be useful for Processing and Wiring as well.

erich

hi,

i now did the following:

- installed uisp

- added symlink from /dev/ttyUSB0 to /dev/ttyS5
after restarting arduino it recognized the new port.

- added directory in the work directory:
tools/avr/bin/
in this directory i made the symlinks to the following applications: avr-gcc  avr-objcopy  avr-objdump  avr-size  uisp

when i now run zb the led_blink sketch it compiles fine

exporting it gives me the "device is not responding correctly" error message, even i reset before exporting.
baudrate is 9600

i m allowed to write to /dev/ttyS5 and even see the TX led blinking when i send down something from the shell via cat.

any idea ?

erich

ps. when i get it working i will write a nice howto
ps.2 just as a reminder for myself, i forgot to mention in the previous post that also j2re1.4 has to be installed

admin

Erich

Great job on getting arduino to work on linux :)

I've tried on my linux box and I think your problem now is that the bootloader on your board is running at 19200 baud and not 9600.

When gianluca started shipping the usb boards I gave him a the new bootloader to install which runs at 19200.

if you get a chance to build the parallel port programmer you can upgrade to the latest bootloader  (another mellis masterpiece) that takes only 1 k of space instead of the 2k used by the old one.

massimo

Jose Alvarez Rilla

Hi,

I'm one of the attendants to the Madrid workshop. Congratulations for the good work.

I've almost made Arduino work on my Debian laptop. I'm using Debian stable (Sarge), and after a few headaches with getting Java to work right (had to switch from Sun's to BlackDown's j2sdk to bypass some Sun bugs) I finally compiled the IDE.

Somehow, the installation script skipped the targets directory (maybe my fault, don't know) and had to cp it manually to the work/lib directory.

Now Arduino is compilng the sketches fine, but whenever I try to export them to the board, I'm getting this:

Code: [Select]
->/dev//dev/ttyS0
Error: No such file or directory


How can I tweak this?

erich

is this really the correct error message ?
/dev//dev/ttyS0 does not exist at all.
strange that you get an additional /dev in front.

otherwise if you use the USB board your serial device most likely is called /dev/ttyUSB0 (you can look this up with the dmesg command, after attaching it)
as already pointet out before by mellis, the RTXTX lib does not recognize USB serial devices, so you need to make a symlink
to a non existing /dev/ttySx, zb:
log in as root and then:
ln -s /dev/ttyUSB0 /dev/ttyS10

restart arduino and the new serialport should show up.
maek shure you have the rights to read and write from/to it.

best

erich

Jose Alvarez Rilla

Yes, that's the correct message... I'm using the serial board, and I know that /dev//dev/ttyS0 doesn't exist ;)

Seems like an extra "/dev/" string is added somewhere.  ???

erich

massimo,

is there a reason why it would not work with the other "older"
bootloader ?

erich

mellis

Jose: it sounds like you have a slightly old version of the source (the linux version has been changing quickly :) ).  Run "svn update" from in the root arduino directory, and then, from the build/linux directory, "rm -rf work" and "./make.sh".  That should fix the "/dev/dev" problem and the new make.sh script should copy the targets/ directory.

The bootloader issue concerns the baud rate at which it connects to the computer.  Older versions of the bootloader (including the one burned on the serial boards at the Madrid workshop) run at 9600 baud.  Newer versions (including the one on the pre-assembled USB boards) run at 19200 baud.  The baud rate in the bootloader must match the one in the "Tools | Serial port speed" menu or the upload won't work.  

Again, thanks for your patience and posts.  It's a big help getting the Linux version working (esp. now that my Ubuntu laptop seems to be dead).

erich

hi,

well then ist a different issue, because neather 19200 nor 9600
is working here.

erich

jose

Well, thanks for the help.

I updated the code and finally i have the IDE working in my Debian Sarge with the serial board. Next, I'll try and get the serial proxy compiled and working in the same machine.

Also, I've been talking with David today about making a .deb package... I've never made one, but I'll start reading the documentation to see if it's feasible for me, although I guess the code should be quite stable before we pack it!

erich

hi,

this might now as well belong to the hardware section but ...

as i was neather on windows or linux able to export a file to the board (tried different settings and scenarios) without the " [VP 1] Device is not responding correctly." message i thought i try the new  bootloader.
i build the isp and updated the bootloader,
which worked without any problems.
but the behaviour on win and linux is still the same.

if i download, the TX gets red once, and then the RX
keeps blinking.

could it be that my board is damaged ?

erich


erich

i give the answer to myself:
one has to press the export button on the ide twice after resetting the board.

finally i can say the ide is successfully running under linux !

cheers

erich

mellis

Damn, I should have thought to suggest that.  That will be fixed in the next version and you'll only have to click once.

Congratulations on getting everything working.

If you (or jose or anyone else) would like, we'd love to have a howto for getting Arduino running under linux.  We have some preliminary instructions in the general build instructions:

http://svn.berlios.de/viewcvs/arduino/trunk/build/howto.txt?view=markup

and a few notes in the comments at the top of the linux make.sh:

http://svn.berlios.de/viewcvs/arduino/trunk/build/linux/make.sh?view=markup

erich

hi,
here a dirty summary for installing
arduino on debian unstable:
with the next checkout i will update it.

- you need a kernel supporting the ftdi serial/usb chip

- install the "subversion" package to be able to check out arduino:

- check out the code via the instructions on  https://developer.berlios.de/svn/?group_id=3590

- to get java add the following line to /etc/apt/sources.list
  deb ftp://ftp.easynet.be/blackdown/debian unstable main non-free
  or substitute the url with another mirror from http://www.blackdown.org

- install avr-gcc (debian package is gcc-avr), avr-libc, binutils-avr, jikes, uisp, j2re and j2sdk

- add the path tojava/bin and rt.jar to your CLASSPATH:
  in my case this looks like:
  export CLASSPATH=/usr/java/jre1.5.0_02/bin:/usr/java/jre1.5.0_02/lib/rt.jar

- add the path to avr-gcc to DIRAVR, note the default for that is /bin,
  and at the moment this will be added to what stands in DIRAVR, so i needed to add:
  export DIRAVR=/usr

- you can check on this variables with the "env" command
  note that as soon as you close your xterm this settings are gone. for a tutorial on environment variables look at:
  http://www.dynamic-apps.com/tutorials/classpath.jsp

- cd to trunk/build/linux:

- compile it:./make.sh

- add symlink from /dev/ttyUSB0 to /dev/ttyS5 (use a non existing /dev/ttyS*)
  ln -s /dev/tty/USB0 /dev/ttyS5

- added following directory in the work directory: tools/avr/bin/

- in this directory i made the symlinks to the following applications: avr-gcc  avr-objcopy  avr-objdump  avr-size  uisp

- start it: ./run.sh

Go Up