arduino/Arduino

Uploading to a 32u4 board fails

NicoHood opened this issue · 11 comments

I tried to upload a program to a pololu 32u4 Mini LV board today and I got the following errors.
Used this PR as build, linux 64 bit.
#3896 (comment)

Uploading to a leonardo board works as expected. (with HoodLoader2.0.5 but with leonardo PID/VID)

I also tried to install the software files:
https://github.com/pololu/a-star/tree/master/add-on/pololu

Currently trying to find the reason for this bug. However the 2nd error should not happen I guess. I will report the progress here, just that you know this bug exists.

First time hitting upload:

avrdude: Version 6.0.1, compiled on Apr 14 2015 at 19:04:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/linuxuser/Downloads/arduino-PR-3896-BUILD-410/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/linuxuser/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "/dev/ttyACM0": Device or resource busy
avrdude: ser_send(): write error: Bad file descriptor
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

2nd Time hitting upload:

processing.app.debug.RunnerException
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:130)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
    at processing.app.Sketch.upload(Sketch.java:1179)
    at processing.app.Sketch.exportApplet(Sketch.java:1153)
    at processing.app.Sketch.exportApplet(Sketch.java:1125)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2443)
    at java.lang.Thread.run(Thread.java:745)
Caused by: processing.app.SerialException: Error touching serial port '/dev/ttyACM0'.
    at processing.app.Serial.touchForCDCReset(Serial.java:87)
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:119)
    ... 6 more
Caused by: jssc.SerialPortException: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
    at jssc.SerialPort.openPort(SerialPort.java:164)
    at processing.app.Serial.touchForCDCReset(Serial.java:81)
    ... 7 more

Updates

  • A Leonardo fails with their bootloader. It could be caused by the Vendor ID or their bootloader itself/ their fuses settings.
  • The fuses are not the problem, bootloader or VID+PID left
  • Pro micro bootloader has the same problem. can be the bootloader structure or the PID.

Its an IDE bug. I recompiled my working HoodLoader2 with their VID/PID. changing the PID (+arduino VID) works but changing both gives the error above. This is "poor" 3rd party support and should be fixed.

Tested with

a-star32U4.vid.0=0x1ffb
a-star32U4.pid.0=0x0101

And sparkfun pro micro16

(Tried in an USB3 Port)

Hello. I'm from Pololu Robotics & Electronics (@pololu), and I don't think this is a bug in the Arduino IDE. I suspect you just need to follow the instructions from the a-star README, which say:

The "udev-rules" directory contains a file named "a-star.rules" for Linux users.
If you copy this file to /etc/udev/rules.d/, it will tell ModemManager to not
try to access the virtual serial ports of the A-Star. This is necessary on some
systems in order to program the A-Star.

This problem could also be solved by updating ModemManager to a newer verison that includes our patch.

Cant the arduino program catch this error? However the exceptions should be fixed.

I have the same bug exactly with my official Arduino Leonardo. I haven't been able to upload any sketches on it (I bought it yesterday)

Firstly I get this:
avrdude: ser_open(): can't open device "/dev/ttyACM2": Device or resource busy avrdude: ser_send(): write error: Bad file descriptor

And then I get this:
processing.app.debug.RunnerException at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:132) at processing.app.debug.Compiler.upload(Compiler.java:166) at processing.app.Sketch.upload(Sketch.java:1167) at processing.app.Sketch.exportApplet(Sketch.java:1141) at processing.app.Sketch.exportApplet(Sketch.java:1113) at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380) at java.lang.Thread.run(Thread.java:745) Caused by: processing.app.SerialException: Error touching serial port '/dev/ttyACM2'. at processing.app.Serial.touchForCDCReset(Serial.java:92) at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:121) ... 6 more Caused by: jssc.SerialPortException: Port name - /dev/ttyACM2; Method name - openPort(); Exception type - Port busy. at jssc.SerialPort.openPort(SerialPort.java:164) at processing.app.Serial.touchForCDCReset(Serial.java:86) ... 7 more

Is it from arduino.org or from arduino.cc? Maybe their vendor ID also cause problems. This should be fixed somehow if possible. Or at least a proper error message should be printed.

It is from Arduino.org

On other thing to try: Try stopping / killing ModemManager if it is running. I've seen it cause problems by probing all serial ports that might be a modem. For a normal Uno, this only causes problems when you upload directly after plugging in, but since a Leonardo resets its USB during upload, this might cause this problem, I believe.

You were right!
See this: It fixed my problem :)

http://labs.arduino.org/Arduino+IDE+on+Linux-based+OS

Ok, closing this then.Thanks for reporting back.

@chrispanag Link is down/redirected. The solution to this problem is missing. What have you seen @chrispanag? Please share!

k26dr commented

I managed to get it to work on Linux by running sudo arduino and running it as root.