6

This problem doesn't seen to be very common around the Arduino community.

Basically, what's happening is that as soon as I click the upload button, the Arduino IDE tells me that my Arduino board is not connected. What's strange though is that the python application ino is able to upload my code just fine, so my only guess is that there is something wrong with the IDE itself.

Here's a copy of the error message I am getting at the time of uploading the sketch:

Binary sketch size: 444 bytes (of a 32,256 byte maximum)processing.app.SerialException: Error opening serial port '/dev/ttyACM1'.at processing.app.Serial.<init>(Serial.java:178)at processing.app.Serial.<init>(Serial.java:77)at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:174)at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)at processing.app.Sketch.upload(Sketch.java:1671)at processing.app.Sketch.exportApplet(Sketch.java:1627)at processing.app.Sketch.exportApplet(Sketch.java:1599)at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)at java.lang.Thread.run(Thread.java:744)Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameterat gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)at processing.app.Serial.<init>(Serial.java:163)... 9 moreprocessing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM1'.at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:174)at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)at processing.app.Sketch.upload(Sketch.java:1671)at processing.app.Sketch.exportApplet(Sketch.java:1627)at processing.app.Sketch.exportApplet(Sketch.java:1599)at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)at java.lang.Thread.run(Thread.java:744)

I am expecting to hear a few questions regarding this issue, so I'll go ahead and answer all the questions I can think of.

Is this the first time you trying to connect to the Arduino from this computer?

No. In fact, I was able to upload the same source code just fine less than two hours ago.

Did you try a different USB cord?

Yes, I did.

Can you upload the source code from a different computer?

Yes, I can.

Have you tried removing and reinstalling the IDE?

Yes, I have.

Have you tried a different USB port?

Yes, I have.

What seems to be the problem here?

chicks
  • 227
  • 4
  • 10

4 Answers4

3

First of all, you must test if the device that you are trying to access, actually exists. The device file may change when you replug the Arduino. The easiest way to accomplish that is to find the device name in the error message, in this case /dev/ttyACM1. Then check two things:

  1. Does the device file exist in the /dev tree? ls -l /dev/ttyACM*
  2. Is the Arduino IDE configured to use the correct device? Check under Tools => Serial Port.

Maybe another application is using the device. When working on Linux, you can verify this with the following commands:

$ lsof /dev/ttyUSB0
COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF      NODE NAME
avrdude 7356   jippie    3u   CHR  188,0      0t0 266450197 /dev/ttyUSB0

or

€ fuser /dev/ttyUSB0
/dev/ttyUSB0:         7356

Where of course you have to replace /dev/ttyUSB0 with the device file as mentioned in the error message. In case of this question /dev/ttyACM1, but do notice that the number can change when you unplug the board for a moment and then replug it.

In both results, the 7356 is the PID of the process that is locking the device. In my example I was reading flash from the command line, so the output for your specific situation will be different. To identify the process, you can use:

$ ps -fp 7356
UID      PID  PPID  C STIME TTY          TIME CMD
jippie  7698 28116  1 20:34 pts/8    00:00:00 avrdude -patmega1280 -carduino -P/dev/ttyUSB002 -b57600 -D -Uflash:r:/tmp/flash:i

or a more portable command:

$ ps -ef | grep 7356
jippie  7698 28116  1 20:34 pts/8    00:00:00 avrdude -patmega1280 -carduino -P/dev/ttyUSB002 -b57600 -D -Uflash:r:/tmp/flash:i
jippie
  • 2,901
  • 14
  • 23
2

A pretty detailed troubleshooting guide is available at arduino.cc. Besides the checks already mentioned in the question and the answers, it is recommended to check that serial.download_rate is set to 19200 in ~/.arduino/preferences.txt.

19200 is the default baud rate used by most bootloaders, so this doesn't apply if you don't use one, or use a modified version.

Dmitry Grigoryev
  • 1,288
  • 11
  • 31
1

I have same problem after set baud rate to 14400. For fix this I manual set serial.debug_rate=115200 in config file ~/.arduino/preferences.txt

Pavel
  • 21
  • 1
1

Try setting the baud rate to 9600 in the Serial Monitor. You need a working serial port to open the Serial Monitor. Or go to >File >Preferences> and edit the preferences.txt (must close Arduino IDE before editing) "serial.debug_rate=9600"

I have several Arduino boards and had the exact same issue with the boards that use the Atmel mega8U2 as the USB - serial bridge. The boards with the FTDI USB bridge (SparkFun Red board, Pro mini) did not show the same problem. Setting the baud rate solved my problem.

There is a firmware upgrade for 8U2 that might fix it but I didn't want to risk making bricks. ;-)

mc789
  • 11
  • 2