Ошибка при открытии последовательного порта dev ttyacm0

Моя ОС — Ubuntu 18.04, и Arduino работал до сих пор.

Хотя есть несколько решений, ни одно из них мне не подходит.

Я следовал этим инструкциям на сайте Arduino.

Затем я попробовал это на Arduino Stack Exchange, который должен работать в тех случаях, когда первое решение не сработало. Ответ говорит, что мы должны создать несколько правил /etc/udev/ruled.d/ дорожка.

Но никто из них не работал для меня.

Я также проверил Arduino в Windows 10, чтобы увидеть, была ли это аппаратная проблема, но она работала нормально.

У кого-нибудь есть еще идеи как решить эту проблему?

ОБНОВИТЬ:

  • Мое имя пользователя, sergio, является частью обеих групп (tty и dialout);
  • Я вышел из системы и вернулся, как объясняет официальный учебник Arduino;
  • В Arduino IDE правильные конфигурации: Arduino UNO и ttyACM0
  • Это вывод ll /dev/ttyACM0 после запуска обучающих команд:

    crw-rw-rw- 1 root dialout 166, 0 Jul 15 05:41 /dev/ttyACM0
    

ОБНОВЛЕНИЕ 2:

Я создал скрипт для решения этой проблемы: https://github.com/sergiomafra/iniarduino

2018-07-15 12:11

12
ответов

Решение

Переустановите ваш arduino, установленный из программного центра Ubuntu:

sudo apt install --reinstall arduino

Переустановка необходима, так как ваш which avrdude Команда согласно вашему комментарию ничего не возвращает, но должна быть /usr/bin/avrdude, Проверьте еще раз:

which avrdude

Запустите вашу Arduino IDE после переустановки и закройте ее.

Проверьте вашу конфигурацию arduino. открыто /home/sergio/.arduino/preferences.txt файл и проверьте там serial.port вариант. Попробуйте изменить это на /dev/ttyACM0, Откройте этот файл:

sudo nano /home/sergio/.arduino/preferences.txt

и применить соответствующие изменения, т.е. вариант должен выглядеть

serial.port=/dev/ttyACM0

Перезагрузите компьютер после этого.


Bob

15 июл ’18 в 14:33
2018-07-15 14:33

2018-07-15 14:33

У меня была похожая проблема, когда я пытался загрузить эскиз в Arduino. Проблема была связана с отсутствием разрешений на чтение / запись на последовательный порт. Мне удалось исправить с помощью следующей команды:

Чтобы подтвердить, что порт существует, введите следующее из корневого каталога.

ls /dev/ttyACM0

Чтобы установить разрешения на чтение / запись, введите следующее

sudo chmod a+rw /dev/ttyACM0


Adrian

22 янв ’19 в 06:13
2019-01-22 06:13

2019-01-22 06:13

Вот что сработало для меня:

  • Удалите версию с Apt, она не работает должным образом (sudo apt uninstall arduino; sudo apt autoremove)
  • Установите версию с сайта Arduino
  • sudo apt install avrdude так как тот, что на сайте не включает его
  • sudo usermod -a -G dialout [your_username] так как тот с сайта не делает это автоматически

И теперь все снова работает!


Draconis

28 май ’19 в 18:36
2019-05-28 18:36

2019-05-28 18:36

Это помогло решить проблему «невозможно открыть последовательный порт» (введите свое имя пользователя Ubuntu вместо
$USER) после загрузки Arduino из Ubuntu Software.

sudo usermod -a -G dialout $USER  
sudo chmod a+rw /dev/ttyUSB0



18 сен ’20 в 07:10
2020-09-18 07:10

2020-09-18 07:10

В сочетании со всеми сообщениями, которые я прочитал, это то, что я сделал, чтобы решить эту проблему, следуя указаниям из этой темы.

В новом терминале я набрал следующее, как показано ниже.

https://ask-ubuntu.ru/images/5c39e76298639ac790d3dab9915f32a20157efc4.png

Обратите внимание, что fourplus — это мое имя пользователя.

2019-03-10 02:14

У меня была такая же проблема, я попытался установить из Ubuntu Store 18.04 и попробовать любое решение здесь. У меня ничего не работало. Так я скачал последний

Я извлек и запустил следующую команду, чтобы установить его:
$ sudo ./install.sh

После установки я запустил сценарий, входящий в последнюю версию, выполнив следующее:

$./arduino-linux-setup.sh <имя_пользователя>

Как только сценарий будет завершен, он покажет вам сообщение «Пожалуйста, перебронируйте систему». Я не перезапускал, когда пробовал решения здесь, может быть это то, что должны попробовать следующие пользователи.

Важно: при установке программного обеспечения, выполнив следующие действия, вам необходимо перейти в программное обеспечение Ubuntu и дать разрешение на «доступ к USB-оборудованию напрямую».


titusfx

14 сен ’20 в 17:39
2020-09-14 17:39

2020-09-14 17:39

Ха Я новичок и сделал несколько ошибок)) Не делай так, как я.

  1. Во-первых, в моей книге было плохое изображение схемы подключения светодиода. Нашел новый и переподключил провода. Теперь они подключены правильно.
  2. Потом подключил арудино к компьютеру (это важно).
  3. Затем я выполнил следующие команды:

    • ls -l /dev / ttyACM0
    • sudo usermod -a -G dialout [my_username]
    • sudo chmod a+rw /dev / ttyACM0

Когда я искал плату в меню программы Arduino (Инструменты -> Плата), я не нашел «Arduino/Genuino Uno», просто там была «Arduino Uno» (думаю, все в порядке)



01 май ’20 в 22:09
2020-05-01 22:09

2020-05-01 22:09

Я вижу, что вопрос уже принят, но ни одно из решений не помогло мне, поэтому у меня есть другое решение. Я установил IDE arduino через установщик программного обеспечения Ubuntu. Что вам нужно сделать, так это.

  1. Перейдите в IDE arduino в магазине программного обеспечения Ubuntu
  2. нажмите разрешения
  3. установить доступ к USB-оборудованию непосредственно на



22 мар ’20 в 16:24
2020-03-22 16:24

2020-03-22 16:24

Для меня любой
chmodа также
udevправило не сработало.

Только принуждение
avrdudeдля запуска с правами root:

      $ sudo chmod u+s  /opt/arduino/hardware/tools/avr/bin/avrdude


eadmaster

16 июн ’21 в 03:47
2021-06-16 03:47

2021-06-16 03:47

Обновление 2 OP для создания скрипта отлично решает проблему. Проверьте это на GitHub.

      [email protected]:~/Downloads/iniarduino-master$ iniarduino
[sudo] password for vipulgupta2048: 
Arduino connected!
Checking if 2048 is part of dialout and tty groups
2048 added to dialout group
2048 added to tty group
Password required to change permissions of /dev/ttyACM0
Permissions to /dev/ttyACM0 changed to a+rw
Reloading UDEV Rules
UDEV Rules reloaded without the need to restart
All Done!

2022-02-19 20:50

Для меня сработала смесь двух приведенных выше ответов: во-первых, я не смог найти avrdude, which avrdudeэто мне ничего не дало. Итак, мне пришлось переустановить ардуино.

sudo aptinstall --reinstall arduino

Это установило avrdude, и я мог найти его в /usr/bin/avrdude. Следующим шагом было установить разрешение на чтение / запись для последовательного порта:

sudo chmod a+rw /dev/ttyACM0

Затем я мог загрузить скетч на свой ардуино!

2020-07-03 13:14

У меня есть решение.

  1. Найдите свой порт, к которому подключен Arduino (например, мой был
    /dev/ttyUSB0). Вы можете найти это в сообщении об ошибке в Arduino IDE.

  2. Откройте терминал (Ctrl+Alt+T).

  3. В терминале запустите:

    sudo chmod 777 /dev/ttyUSB0
    

    Приведенная выше команда устанавливает необходимые разрешения.



11 дек ’19 в 13:22
2019-12-11 13:22

2019-12-11 13:22

I just had this problem with my Genuine Arduino Mega 2560 trying to connect to it from an Ubuntu 18.04.5 LTS machine using a locally compiled Arduino IDE version 1.8.16. I was able to fix it in my case, so posting here to share the tips.

Came across several other forum topics reporting the same symptoms (even though not all are Mega and not all on Linux):

  • https://arduino.stackexchange.com/questions/33505/why-do-i-get-avrdude-stk500v2-receivemessage-timeout-error-when-uploading-to?newreg=d5f1171d37394be584fc5de8dea6138f
  • https://arduino.stackexchange.com/questions/3316/mega-2560-doesnt-respond
  • https://forum.arduino.cc/t/mega2560-timeout-communicating-with-programmer/132479
  • https://starter-kit.nettigo.eu/2015/serial-port-busy-for-avrdude-on-ubuntu-with-arduino-leonardo-eth/

After troubleshooting for several hours I was able to reliably connect to my Mega. It turned out there were multiple problems that prevented it from working that had to be understood and solved, and when I realized what they were I could not believe my eyes.

The posters who suggested making sure that udev rules are configured to prevent the ModemManager from hogging the Mega device, thereby making it unavailable to the Arduino IDE were on the right track. So I checked my /etc/udev/rules.d/70-snap.core.rules and indeed confirmed that there already was a rule for ModemManager to ignore devices with USB vendor ID 2341, which is the Genuine Arduino:

...
ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1"
...

However, when I did a tail -f /var/log/syslog and plugged in the Mega, I could not believe my eyes to see that ModemManager was still trying to talk to it:

Dec  9 22:09:58 hostname ModemManager[999]: <info>  [device /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2] creating modem with plugin 'Generic' and '1' ports
Dec  9 22:09:58 hostname ModemManager[999]: <warn>  Could not grab port (tty/ttyACM0): 'Cannot add port 'tty/ttyACM0', unhandled serial type'
Dec  9 22:09:58 hostname ModemManager[999]: <warn>  Couldn't create modem for device '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2': Failed to find primary AT port

It looks like the ModemManager was still trying to connect to it as a non-USB TTY device.

The problem was exacerbated in that the Arduino IDE was not handling this problem gracefully and kept hanging and trying to connect to the Mega even after I unplugged it from the USB. Nevertheless, I did a quick ps -ef | grep ModemManager and then kill [PID], waited until the Arduino IDE stopped trying to connect to the disconnected Mega, then plugged it back in, specified the port via ‘Tools’ -> ‘Port’, and again attempted an upload, and it worked like a charm. (Conversely, had I just waited watching /var/log/syslog for ModemManager to give up and free the device Arduino IDE might have also worked without me explicitly killing the ModemManager. That probably explains why it worked sporadically.)

So then I thought I solved all my problems and started bolting the Mega into my device. I tightened the connecting fasteners, and again could not believe my eyes that it stopped working again. Took the Mega back out, unbolted the whole board and now it worked, bolted it back in, and it stopped working. After several rounds, correlated the use of a brass standoff on the hole right next to the pin A6 as causing this problem. I surmise that the metal standoff was shorting out or somehow interfering with PCB traces that run very close to that hole. So stopped bolting in that hole, and the Mega started working fine assembled into my device.

So in my case, 2 problems were preventing the Mega from working and PC connecting to it via USB:

(1) ModemManager was hogging the device as soon as it was plugged in despite the udev USB rules. Solution — killed ModemManager (still need to look into modifying system config so that I don’t have to kill it each time).

(2) Hardware issue with the metal riser interfering with PCB traces near hole next to pin A6. Solution — stopped bolting in that hole.

Hope this is helpful.

If you use an Arduino IDE on Linux (e.g. Ubuntu, Linux Mint, etc.), you may get the following errors while trying to upload a sketch to the Arduino broad:

Caused by: processing.app.SerialException: Error touching serial port ‘/dev/ttyACM0’.
– and –
Caused by: jssc.SerialPortException: Port name – /dev/ttyACM0; Method name – openPort(); Exception type – Permission denied.

In this note i am showing how to permanently fix the “Permission denied” error on the serial port /dev/ttyACM0 while uploading the Arduino sketch.

Cool Tip: Add “Arduino Pro Micro” board to the Arduino IDE! Read more →

The /dev/ttyACM0 device has the group of dialout:

$ stat /dev/ttyACM0
- sample output -
  File: /dev/ttyACM0
  Size: 0         	Blocks: 0          IO Block: 4096   character special file
Device: 6h/6d	Inode: 345         Links: 1     Device type: a6,0
Access: (0660/crw-rw----)  Uid: (    0/    root)   Gid: (   20/ dialout)

The members of the dialout group have full and direct access to serial ports.

To permanently solve the issue with the permissions for /dev/ttyACM0, all you need is to add your user to the dialout group:

$ sudo usermod -a -G dialout <username>

Logout and then log back in for the group changes to take effect.

After that you should be able to upload your sketch to the Arduino broad connected to the serial port /dev/ttyACM0 without any “Permission denied” errors.

Cool Tip: Simulate keystrokes using the Arduino boards! Read more →

Was it useful? Share this post with the world!

I am trying to work with the (new) sparkfun razor IMU 9dof, I wrote a silple sktetch to calibrate the magnetometer:

#include <SparkFunMPU9250-DMP.h> // Include SparkFun MPU-9250-DMP library
#include <Wire.h> // Depending on your Arduino version, you may need to include Wire.h
MPU9250_DMP imu; // Create an instance of the MPU9250_DMP clas
void setup() {
  Serial.begin(115200);

  Serial.println(F("Adafruit 10 DOF Board AHRS Calibration Example")); Serial.println("");

  if (imu.begin() != INV_SUCCESS){
    while (1) {
    Serial.println("Failed to initialize MPU-9250, loop forever");
   }

  }

 imu.setGyroFSR(2000); // Set gyro to 2000 dps

 imu.setAccelFSR(2); // Set accel to +/-2g

 imu.setLPF(5); // Set LPF corner frequency to 5Hz

 imu.setSampleRate(100); // Set sample rate to 10Hz

imu.setCompassSampleRate(100); // Set mag rate to 10Hz
}

void loop(void){
  imu.update();

  // Print the sensor data
  Serial.print("Raw:");
  Serial.print(imu.ax);
  Serial.print(',');
  Serial.print(imu.ay);
  Serial.print(',');
  Serial.print(imu.az);
  Serial.print(',');
  Serial.print(imu.gx);
  Serial.print(',');
  Serial.print(imu.gy);
  Serial.print(',');
  Serial.print(imu.gz);
  Serial.print(',');
  Serial.print(imu.mx);
  Serial.print(',');
  Serial.print(imu.my);
  Serial.print(',');
  Serial.print(imu.mz);
  Serial.println();  

  delay(50);
}

To be sure the Arduino IDE can access to dev/ttcACM0, I did sudo chmod 666 /dev/ttyACM0

I can dowload successfully but when I want to open the terminal I got the following error:

Erreur d’ouverture du port série « /dev/ttyACM0 ». (Port busy) (see attached screenshot)

More over when I entered dmesg on the console, I can see the following messages:

[   94.133923] usb 3-2: USB disconnect, device number 2
[   94.133978] cdc_acm 3-2:1.1: urb 12 failed submission with -19
[   94.135862] cdc_acm 3-2:1.1: urb 13 failed submission with -19
[   94.136059] cdc_acm 3-2:1.1: urb 14 failed submission with -19
[   94.136257] cdc_acm 3-2:1.1: urb 15 failed submission with -19
[   94.136457] cdc_acm 3-2:1.1: urb 2 failed submission with -19
[   94.136656] cdc_acm 3-2:1.1: urb 3 failed submission with -19
[   94.136852] cdc_acm 3-2:1.1: urb 5 failed submission with -19
[   94.137048] cdc_acm 3-2:1.1: urb 6 failed submission with -19
[   94.138841] xhci_hcd 0000:03:00.0: WARN Cannot submit Set TR Deq Ptr
[   94.138843] xhci_hcd 0000:03:00.0: A Set TR Deq Ptr command is pending.
[   94.931853] usb 3-2: new full-speed USB device number 3 using xhci_hcd
[   95.316578] usb 3-2: New USB device found, idVendor=1b4f, idProduct=9d0f
[   95.316581] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   95.316582] usb 3-2: Product: SFE 9DOF-D21
[   95.316584] usb 3-2: Manufacturer: SparkFun
[   95.320306] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[  858.774849] usb 3-2: USB disconnect, device number 3
[  904.529058] TCP: wlp1s0: Driver has suspect GRO implementation, TCP performance may be compromised.

Does anyone outhere experienced such issue?

Thank you for your help

Fabrice

My OS is Ubuntu 18.04 and arduino was working until now.

Although there are a few solutions, none of them seems to work for me.

I followed these instructions on the arduino website.

Then I tried this on arduino Stack Exchange, which should work in cases where the first solution didn’t. The answer says we should create a few rules on /etc/udev/ruled.d/ path.

But none of them worked for me.

I also tested arduino in Windows 10 to see if it was a hardware problem, but it worked fine.

Does anyone have any other ideas on how to solve this issue?

UPDATE:

  • My username, sergio, is part of both groups (tty and dialout);
  • I logged out and back in as arduino official tutorial explains;
  • In Arduino IDE, the configurations are correct: Arduino UNO and ttyACM0
  • This is the output of ll /dev/ttyACM0 after running the tutorial commands:

    crw-rw-rw- 1 root dialout 166, 0 Jul 15 05:41 /dev/ttyACM0
    

UPDATE 2:

I’ve created a script to solve this:
https://github.com/sergiomafra/iniarduino

asked Jul 15, 2018 at 12:11

sergiomafra's user avatar

sergiomafrasergiomafra

5991 gold badge5 silver badges13 bronze badges

7

I had a similar issue when I tried to upload a sketch to Arduino. The issue was connected to the lack of permissions to read/write to the serial port. I was able to fix by using the following command:

To confirm the port exists enter the following from the root directory.

ls /dev/ttyACM0

To set read/write permissions, enter the following

sudo chmod a+rw /dev/ttyACM0

answered Jan 22, 2019 at 6:13

Adrian's user avatar

AdrianAdrian

8447 silver badges2 bronze badges

4

Reinstall your arduino installed from Ubuntu software center:

sudo apt install --reinstall arduino

Reinstalling is necessary since your which avrdude command according to your comment returns nothing, but should be /usr/bin/avrdude. Check again:

which avrdude

Run your Arduino IDE after reinstalling and close it.

Check your arduino configuration. Open /home/sergio/.arduino/preferences.txt file and check there serial.port option. Try to change it to /dev/ttyACM0. Open that file:

sudo nano /home/sergio/.arduino/preferences.txt

and apply corresponding changes, i.e. the option should look

serial.port=/dev/ttyACM0

Restart computer afterwards.

answered Jul 15, 2018 at 14:33

Bob's user avatar

BobBob

2,51510 silver badges15 bronze badges

1

Here’s what worked for me:

  • Uninstall the version from Apt, it doesn’t work properly (sudo apt uninstall arduino; sudo apt autoremove)
  • Install the version from the Arduino website
  • sudo apt install avrdude since the one from the website doesn’t include it
  • sudo usermod -a -G dialout $USER since the one from the website doesn’t do this automatically (the dialout group owns the device file; this adds the current user to that group)

And now everything’s working again!

ESV's user avatar

answered May 28, 2019 at 18:36

Draconis's user avatar

DraconisDraconis

3192 silver badges11 bronze badges

2

This worked to fix the ‘unable to open serial port’ problem (put your Ubuntu username in instead of $USER) after downloading Arduino from Ubuntu Software.

sudo usermod -a -G dialout $USER  
sudo chmod a+rw /dev/ttyUSB0

karel's user avatar

karel

109k100 gold badges266 silver badges296 bronze badges

answered Sep 18, 2020 at 4:10

Sam_Carmichael's user avatar

1

In combination with all the posts I read, this is what I did to solve that issue by following directions from this thread.

In a new terminal, I typed the following as shown below.

https://i.stack.imgur.com/ifRmx.png

Please note that fourplus is my username.

Jeff's user avatar

Jeff

1,61417 silver badges24 bronze badges

answered Mar 10, 2019 at 2:14

Arafat Mukasa's user avatar

2

I had the same issue, I tried installing from Ubuntu Store on 18.04 and try everysolution here. Nothing worked for me. So I downloaded the latest

I extracted and ran the following command to install it:
$ sudo ./install.sh

After installing, I ran the script that came with the latest version by running the following:

$ ./arduino-linux-setup.sh <user_name>

Once the script is complete, it show you a message of «Please Rebook you system». I didn’t restart when I try the solutions here, may be this is something that next users should try.

Important: When you install the software following these steps you need to go to Ubuntu Software and Give Permission to «Access Usb Hardware directly».

answered Sep 14, 2020 at 14:39

titusfx's user avatar

titusfxtitusfx

3112 silver badges9 bronze badges

I see that the question is already accepted but none of the solutions did it for me so I’ve got a different solution. I installed the arduino IDE via the Ubuntu software installer. What you need to do is.

  1. Go to arduino IDE in Ubuntu software store
  2. click permissions
  3. set Access usb hardware directly on on

answered Mar 22, 2020 at 13:24

sjoerd hilhorst's user avatar

1

ha I’m a newbie and I made some mistakes)) Don’t do it the way I do.

  1. First of all, in my book there was a bad picture about the led
    connection scheme. I found new one and reconnected wires. Now they
    are connected correctly.
  2. Then I connected arudino to the computer (it’s important).
  3. Then I executed the following commands:

    • ls -l /dev/ttyACM0
    • sudo usermod -a -G dialout [my_username]
    • sudo chmod a+rw /dev/ttyACM0

When I was looking for a board in menu of arduino programm (Tools -> Board) I did not find an ‘Arduino/Genuino Uno’ just there was an ‘Arduino Uno’ (I guess it’s OK)

answered May 1, 2020 at 19:09

Nefedova Oxana's user avatar

For me mixture of above two answers worked:
First was I couldn’t find avrdude, which avrdude this gave me nothing. So, I had to reinstall the arduino.

sudo apt install --reinstall arduino

This installed avrdude, and I could find it in /usr/bin/avrdude.
Next thing was to set read/write permission to the serial port:

sudo chmod a+rw /dev/ttyACM0

Then I could upload the sketch on to my arduino!

answered Jul 3, 2020 at 10:14

25b3nk's user avatar

For me any chmod and udev rule did not work.

Only forcing avrdude to run as root worked:

$ sudo chmod u+s  /opt/arduino/hardware/tools/avr/bin/avrdude

answered Jun 16, 2021 at 3:47

eadmaster's user avatar

eadmastereadmaster

2662 silver badges7 bronze badges

The OP’s update 2 of creating a script solves the issue just fine. Check it out on GitHub.

2048@machine:~/Downloads/iniarduino-master$ iniarduino
[sudo] password for vipulgupta2048: 
Arduino connected!
Checking if 2048 is part of dialout and tty groups
2048 added to dialout group
2048 added to tty group
Password required to change permissions of /dev/ttyACM0
Permissions to /dev/ttyACM0 changed to a+rw
Reloading UDEV Rules
UDEV Rules reloaded without the need to restart
All Done!

answered Feb 19, 2022 at 20:50

vipulgupta2048's user avatar

I got a solution.

  1. Find your port to which the Arduino is connected (e.g. mine was /dev/ttyUSB0). You may find it mentioned in the error message in Arduino IDE.

  2. Open the terminal (Ctrl+Alt+T).

  3. In the terminal run:

    sudo chmod 777 /dev/ttyUSB0
    

    The above command sets the required permissions.

BeastOfCaerbannog's user avatar

answered Dec 11, 2019 at 10:22

yugal sharma's user avatar

2

Arduino Forum

Loading

Applied latest patch set from Mint and from then on the serial port cannot be found. I’ve followed previous posts, using each USB port in turn, checked ‘groups’ membership, and 2 Arduino UNO’s, looked at the Windows 8 posts on driver permissions (not directly relevant for Linux), but continue to get the error messages (see below). I’ve even tried to remove and reinstall Arduino IDE.

I know the serial port is there, because ‘chmod 777 /dev/ttyACM0’ is successful, and if I send a txt file to that port, the RX LED flashes on the Arduino indicating the virtual port has been created and the Arduino is listening to it.
I now have NO ability to post sketches to my Arduino UNO’s.
Errors from IDE during upload below:

processing.app.SerialException: Error opening serial port ‘/dev/ttyACM0’.
at processing.app.Serial.(Serial.java:178)
at processing.app.Serial.(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:744)
Caused by: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at gnu.io.RXTXPort.setSerialPortParams(RXTXPort.java:213)
at processing.app.Serial.(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:744)

В этой статье я объясню, как решить частую ошибку в Arduino:

avrdude: ser_open (): невозможно открыть устройство "/ dev / ttyACM0": в разрешении отказано

Фон

После долгого времени без использования Arduino я взял две вставки (оригинал и Элегу) поработать с дочерью. Подключаю их, собираюсь поставить моргание, чтобы убедиться, что все в порядке и когда иду отправлять на плату, возвращает известную ошибку.

Arduino: 1.8.5 (Linux), карта: «Arduino / Genuino Uno» avrdude: ser_open (): не удается открыть устройство «/ dev / ttyACM0»: отказано в разрешении. Проблема с загрузкой на плату. Посетите http://www.arduino.cc/en/Guide/Troubleshooting#upload для получения предложений.

И на моем ПК, и на моем ноутбуке установлена ​​Ubuntu 18.04.

Решение

Я начинаю с перехода по предложенной ими ссылке. И я следую по шагам

En инструменты / пластина Выбрано Arduino / Genuino Uno

En инструменты / последовательный порт / dev / ttyACM0

arduino avrdude ide проблема

и, как указано в документации, в случае возникновения проблем с драйверами и разрешениями я открываю терминал и выполняю:

 sudo usermod -a -G tty yourUserName
 sudo usermod -a -G dialout yourUserName

где ваш логин ваше имя пользователя

Теперь я выхожу из системы и снова вхожу в систему. И на всякий случай перезагружаю комп / ноутбук.

У меня все еще не работает, и документация Arduino больше не помогает. Так что я продолжал искать на форумах и в блогах. Если на этом этапе у вас не работает и вы похожи на меня. Следуйте следующим шагам

ls / dev / ttyACM0 возвращает / dev / ttyACM0
ls -l / dev / ttyACM0 возвращает crw-rw—- 1 root dialout 166, 0 26 ноября 16:41 / dev / ttyACM

Этим подтверждаем, что порт существует

Мы собираемся дать разрешения и проверить, есть ли у нашего пользователя необходимые разрешения.

 sudo chmod a+rw /dev/ttyACM0
 id devuelve 20(dialout) 

И я вижу, что пользователь находится в группе дозвон так что с этой частью мы все поняли правильно.

Что сработало для меня, так это переустановка Arduino.

Если вы проверите

which avrdude

И ничего не возвращает, переустановка Ардуино должна решаться.

sudo apt install --reinstall arduino

И если вам не удалось решить проблему, оставьте мне комментарий, и я постараюсь вам помочь.

Существует сценарий, который они подготовили, чтобы исправить эту проблему. Вы можете попробовать посмотреть, поможет ли это вам. Я не использовал его, но оставляю, потому что считаю, что он может быть полезным ресурсом.

АВРДУДЕ

Оставлю немного информации, чтобы лучше понять, что такое AVRDUDE. Название происходит от AVRDUDE — AVR Downloader / UploaDEr.

AVRDUDE — это утилита для загрузки / выгрузки / управления содержимым ROM и EEPROM микроконтроллеров AVR с использованием техники внутрисистемного программирования (ISP).

https://www.nongnu.org/avrdude/

AVRDUDE был запущен Брайаном С. Дином как частный проект в качестве программиста для серии микроконтроллеров Atmel AVR.

Вы можете найти программное обеспечение и другую информацию в сайт проекта.

I was using Arduino IDE on my Arch Linux laptop without problems, after some time /months I’m not able to upload the sketch because of permissions:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

I can access and write to the device with minicom without problems, because permissions are good:

crw-rw-rw- 1 root uucp

My user is in the uucp group. But when I start sketch uploading, regarding to the dmesg, the usb device is being reconnected and in that moment I can see different permissions:

rw------- 1 root root

And after some time (seconds) permissions are back as they were. dmesg output here:

[  313.042695] usb 2-1.2: USB disconnect, device number 3
[  313.253085] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[  313.352387] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[  321.234517] usb 2-1.2: USB disconnect, device number 4
[  321.439445] usb 2-1.2: new full-speed USB device number 5 using ehci-pci
[  321.541392] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
...

I’ve tried to solve that with several custom udev rules, but without success:

SUBSYSTEMS="usb", ATTRS{idVendor}== "2341", GROUP="uucp", MODE="0666"
KERNEL=="ttyACM[0-9]*", SYMLINK+="%k", GROUP="uucp", MODE="0666"

How to force group or mode from the first moment when appeared in the system? I hope this is not just a bug in the Arduino 1.8.3. Kernel version 4.11.9-1-ARCH.

EDIT #1:

I found that usb reconnection behavior occurs after exiting minicom too, but in case of avrdude this is problem because it is happening when program needs to access the device.

Screencast here

EDIT #2:

After some time I came back to this issue and I found I have problem just with ttyACM0 (Yun/Micro/etc. connected with microUSB cable) and ttyUSB0 (Uno connected with USB-B) is ok. But even this is interesting clue I can’t figure it out.

I’m monitoring the rights on the tty devices:

watch -n 0.1 'ls -la /dev/ttyUSB* /dev/ttyACM*'
  • when uploading to ttyUSB0 just the date/time is changing and everything is working
  • when uploading to ttyACM0 device disappeared for a moment then a new one with wrong rights (and root:root) has been created, upload failed and then right are set properly by udev (with root:uucp) … and then another one cycle (disappear-wrong-correct)

My user is in the lock and uucp groups, I’ve tried to add some udev rules or disable them but without success …

I’m for 99% sure this is something before udev rule is touching it.

Понравилась статья? Поделить с друзьями:
  • Ошибка при открытии порта com5
  • Ошибка при открытии пдф файла
  • Ошибка при открытии папки 0x80004005
  • Ошибка при открытии общего доступа к папке
  • Ошибка при открытии модели невозможно открыть модель tekla