Giter Site home page Giter Site logo

cherryusb / cherryusb_wch Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 8.0 49.99 MB

CherryUSB demo for WCH

CMake 52.74% C 44.36% Assembly 1.67% Batchfile 0.01% C++ 1.00% Cuda 0.01% Fortran 0.03% Objective-C 0.01% Objective-C++ 0.01% Shell 0.13% Tcl 0.05%
ch32v307 ch582 usb usbdevice usbhost

cherryusb_wch's People

Contributors

haimianbbao avatar sakumisu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cherryusb_wch's Issues

Multiple USB instances on MCU with multiple USB ports

I recently reviewed the code in a relatively short amount of time, but during my examination, I did not come across any specific section where the usage of a particular USB port is defined or configured. For instance, the CH32V307 microcontroller has two separate USB instances, but the code does not seem to indicate any preference or configuration for selecting either of these USB ports.

有大佬试过V307的host吗?

用官方EVT板试了一下。FS下的host demo出现:


 \ | /
- RT -     Thread Operating System
 / | \     3.1.3 build Apr 21 2023
 2006 - 2019 Copyright by rt-thread team
Start usb host task...
ms[I/USB] Dev connect
h >[I/USB] Dev USB_SPEED_FULL
[I/USB] Dev connect
[I/USB] New full-speed device on Hub 1, Port 1 connected
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry
[W/USB] Setup Timeout and retry 
......
[E/USB] Failed to get device descriptor,errorcode:-116
[E/USB] Port 1 enumerate fail

但是运行官方的HOST_KM例程是可以成功枚举hub以及下级的鼠标的(鼠标插拔事件都正常)。

至于HS也会有bug,g_hub_intbuf[CONFIG_USBHOST_MAX_EXTHUBS + 1][1]需要改为g_hub_intbuf[CONFIG_USBHOST_MAX_EXTHUBS + 1][CONFIG_USB_ALIGN_SIZE],不然hub使用的buf指针不对齐,出现IN DMA错误。不过HS可以成功枚举hub,但是hub接的鼠标又没有检测出来。

audio_v1_mic_multichan_template not working properly

I tried built and test FS audio_v1_mic_multichan_template based audio_v1_mic_multichan_template .
Enumeration is OK, but recording working only once. First opening device is successfully, I see "open EP" in terminal and 'a' value in data from device. But after stopped and started recording again, I see "open EP" in terminal and errors in USB requests because device not send any data.

USB Host low-speed device enumeration

I tried to connect a low-speed keyboard. Initialization does not occur.
Cherry USB in the log writes that the hub is installed in full-speed mod and setup packet timeout.
The full-speed keyboard is detected correctly.
I tried changing CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT, but it doesn't have any effect.
USB high speed controller ch32v307 was used.

ch32v103

Hello!
Seems ch32v103 has same usb IP as ch32v307 USBFS.
On ch32v307 it is mapped on 0x50000000, while on ch32v103 it is mapped on 0x40023400.
Going through datasheets I did not find any difference in registers list.

I made this change to usb_ch32_usbfs_reg.h

//#define USBFS_BASE ((uint32_t)0x50000000)
#define USBFS_BASE ((uint32_t)0x40023400)

And trying run some device example (i have startup code for ch32v103 and other things related) like cdc.
Unfortunately My Linux host cannot enumerate device.
I added some ugly log to the cherryusb and port to understand what is going on.
Seem first I get SETUP request

[I/USB] Setup: bmRequestType 0x80, bRequest 0x06, wValue 0x0100, wIndex 0x0000, wLength 0x0040

Then cherryusb try to send 18 bytes descriptor to EP0 and then I get invoke of usbd_event_ep0_in_complete_handler.
it decrement g_usbd_core.ep0_data_buf_residue and start reading usbd_ep_start_read(USB_CONTROL_OUT_EP0, NULL, 0);.
Here I expect to get some out interrupt, but for some reason I still get IN IRQ and go into usbd_event_ep0_in_complete_handler again and again, it decrement g_usbd_core.ep0_data_buf_residue again and again (i think developers were not expected such thing and there is no any protection about it), anyway I make check if there is no any bytes to send, then do not decrement it, but I still getting this function invocation.

How can I debug this? Maybe it is some common problem? I do not expect any hardware issue, as ch32v103 usb examples works fine.

请问CH32V307开发板USBH调试USBD_CDC_ACM例程遇到的问题

你好,我在用CH32V307开发板USBH 高速端口调试USBD_CDC_ACM例程,遇到调用usbh_cdc_acm_set_line_coding这个函数失败的情况,追踪发现是只要控制端点以这种方式发送数据就会失败,SETUP->OUT>IN
image
,我找了好久,找不到原因,麻烦大佬看下,谢谢

Has USB HS devices been tested on CH32V307?

I tried using the hid_kbd example, in my project but it failed during usb enumeration. I also tried to compile to get a binary to test directly using make, and I got errors, are you using a specific risc-v compiler I got the latest from xpack. Have these examples been tested by yourself?

image

ch32 usbFS

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.