Movatterモバイル変換


[0]ホーム

URL:


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

Fix external and internal usb pullup#1048

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

matthijskooijman
Copy link
Contributor

This fixes boards that have external and internal USB pullups, which were broken by#997, as reported in#1029.

This needs a new define in the variant for these broken boards. I added this for two boards for which I could confirm that they had an external pullup.@stas2z, you have a black-based board, could you test this PR on your board?

I found that the CoreBoard F401RC had a switchable external pullup, but also internal pullups, so I changed that one to no longer use the external pullup and just the internal pullup.@mrguen, I think you have one of these boards, could you maybe test this PR on that board?

I tested this on a custom STM32F401 board, where I added an external pullup for testing. I also tested on an unmodified Blue pill, which still works as expected.

stas2z and fpistm reacted with thumbs up emoji
@stas2z
Copy link
Contributor

Works for me

These boards were broken in commite1d409f Refactor USB pulluphandling. Before that commit, all boards without external controllablepullups were assumed to have fixed external pullups and use the DP writetrick. Since that commit, boards that have internal pullups are assumedto *not* have any external pullups and the internal pullups areautomatically used.It turns out there exist some boards that have internal pullups in thechips, but also have an external fixed pullup. This can probably beconsidered a hardware bug, but since the boards exist, we should supportthem.This commit allows variants to define USBD_FIXED_PULLUP to explicitlystate they have a fixed pullup on the D+ line. This will cause the D+output trick to be applied even when internal pullups are present,fixing these boards.This define is only needed on these specific boards, but it can also bedefined on boards with a fixed external pullup without internal pullups.This problem was prompted by the "Black F407VE" board, which has theproblematic pullup. All other F4 boards were checked and one other wasfound to have the pullup, all others seem ok. None of the other serieshave been checked, so there might still be board broken.See alsoSTM32-base/STM32-base.github.io#26 forsome additional inventarisation of this problem.Thisfixesstm32duino#1029.
While reviewing some of these boards, it was not immediately clear to mewhat boards they referred to (especially with the relatively unbrandedboards from aliexpress). Just in case this helps anyone else, this addssome urls with more info on those boards I found from the git historyand github issues.
This board also has internal pullups, so the external one is notactually needed (and will even violate the USB spec when both are usedtogether). This commit disabled the external pullups, but leaves thedefines in comments, as future documentation.See alsostm32duino#1029.
@matthijskooijmanmatthijskooijmanforce-pushed thefix-external-and-internal-usb-pullup branch from91a2a02 tod3fdc1fCompareApril 28, 2020 12:26
@matthijskooijman
Copy link
ContributorAuthor

Heh, I had actually thought Ifixed the indentation of that comment, didn't realize astyle had another opinion about it :-p Anyway, thanks for the fix, I've squashed it into my original commit.

@stas2z Thanks for testing!

fpistm reacted with thumbs up emojifpistm reacted with laugh emoji

@fpistmfpistm added the enhancementNew feature or request labelApr 29, 2020
@fpistmfpistm added this to the1.9.0 milestoneApr 29, 2020
@fpistmfpistm linked an issueApr 29, 2020 that may beclosed by this pull request
@fpistm
Copy link
Member

Tested on:

  • BluePill: with or without bootloader (USB)
  • Maple Mini: with or without bootloader (USB withUSBD_ATTACH_PIN andUSBD_ATTACH_LEVEL)
  • Black F407VE (USB_OTG_FS withUSBD_FIXED_PULLUP)
  • Adafruit Feather F405 (USB_OTG_FS withUSBD_HAVE_INTERNAL_PULLUPS)
  • RobotdynF303 (USB)
  • Disco F746NG (USB_OTG_FS and USB_OTG_HS withUSBD_HAVE_INTERNAL_PULLUPS)

@fpistmfpistm merged commitbbb8b78 intostm32duino:masterApr 29, 2020
@matthijskooijman
Copy link
ContributorAuthor

Thanks for the extensive testing!

@fpistm
Copy link
Member

Welcome.
Thanks too ;)

@mrguen
Copy link
Contributor

@matthijskooijman on the CoreBoard F401RC the pullup is not permanent but driven by PD2

@matthijskooijman
Copy link
ContributorAuthor

@matthijskooijman on the CoreBoard F401RC the pullup is not permanent but driven by PD2

Yeah, that's what I already said (or at least tried to say :-P). Regardless, that pullup is still problematic when used together with the internal pullup, so this PR changes the code to not use the external pullup anymore. If you could confirm that USB still works on this board, that would be awesome!

@mrguen
Copy link
Contributor

@matthijskooijman I don't want to impact my install too much. Is changing these files
Arduino_Core_STM32/cores/arduino/stm32/usb/usbd_if.c
Arduino_Core_STM32/variants/Generic_F401Rx/variant.h

enough to test?

@matthijskooijman
Copy link
ContributorAuthor

@mrguen

Is changing these files
Arduino_Core_STM32/cores/arduino/stm32/usb/usbd_if.c
Arduino_Core_STM32/variants/Generic_F401Rx/variant.h

Yeah, I think it should be.

@mrguen
Copy link
Contributor

mrguen commentedApr 30, 2020
edited
Loading

@matthijskooijman I tried it succesfully. I hope the test is significant. Here's what I did:

  • Install the current releasehttps://github.com/stm32duino/Arduino_Core_STM32 instead of 1.8.0

  • Configuration: CoreBoard F401RCT6, USART enabled Generic Serial, USB Support: CDC generic serial supersede usart, USB low/full speed

  • Uploaded in native DFU mode

  • Tested the sketch SerialCallResponse working

@matthijskooijman
Copy link
ContributorAuthor

Awesome, thanks!

@matthijskooijmanmatthijskooijman deleted the fix-external-and-internal-usb-pullup branchJune 24, 2020 12:33
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fpistmfpistmfpistm approved these changes

Assignees
No one assigned
Labels
enhancementNew feature or request
Projects
None yet
Milestone
1.9.0
Development

Successfully merging this pull request may close these issues.

probably USBD_reenumerate have issue after update
4 participants
@matthijskooijman@stas2z@fpistm@mrguen

[8]ページ先頭

©2009-2025 Movatter.jp