cnlohr / rv003usb

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

PORT A for D+ D- Possible? #55

Closed ATP-IOT closed 3 months ago

ATP-IOT commented 4 months ago

It's possible to use port A For the D+ and D- lines? I'm using that port trying to free all the D and C GPIO pins

ATP-IOT commented 4 months ago

define USB_PORT A // [A,C,D] GPIO Port to use with D+, D- and DPU

define USB_PIN_DP 1 // [0-4] GPIO Number for USB D+ Pin

define USB_PIN_DM 2 // [0-4] GPIO Number for USB D- Pin

//#define USB_PIN_DPU 5 // [0-7] GPIO for feeding the 1.5k Pull-Up on USB D- Pin; Comment out if not used / tied to 3V3!

cnlohr commented 4 months ago

You got it working, right? Close issue?

NoNamedCat commented 4 months ago

No, the device is not recognized by the system. I put a 1.5K resistor on the D- line but the OS throw me an error when I connect the device. Sorry, I have multiple accounts. :s

"Windows has stopped this device because it has reported problems. (Code 43)

A request for the USB device descriptor failed."

cnlohr commented 4 months ago

Do you have a logic analyzer you could use here to see what could be going on. There's lots of possibilities that would cause issues, that may be totally unrelated. I know other folks have a configuration like yours on port A.

NoNamedCat commented 4 months ago

I will try to make some experiments (change the GPIOs, the cable, the IC....) If nothing else work, I will use a digital logic analyzer. I don't have one, but i have access to one of those. Tks a Lohr!

cnlohr commented 4 months ago

Totes recommend b-lining it to the scope capture so we can peek!

Can you draw a full schematic?

NoNamedCat commented 4 months ago

Sure! image image image

xsrf commented 4 months ago

@NoNamedCat your USB signals are swapped on the USB connector. Your 1.5k pull-up is connected to D+ 😬

NoNamedCat commented 4 months ago

Tks! I will do the changes, and try again. Close this

NoNamedCat commented 4 months ago

image

xsrf commented 4 months ago

Now the pull-up is wrong - still connected to D+. The pull-up needs to be connected to D-/PA1

NoNamedCat commented 4 months ago

image image