Skip to content
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

Pull request for V2.1 #66

Merged
merged 6 commits into from
Jul 26, 2015
Merged

Pull request for V2.1 #66

merged 6 commits into from
Jul 26, 2015

Conversation

cpldcpu
Copy link
Member

@cpldcpu cpldcpu commented Jul 26, 2015

Some stability and realiblity fixes. Details below.

@cpldcpu
Copy link
Member Author

cpldcpu commented Jul 26, 2015

The new release fixes two nasty bugs:

Devices could end up in deadlock if the bootloader was invoked without USB being connected

This was an issue reported by Olimex for their devices. Not sure if this appeared anywhere else.

I found that the zener diode and resistor used in most V-USB implementations tend to bias the D+ input to an undefined state where it is very sensitive to external noise. Activating the internall pull up did not alleviate this issue and would have caused trouble in USB operation since only weak pull downs are present at the host.

In this situation it was possible to inject noise into the D+ pin and activate the pin change interrupt. In micronucleus, this caused USB_INTR_VECTOR(); to being invoked and exit early without resetting the int flag. Solution: Reset int flag manually. (+4 bytes)

More noise could actually trigger the usb resynchronisation code, which also relies on a clean D+. Solution: Use D- for resynchronization. (+0 bytes) D- is stabilized by the pull up resistor.

Enumeration of Micronucleus on 12MHz CPUs sometimes failed on some USB3.0 ports

It appears that some USB3.0 ports tend to resend packets after a shorter delay than USB2/1.1 ports. This led to a timeout of PID IN transmissions in some cases where preparing the data took a long time on slow CPUs. Most of the CPU time is actually spent on calculating the CRC, therefore this issue could be fixed by switching to the fast CRC routine. I supplemented an optimized version by @gblargg, which is a couple of bytes smaller than the original V-USB fast CRC. Unfortunately this still adds 20bytes...

@cpldcpu
Copy link
Member Author

cpldcpu commented Jul 26, 2015

Merging, since I am not aware of further bugs...

cpldcpu added a commit that referenced this pull request Jul 26, 2015
@cpldcpu cpldcpu merged commit 3e01026 into master Jul 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant