I have tried to search for a solution to my problem on arduino.cc and google but could not find relevant help, therefore I make my post here.
Problem: when I change the baud rate (for instance from 9600 to 115200) my Arduino Uno runs fine, so no problem here. However, if i try to open the serial monitor with Serial.begin different from bauderate 9600 the serial port /dev/ttyACM0 start to give me errors. Arduino first suggests to use /dev/ttyACM1 (/dev/ttyACM0 is gone!) although I do not have two arduinos connected to my computer. After closing arduino IDE and unplugging the arduino board and setting on everything back again (now ACM1 is gone and ACM0 appears in the serial port as it should) I get following error when I try to upload my code:
processing.app.SerialException: Error opening serial port '/dev/ttyACM0'.
at processing.app.Serial.<init>(Serial.java:179)
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:2407)
at java.lang.Thread.run(Thread.java:745)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:212)
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:2407)
at java.lang.Thread.run(Thread.java:745)
I am 100% sure that nothing is wrong with my code, since it worked all the time before.
But I am doing something wrong and the question is what? I had this problem once before and the solution was to reinstall operating system Fedora!! Reinstalling Arduino did not solve the problem
I use Arduino Uno with operating system Fedora 21.
I do not recognize those error messages, so I'm not sure what is going on.
You have a Arduino Uno ? Which one ? An official Arduino Uno version R3 ?
Or a clone with some other usb-serial chip on board.
Changing of COM port can happen with Arduino Leonardo board, but I assume you don't have that. That could mean that your Arduino Uno doesn't get enough power or the USB cables are very bad, or the USB connectors are dirty.
Is something connected to the Arduino Uno. A servo motor for example ?
When nothing is wrong with the hardware, it can be software. The new Arduino IDE 1.5.8 BETA is less dependent on the Java libraries, and doesn't need the troublesome Java RX TX library anymore.
Could you try to install a minimum Java, and be sure to remove the Java RX TX library.
Remove also the installed Arduino IDE, if you have installed it from the repositories.
Unzip the Arduino IDE 1.5.8 into a folder and run it from that folder.
Thank you for your reply, I will do the steps you have suggested right now.
I have an official Arduino Uno R3, nothing is connected to the Arduino when I try to upload the program. My main goal with this board is to use it for storing analog data and driving stepper motors.
The problem is that once my serial port name gets changed to /dev/ttyACM1 I am not able to upload anything whatsoever I do. Even after Arduino reset when my serial port gets the correct name /dev/ttyACM0 I am not able to upload.
To delete and then reinstall Arduino (sudo yum install Arduino) does not help. What helps is to reinstall Fedora!!! which I find quite problematic and cumbersome.
This seems to be an issue with Java and I do not know how to solve it
Good news, I think I have solved my problem!! The default baud rate is set to 9600, and for some strange reason you might get into trouble if you are using different baud rate in your Serial.begin. All I did was to change the line ''serial.debug_rate=9600'' in my preferences.txt file to whatever baud rate I was using LAST time I uploaded code to my arduino.
Another thing is that my serial port name has now changed to /dev/ttyACM1 for good.
Arduino IDE 1.0.5 seem to have some unexpected issues, but I am very happy that I do not need to reinstall Fedora.
EDIT: after computer restart my serial port got its original name /dev/ttyACM0 so everything is fine now I guess.