USB reset issue in the Bootloader and libmaple core

Information on the latest releases
User avatar
fra
Posts: 2
Joined: Fri Feb 26, 2016 8:59 pm

Re: USB reset issue in the Bootloader and libmaple core

Postby fra » Thu Dec 01, 2016 9:48 pm

Hi guys, I may have found a workaround on this.
Two symptoms:
1) after a sketch upload I have to wait 15-20 seconds before I can open the USB Serial, otherwise I get the error message

Code: Select all

Error opening serial port '/dev/ttyACM0'. (Port busy)

2) In between two uploads I have to push the reset button (see http://www.stm32duino.com/viewtopic.php?t=475)

I have a Maple-Mini Baite clone
I am using Ubuntu 16.04 LTS (probably the bug is on their side as the same board works fine with Windows)

I noticed that the reset code was hanging exactly in the same way as the IDE when switching back to Serial USB.

Code: Select all

upload_reset /dev/ttyACM0 750

I also noticed that running dmesg after each reset command I could find the following error:

Code: Select all

cdc_acm 2-3:1.0: failed to set dtr/rts


Looking into this article https://bugs.launchpad.net/ubuntu/+source/modemmanager/+bug/1473246 I found that the symptoms would be due to a bug of the Ubuntu ModemManager that recognizes the board as a modem.
As suggested the workaround is to blacklist the device adding the following snippet into the corresponding rule:

Code: Select all

ENV{ID_MM_DEVICE_IGNORE}="1"


So in my case the file called "45-maple.rules" would look like this:

Code: Select all

ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1"


Rerun the install.sh and the two symptoms above disappear...

Hope this helps.

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB reset issue in the Bootloader and libmaple core

Postby RogerClark » Thu Dec 01, 2016 10:38 pm

fra wrote:Hi guys, I may have found a workaround on this.
Two symptoms:
1) after a sketch upload I have to wait 15-20 seconds before I can open the USB Serial, otherwise I get the error message

Code: Select all

Error opening serial port '/dev/ttyACM0'. (Port busy)

2) In between two uploads I have to push the reset button (see http://www.stm32duino.com/viewtopic.php?t=475)

I have a Maple-Mini Baite clone
I am using Ubuntu 16.04 LTS (probably the bug is on their side as the same board works fine with Windows)

I noticed that the reset code was hanging exactly in the same way as the IDE when switching back to Serial USB.

Code: Select all

upload_reset /dev/ttyACM0 750

I also noticed that running dmesg after each reset command I could find the following error:

Code: Select all

cdc_acm 2-3:1.0: failed to set dtr/rts


Looking into this article https://bugs.launchpad.net/ubuntu/+source/modemmanager/+bug/1473246 I found that the symptoms would be due to a bug of the Ubuntu ModemManager that recognizes the board as a modem.
As suggested the workaround is to blacklist the device adding the following snippet into the corresponding rule:

Code: Select all

ENV{ID_MM_DEVICE_IGNORE}="1"


So in my case the file called "45-maple.rules" would look like this:

Code: Select all

ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev"
ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple", ENV{ID_MM_DEVICE_IGNORE}="1"


Rerun the install.sh and the two symptoms above disappear...

Hope this helps.



Very interesting.

If some other linux users can test this on their installations (e.g. Linux mint etc), I would be happy to update the repo with this change.

BTW. Windows users have similar issues, because the IDE doesnt seem to close the serial terminal before upload, and if you leave it open, then you get a load of Java errors in the iDE when the Serial USB re-appears (and you still can't use the terminal without resetting the board)

User avatar
ahull
Posts: 1398
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: USB reset issue in the Bootloader and libmaple core

Postby ahull » Thu Dec 01, 2016 11:26 pm

:D I just flashed the tiny-o-scope code I was working on earlier to my test board. Five uploads one after the other, no problems... usb serial worked every time too... so far so good.
- Andy Hull -

User avatar
RogerClark
Posts: 5466
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: USB reset issue in the Bootloader and libmaple core

Postby RogerClark » Thu Dec 01, 2016 11:32 pm

Thanks guys

I've updated the repo


Return to “Builds and Announcements”

Who is online

Users browsing this forum: No registered users and 1 guest