{"id":25,"date":"2007-09-22T16:24:59","date_gmt":"2007-09-22T22:24:59","guid":{"rendered":"http:\/\/blog.blockos.org\/?p=73"},"modified":"2007-09-22T16:24:59","modified_gmt":"2007-09-22T22:24:59","slug":"arduinosferatu","status":"publish","type":"post","link":"https:\/\/blog.blockos.org\/?p=25","title":{"rendered":"Arduinosferatu"},"content":{"rendered":"<p>Months ago, I bought an <a href=\"http:\/\/www.arduino.cc\">Arduino<\/a>. It comes with a nice <a href=http:\/\/www.arduino.cc\/en\/Main\/Software\">ide<\/a> but I always used it under Windows. This summer I decided to stop using Windows and I haven&#8217;t played with the <a href=\"http:\/\/www.arduino.cc\">Arduino<\/a> since then.<\/p>\n<p>Some days ago I purchased some stuffs from <a href=\"http:\/\/www.sparkfun.com\">Sparkfun<\/a> (some dataflash, resistors, etc&#8230;) in order to make some kind of backup device for the pc-engine. So I decided to install the <a href=\"http:\/\/www.arduino.cc\/en\/Main\/Software\">Arduino softwares<\/a> on my box. I&#8217;m currently running a Fedora core 7 for amd64. There are instructions for <a href=\"http:\/\/www.arduino.cc\/playground\/Linux\/Fedora\">Fedora core 6<\/a> on Arduino site. But as I&#8217;m running on an amd64 I had to recompile some stuffs.<\/p>\n<ol>\n<li><b><a href=\"http:\/\/java.sun.com\">Java<\/a><\/b><br \/>\nThere&#8217;s no official package for sun&#8217;s java on Fedora. Just follow the <a href=\"http:\/\/ccl.net\/cca\/software\/SOURCES\/JAVA\/JSDK-1.6\/\">instructions<\/a> from Jan K. Labanowski of the Computational Chemistry List, Ltd and you are done in less than 10 minutes.\n<\/li>\n<p><\/p>\n<li><b><a href=\"www.avrfreaks.net\/AVRGCC\">AVR tools<\/a><\/b><br \/>\nIt&#8217;s the easiest part. Fedora core 7 includes all you need. You&#8217;ll have to install the following packages:<\/p>\n<ul>\n<li>avr-binutils.x86_64<\/li>\n<li>avr-gcc.x86_64<\/li>\n<li>avr-libc.noarch<\/li>\n<li>avr-gcc-c++.x86_64<\/li>\n<li>avr-libc-docs.noarch<\/li>\n<li>avr-gdb.x86_64<\/li>\n<li>avrdude.x86_64<\/li>\n<\/ul>\n<\/li>\n<p><\/p>\n<li><b><a href=\"http:\/\/www.rxtx.org\">RXTX<\/a><\/b><br \/>\nArduino comes with a precompiled version of RXTX. Unfortunately it&#8217;s a 32bits version. You&#8217;ll have to recompile it or you&#8217;ll have some nasty messages when trying to run Arduino. Well, it won&#8217;t crash immediately. You&#8217;ll be able to set the program directory. But once you press OK, it will crash and you&#8217;ll get a nice error message.<br \/>\nAfter trying to compile the CVS version of RXTX, I went for a release vesion. The latest one is <a href=\"ftp:\/\/ftp.qbang.org\/pub\/rxtx\/rxtx-2.1-7r2.zip\">2.1-7r2<\/a>. According to the INSTALL file, all I had to do was the standard &#8220;<em>.\/configure; make; make install<\/em>&#8221; combo.<\/p>\n<p>Unfortunatelly, the kernel headers test from the configure script failed. It&#8217;s trying to compile some piece of C code but. Here&#8217;s the error : <code>error: 'UTS_RELEASE' undeclared (first use in this function)<\/code> It seems that all distros are patching RXTX to remove the use of this variable. In fact it&#8217;s only used for a sanity check. If the current kernel version is different from the one RXTX was compiled for it will prompt some error message. If you really want to use it you&#8217;ll have to add the right header in the configure script (<em>check_kernel_headers<\/em>)  and some various C files.<\/p>\n<p>I went the dirty way and simply removed it. Hopefully there&#8217;s <a href=\"http:\/\/trac.nslu2-linux.org\/optware\/browser\/trunk\/sources\/rxtx\/no-UTS_RELEASE.patch\">a patch from the nslu2-linux project<\/a> which will do the work for you on the sources. But you&#8217;ll still have to remove the <em>check_kernel_headers()<\/em> from the configure script.<\/p>\n<p>But that&#8217;s not the end of your problems! <em>make install<\/em> won&#8217;t work. You&#8217;ll have the following error :<br \/>\n<code> make  all-am<br \/>\n make[1]: Entering directory `\/<mumble mumble your directory>\/rxtx-2.1-7r2'<br \/>\n make[1]: Nothing to be done for `all-am'.<br \/>\n make[1]: Leaving directory `\/<mumble mumble your directory>\/rxtx-2.1-7r2'<br \/>\n libtool: install: `x86_64-unknown-linux-gnu\/librxtxRS485.la' is not a directory<br \/>\n Try `libtool --help --mode=install' for more information.<br \/>\n make: *** [install] Error 1<\/code><br \/>\nHopefully this issue is addressed in <a href=\"http:\/\/rxtx.qbang.org\/wiki\/index.php?title=FAQ&#038;redirect=no#RXTX_installation_fails_with_JDK_1.6\">the RXTX faq<\/a>.<\/p>\n<p>After installing RXTX, edit <b>\/usr\/java\/jdk1.6.0_02\/jre\/lib\/javax.comm.properties<\/b> (create the file if it&#8217;s missing) and add the following line :<br \/>\n<code>Driver=gnu.io.RXTXCommDriver<\/code><\/p>\n<p>We are now ready to run the Arduino software!\n<\/li>\n<p><\/p>\n<li><b><a href=\"http:\/\/www.arduino.cc\/en\/Main\/Software\">Arduino<\/a><\/b><br \/>\nThe latest version is <a href=\"http:\/\/www.arduino.cc\/files\/arduino-0009-linux.tgz\">Arduino 0009<\/a>. Install it wherever you want. Let&#8217;s say <em>~\/arduino<\/em>. When you are done go to <em>~\/arduino\/lib<\/em>. Remove <em>RXTXcomm.jar<\/em> and <em>librxtxSerial.so<\/em>. Then edit <em>~\/arduino\/arduino<\/em> and modify both CLASSPATH and LD_LIBRARY_PATH to point to the directory containing <em>RXTXcomm.jar<\/em> and <em>librxtxSerial.so<\/em>. Here&#8217;s what it looks like on my system :<br \/>\n<code>CLASSPATH=java\/lib\/rt.jar:lib:lib\/build:lib\/pde.jar:lib\/core.jar:lib\/antlr.jar:lib\/oro.jar:lib\/registr<br \/>\ny.jar:lib\/mrj.jar:\/usr\/java\/jdk1.6.0_02\/jre\/lib\/ext\/RXTXcomm.jar<\/code><br \/>\n<code>LD_LIBRARY_PATH=`pwd`\/lib:${LD_LIBRARY_PATH}:\/usr\/java\/jdk1.6.0_02\/jre\/lib\/amd64:\/usr\/lib:\/usr\/local\/l<br \/>\nib<\/code><\/p>\n<p>At this point we are nearly done. Don&#8217;t forget to give your user the permission to the usb device (<em>\/dev\/ttyUSB0<\/em> in my case). Plug the Arduino board and launch the ide. There&#8217;ll be some gcc warnings. Don&#8217;t pay attention to them.<\/p>\n<p>First set the serial port. Go to <b>Tool > Serial Port <\/b> and choose the correct interface. If you don&#8217;t know it,  leave the menu and unplug the board. Go to the <b>Serial Port<\/b> menu and note the currently listed interface. Replug the board. And return to the <b>Serial Port<\/b> menu. A new usb interface may have appeared. It&#8217;s the interface the board is connected to.<\/p>\n<p>You&#8217;ll have to check if the ide is set to the microcontroller. If it&#8217;s not the case when you&#8217;ll want to upload your code to board, you&#8217;ll have the following error:<br \/>\n<code>avrdude: Expected signature for ATMEGA168 is 1E 94 06<\/code><br \/>\nTake your board and look for the chip type. You can&#8217;t miss it, it&#8217;s written on it \ud83d\ude42 To change the microcontroller go to <b>Tools > Microcontroller (MCU)<\/b> and choose your chip (ther&#8217;s an ATMEGA8 on my board).<\/p>\n<p>At this point everything should be alright.\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Months ago, I bought an Arduino. It comes with a nice <a class=\"continue-reading-link\" href=\"https:\/\/blog.blockos.org\/?p=25\">Continue reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,3],"tags":[26,12],"_links":{"self":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/25"}],"collection":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":0,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}