CherryUSB / cherryusb_wch

CherryUSB demo for WCH
19 stars 9 forks source link

ch32 usbFS #10

Closed nikitos1550 closed 11 months ago

nikitos1550 commented 1 year ago

Hello! Did somebody actually tried usb full speed device controller?

Before I tried ch32v103, not I changed chip to ch32v303, that has same with ch32v307 USBFS controller. But I cannot make it work :-(

I remember that there are some issues with WCH, but I don't believe that it fully not working.

SystemClk:144000000
ChipID:30310514
CherryUSB device cdc acm example
USBFS_RCC_Init: div 3
cdc_acm_init() done
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0040
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0028, wIndex 0x0000, wLength 0x0000
[D/USB] EP0 send 0 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0040
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0029, wIndex 0x0000, wLength 0x0000
[D/USB] EP0 send 0 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
[D/USB]�SystemClk:144000000
ChipID:30310514
CherryUSB device cdc acm example
USBFS_RCC_Init: div 3
cdc_acm_init() done
[I/USB] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x002a, wIndex 0x0000, wLength 0x0000
[D/USB] EP0 send 0 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/USB] EP0 send 8 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/USB] EP0 send 8 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x002b, wIndex 0x0000, wLength 0x0000
[D/USB] EP0 send 0 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/USB] EP0 send 8 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0008
[D/USB] EP0 send 8 bytes, 0 remained
[D/USB] EP0 recv out status
nikitos1550 commented 1 year ago
cdc_acm_init() done
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0040
usbd_ep_start_write: [12:01:00:02:ef:02:01:40:86:1a:37:55:00:01:01:02:03:01]
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x00, bRequest 0x05, wValue 0x0003, wIndex 0x0000, wLength 0x0000
[D/USB] EP0 send 0 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
usbd_ep_start_write: [12:01:00:02:ef:02:01:40:86:1a:37:55:00:01:01:02:03:01]
[D/USB] EP0 send 18 bytes, 0 remained
[D/USB] EP0 recv out status
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
usbd_ep_start_write: [12:01:00:02:ef:02:01:40:86:1a:37:55:00:01:01:02:03:01]
[D/USB] EP0 send 18 bytes, 0 remained
[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0012
usbd_ep_start_write: [12:01:00:02:ef:02:01:40:86:1a:37:55:00:01:01:02:03:01]
[D/USB] EP0 send 18 bytes, 0 remained

Same log with data MCU sent to host.

sakumisu commented 1 year ago

Only support CH32V307, although their ip is the same ,but is not the same too, thanks.

nikitos1550 commented 1 year ago

I also have ch32v305 chip, I replace it on the board and try it. I don't believe, I want see myself.

nikitos1550 commented 1 year ago

Same with 305 chip. This is really strange. Later I will get usb analyzer and can inspect what is really going on the bus. Now seems I cannot use cherryusb :-(

sakumisu commented 1 year ago

Sorry , we do not have other chips and do not know if their same ip is actually the same. You can use v307.

nikitos1550 commented 1 year ago

Sorry , we do not have other chips and do not know if their same ip is actually the same. You can use v307.

Can I donate you some hardware, so you can try run your project on it?

HaiMianBBao commented 1 year ago

Please turn off the log or lower the log level before testing.

nikitos1550 commented 1 year ago

Please turn off the log or lower the log level before testing.

I will wait until USB analyzer will come to me (maybe several weeks later) and continue testing with it. For sure will try with and without log. Thanks for advice, yes I know that log can affect timing, moreover I am using 115200 uart log, that is not very fast.

nikitos1550 commented 11 months ago

Finally I choosed tinyusb stack (https://github.com/hathach/tinyusb) instead of cherry (sorry). I managed ch32v307 usbfs and ch32v103 usbhd work on it. There is usbd controller that I also want bring up. With these four drivers all ch32 usb peripherals should work. maybe later will make PR to tinyusb, Follow up if you interested.