cnlohr / rv003usb

CH32V003 RISC-V Pure Software USB Controller
MIT License
436 stars 43 forks source link

Skip USB_DPU on SO-8? #30

Closed mikaelsundin closed 8 months ago

mikaelsundin commented 10 months ago

For a long time ago i was experimenting with USB on PIC18F2550 (still got my NES fourscore to USB Gamepad) .

If i remember correctly it is possible to skip the extra GPIO for USB-pullup and connect the 1.5k to 3v3 instead? To cause a USB re-enumerate the D- pin can be hold low instead by set the GPIO as output low for a little while.

Great job cnlohr btw, you got many interesting repos.

Nable80 commented 10 months ago

Hi!

If i remember correctly it is possible to skip the extra GPIO for USB-pullup and connect the 1.5k to 3v3 instead?

Yes, it's a viable configuration, it's even documented in README:

it may connect D- to DPU or VCC if the intent is for the part to always be on-bus

I'm not sure about your second point:

To cause a USB re-enumerate the D- pin can be hold low instead by set the GPIO as output low for a little while.

I don't think this way is safe, if a host tries to pull this line up during you're holding it down, it'll cause a bus conflict and either host or MCU will be damaged somehow. IMHO (at least) there should be series resistors (10~68R) between the MCU and USB connector, they'll also help with unneeded signal reflections (even low-speed USB may have them).

mikaelsundin commented 10 months ago

The USB host must be able to survive D+, D- short to GND according to specification. So it should be safe to do if the USB host follow the USB specification. Short to 5V is removed in "5V Short Circuit Withstand ECN.pdf"

https://www.usb.org/document-library/usb-20-specification File usb_20.pdf chapter 7.1.1 (page 124)

But a serie resistor is probably wise to add anyway to be sure CH32V003 survive.

I have missed that line in the README. Thanks Nable80.

Nable80 commented 10 months ago

Thank you for a reference to the specification!

cnlohr commented 10 months ago

I would be curious to know more people's feelings about this. No need to close.

cnlohr commented 8 months ago

I am going to close this now, but also add the note about a series resistor the README.