avrdude: ser_open(): can't open device /dev/ttyACM0: Device or resource busy
you first need to make sure you have the correct read/write rights, as described here, esentially enter following commands:
$ sudo adduser <username> dialout
$ sudo chmod a+rw /dev/ttyACM0
the '/dev/ttyACM0' is the port your arduino is connected to, it should be listed in the /dev folder of your root.
second: after you have identified which port the arduino is connected to and you have set the correct rights for this port, you need to run following command. I am not sure what it does, I am not sure if it's really needed, but it made the uploads work for me on several occasions
$ sudo udevadm trigger
found this command here: http://starter-kit.nettigo.eu/2015/serial-port-busy-for-avrdude-on-ubuntu-with-arduino-leonardo-eth/
and third, you will find the upload sometimes a challenge of timing and luck. Keep pressing the reset (sometimes twice very consecutively) and meanwhile press the upload button of your arduino sketch. At certain moment, it will work. I had more luck when constantly changing small pieces in the code, so when I pushed 'upload', it had to compile the code first.
https://www.arduino.cc/en/Guide/Troubleshooting#upload
on some computers, you may need to push teh reset button
I have never messed with the bootloader, nor with ICSP pins and such (luckily)
Also have a look on the Arduino forum
or on the link provide by yourself
Kill process that raises Device or resource busy: '/dev/ttyUSB0'?
You can use
$ fuser /dev/ttyUSB0
to list the PIDs of the processes using the file. Alternatively, if your fuser
command supports it you can use the -k
option to kill them.
Could not open port error immediately after plugging in Arduino on Arch Linux
ModemManager might be the cause of your troubles. Try disabling it with, e.g. pkill -STOP ModemManager
(continue the process with -CONT
).
ModemManager is a (fantastic) piece of software that makes your 3G dongles work automagically. Because the Arduino appears as a serial modem, ModemManager tries to take control over it.
You can stop ModemManager from doing that by attaching a certain variable to your device. See the documentation for details. Essentially, create a udev rule, e.g. /etc/udev/rules.d/99-ttyacms.rules
with the following content:
ATTRS{idVendor}=="0ca6" ATTRS{idProduct}=="a050", ENV{ID_MM_DEVICE_IGNORE}="1
Of course, you need to use your IDs. Use lsusb
to find those values.
After you have created this file, reload udev with something like sudo udevadm control --reload-rules
Serial communication error between Arduino and Python
You can connect to your Arduino serial port from only one application at a time.
When you are connected to it via Serial port Monitor, Python couldn't connect to it.
You have two variants of solution:
Use serial sniffer instead of Arduino IDE's Serial Monitor. There are another answered question on this topic: https://unix.stackexchange.com/questions/12359/how-can-i-monitor-serial-port-traffic
Don't use any serial monitor, use Python! You can just continiualy read from serial, and print what have been received, something like this:
import time, serial
time.sleep(3)
ser = serial.Serial('/dev/ttyACM0', 9600)
# Write your data:
ser.write(b'5')
# Infinite loop to read data back:
while True:
try:
# get the amount of bytes available at the input queue
bytesToRead = ser.inWaiting()
if bytesToRead:
# read the bytes and print it out:
line = ser.read(bytesToRead)
print("Output: " + line.strip())
except IOError:
raise IOError()
Related Topics
Mmap: Will the Mapped File Be Loaded into Memory Immediately
Print Kernel's Page Table Entries
Difference Between .Dynamic .Dynsym and .Dynstr in an Elf Executable
How to Get Debugging Symbols Working in Linux Perf Tool Inside Docker Containers
How to Read the Last Line of a Text File into a Variable Using Bash
What Does "$1/*" Mean in "For File in $1/*"
One Liner to Rename Bunch of Files
Linux Socket Using Multiple Threads to Send
How to Make Awk Use the Variable Created in Bash Script
How to Redirect Nohup Output to a Specified File
Is There Any Significant Difference Between Tcp_Cork and Tcp_Nodelay in This Use-Case
Shifting from Windows to *Nix Programming Platform
How to Capture Network Frames in a Kernel Module
Udev - Run Program on Usb Flash Drive Insert
What Unit Is Used to Display Redis CPU Usage
Is There a Clang Mingw Cross Compiler for Linux
How to Overcome an Incompatibility Between the Ksh on Linux VS. That Installed on Aix/Solaris/Hpux