Hi all,
I'm a total Arduino noob. Recently got myself an Arduino Uno (genuine one, not a clone) and am having trouble making it talk to Linux. I introduced a small udev rules file and made it say something like this:
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="2341", SYSFS{idProduct}=="0001", MODE="0666"
That makes it so I get the right permissions for a non-root user when running the ardiuno IDE. Initially /dev/ttyACM0 was getting recognised all the time. I wrote some code to interface with an LCD using some of the tutorials and uploaded it, it all worked OK. Then I started experimenting with 1-wire and that's where all my problems began. Most of the 1-wire temp sensing examples use the serial port, and what seems to happen with alarming regularity is the board gets in a state with the tx light on solid (presumably sending some serial data?) and just about then, I lose the connection between the IDE and the USB device, get complaints on the command-line about ttyACM0 lock files and so on. The IDE slows to a crawl at this point, I guess it's repeatedly trying (and failing) to contact the board.
My theory is that if you happen to upload something which writes too much information to the serial port, you can no longer program the board. To get out of this state I've found by trial and error, that I need to do the following (often about 3-4 times in succession) in order to get back to a working board:
- Unplug the USB connector (otherwise the IDE takes forever to load and runs like treacle when it does)
- Choose the barebones example (the one with empty setup() and loop() functions)
- Compile it (it's only ~400 bytes)
- Plugin the board and very quickly after hit the upload button
- Wait and hope for the best
I repeat this about 4-5 times and eventually, I get the bare bones example back on the board, the tx light goes out, and from then the IDE recognises my /dev/ttyACM0 device without too many problems. Everything tends to go OK from then up until the time when I start messing with serial code, and I then get the problem back again, I think it might have something to do with letting too much data accumulate in the Linux ttyACM0 receive buffer, without having the serial terminal open to deal with it. It's just a theory. There is obviously some buffering going on, because if you open the serial terminal a little while after you program finished uploading, you still get the startup messages appearing.
If anyone has any idea what's going on, please let me know. This is driving me nuts. I thought the Arduino was supposed to be easy to use. Up until I started messing with the serial device, that was certainly the case, but now I'm considering going back to prototyping my own AVR circuits and using my USBTiny, for this project it's really important I have reliable communication between the Arduino and Linux, so any tips or tricks to make this work a bit more reliably will be appreciated.
thanks,
Biff.