Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[AVR] Fix problems with USB CDC auto-reset #6055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MLXXXp wants to merge 4 commits into arduino:master from MLXXXp:CDC_auto-reset

Conversation

Copy link

@MLXXXp MLXXXp commented Mar 10, 2017

Address a problem where the bootloader magic key location could be restored before it was saved, and other issues, with a bootloader auto-reset invoked by USB CDC.

Discussed in issue #6033

facchinm, az0uz, and kasbah reacted with thumbs up emoji
MLXXXp added 4 commits March 10, 2017 16:34
In the USB CDC code to invoke an auto-reset, the magic key location could be
restored before it had actually been saved. The sketch would then have a
corrupted value at this location. This fix prevents the value from being
restored if it hasn't previously been saved.
The state of the watchdog timer is saved during a USB auto-reset and then
restored if the reset is aborted, in case the sketch is using the watchdog.
Instead of checking for the NEW_LUFA_SIGNATURE once in program memory and then
setting a flag which is used for further checks, a function is used that always
checks program memory directly.
If a flag is used, there's a slight chance that its location in RAM could fall
on MAGIC_KEY_POS. In this case, an aborted USB auto-reset sequence may fail.
An auto-reset invoked using USB CDC is triggered by the port closing
(when set to 1200 baud). Closing of the port is indicated by DTR going inactive.
There is no need to have auto-reset invoked by a CDC_SET_LINE_CODING command.
Only the CDC_SET_CONTROL_LINE_STATE command, which indicates a change in the
state of DTR, should be used.
@mastrolinux mastrolinux added the in progress Work on this item is in progress label Mar 10, 2017
Copy link
Member

@ArduinoBot build this please

@facchinm facchinm added Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) USB: CDC serial Serial interface used by MCUs with native USB (e.g. Leonardo) to communicate with the computer labels Mar 13, 2017
@facchinm facchinm added this to the Release 1.8.3 milestone Mar 20, 2017
Copy link

az0uz commented Mar 21, 2017

I like the Idea of having the possibility to use Watchdog with 32u4 based arduino.

This patch doesn't work if you call wdt_reset() in the user code faster than one time every > 120ms (reset time in the CDC driver).
If you do so, the mcu will never reset to let you upload a new sketch.

Copy link
Author

MLXXXp commented Mar 21, 2017

@az0uz

This patch doesn't work if you call wdt_reset() in the user code faster than one time every > 120ms

This is being discussed in PR #6064.

Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) in progress Work on this item is in progress USB: CDC serial Serial interface used by MCUs with native USB (e.g. Leonardo) to communicate with the computer
Projects
None yet
Milestone
Next
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /