I'm on Linux Manjaro. I plugged my Arduino Leonardo clone (that I know works correctly). And tried to flash a blank project on it:
(My IDE version is 1.8.12
)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
It gives me this error:
Sketch uses 3410 bytes (11%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
processing.app.debug.RunnerException
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
at processing.app.SketchController.upload(SketchController.java:732)
at processing.app.SketchController.exportApplet(SketchController.java:703)
at processing.app.Editor$UploadHandler.run(Editor.java:2047)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: processing.app.SerialException: Error touching serial port '/dev/ttyACM1'.
at processing.app.Serial.touchForCDCReset(Serial.java:107)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
... 5 more
Caused by: jssc.SerialPortException: Port name - /dev/ttyACM1; Method name - openPort(); Exception type - Permission denied.
at jssc.SerialPort.openPort(SerialPort.java:170)
at processing.app.Serial.touchForCDCReset(Serial.java:101)
... 6 more
1 Answer 1
Okay I found a way to do this. Open Terminal and type:
ls -l /dev/ttyACM*
you will get something like:
crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0
The "0" at the end of ACM might be a different number, or multiple entries might be returned. The data we need is dialout
(is the group owner of the file).
Now we just need to add our user to the group:
sudo usermod -a -G dialout <username>
So for me that would be:
sudo usermod -a -G dialout john
BUT it seems to work with dialout
on ubuntu/debian based distros. I am on Manjaro
and instead of dialout
I had to use uucp
(and in general on Arch
based distros) so:
sudo usermod -a -G uucp john
You will need to log out and log in again for this change to take effect.
This is the procedure to access the serial port from the Arduino Software (IDE) if you get an error
After this procedure, you should be able to proceed normally and upload the sketch to your board or use the Serial Monitor.
Although for me that wasn't over. After doing this the only error I got was Arduino IDe simply saying that it doesn't have permission to write to that port. So I had to start Arduino IDE
by:
sudo arduino
in the terminal. After that everything works just fine.
I found help at those links:
sudo
?