Arduino IDE code upload problem

I have ubuntu 18.04 with the Arduino IDE . The problem I always have is that when I want to upload a code and connect the USB cable from arduino to laptop ,I always get the same error:

The error:

An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "/dev/ttyACM0": Device or resource busy

I always check the port in IDE. I have the 1.8.12 version ,I tested it with other versions ,but I had the same error. With windows ,I didn't have this problem. Why is this happening and how can I solve it? It's very bad problem and I have to push the upload button(in IDE -> Ctrl+U) many times or to remove and then put again the cable in pc a lot of times . So it takes me a minute to do all this thing What should I do? I'm desperate and angry with this problem.

Note: The same problem appeared with Ubuntu 19.04.

By the way,arduino IDE compile FASTER a big code than windows. Ιncredible different time!!! Thanks!!!

8

2 Answers

The ModemManager can conflict with /dev/ttyACM0. You have two options:

Disable ModemManager temporarily

systemctl stop ModemManager.service

This will stop ModemManager until the next reboot. You will need to run this command every time you reboot your computer.

Remove ModemManager completely

You can remove ModemManager completely, but this means you will not be able to use any modem with Ubuntu anymore. So if you use a USB modem for internet, do not remove the ModemManager.

This is what ModemManager does:

ModemManager is a DBus-activated daemon which controls mobile broadband (2G/3G/4G) devices and connections. Whether built-in devices, USB dongles, bluetooth-paired telephones, or professional RS232/USB devices with external power supplies, ModemManager is able to prepare and configure the modems and setup connections with them.

If you are sure you will never use a Modem, run the following command to remove the modem completely:

sudo apt-get --purge remove modemmanager

After you write your code and compile it, open the terminal. If your port is, say, ttyACM0, run this:

ls /dev/ttyACM0
sudo chmod a+rw /dev/ttyACM0

Enter your password at the prompt and hit Enter. And now, you're good to go and upload the code

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like