1

I try to upload arduino code to an Arduino Mega. The serial port is detected the first time I plug in the board. As soon as I upload, I get an error saying 'Error opening Serial Port '. And then the Serial Port option is not available for some time. The error repeats the next time I try to upload.

Binary sketch size: 1,500 bytes (of a 258,048 byte maximum)
processing.app.SerialException: Error opening serial port    '/dev/ttyACM0'.
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:175)
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:745)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)
at processing.app.Serial.<init>(Serial.java:163)
  ... 9 more
processing.app.debug.RunnerException: Error opening serial port '/dev/ttyACM0'.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:101)
at      processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:175)
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:745)
  • 2
    OP states the problem was solved after reinstalling Arduino – Zanna Jan 12 at 12:11
0

To solve that I added myself to the group that owns the port device (the dialup or dialout group from memory). Either that or make the port device world writable.

  • How should I do that ? I am using arduino IDE on ubuntu for the about a week. So I am not proficient with it. I tried the following code - sudo usermod -a -G dialout username. Itwas not able to fix it. – Chinmay Harmalkar Sep 20 '16 at 16:31
  • That seems like the correct command to add yourself to the dialout group. Have you logged out and back in again? If that still doesn't work, you'll need to make sure the device and/or groupnames are correct. Do you have a /dev/ttyACM0? Sometimes the port device is /dev/ttyUSB0. If you do ls -l /dev/tty* you should see which devices exist and which group has write access to them. – styro Sep 21 '16 at 3:18
  • I did log out and log back in with the proper device name too. It did not solve it. I then installed arduino again. it seems to have solved the problem. Thanks a lot... – Chinmay Harmalkar Sep 22 '16 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.