nikkov / AudioCardCherry

0 stars 0 forks source link

Is it working for you? #1

Closed techlabz closed 1 year ago

techlabz commented 1 year ago

I tried to use, fails during enumeration is it working for you?

nikkov commented 1 year ago

It's just example code from cherryusb and it's not working.

techlabz commented 1 year ago

Ok that is what I thought just wanted confirmation, will have to modify existing WCH USB examples for Audio as well.

sakumisu commented 1 year ago

you can try audio v1 not v2, or use v2 in linux not windows.

techlabz commented 1 year ago

@sakumisu have you actually got audio working on wch board? Do you have demo? I have been playing around with it for few days, and I cannot start a isochronous connection.

nikkov commented 1 year ago

You can see answer at cherryusb_wch issue

techlabz commented 1 year ago

Thanks I'll send a email to wch and see if isochronous is possible.

techlabz commented 1 year ago

@nikkov @sakumisu A few things, make sure to add USBHS_UIE_ISO_ACT to the interrupt enable register. Then add the interrupt flag in your in the IRQhandler and handle properly. You have to modify the descriptors potentially for USB 2.0 High Speed to work. I have so far got it working with USB 2.0 Full Speed.

image

nikkov commented 1 year ago

@techlabz Can you share working example?

techlabz commented 1 year ago

Unfortunately, we did not use CherryUSB and we had to build from scratch which as of right now is proprietary. We may create a guide but that may not be for a few months. What we did though was modify WCH HID example.

Few notes Audio Descriptor- Creating the which is a pain, as this is the most complex of all USB descriptors USB WCH setup- Which includes setting up an endpoint tx/rx making it them isochronous. If you read the reference manual for the chip they will talk about that. Setting up ADC, DAC, Timers, and/or I2S for Mic/Speaker output.

sakumisu commented 1 year ago

You can use other chips that support iso, like bouffalolab, stm32, hpm and etc, i have no time and no interest to support wch iso for audio.

nikkov commented 1 year ago

@sakumisu Yes, I understand your position and thank you for wonderful library. But ch32v307 USBHD on full speed look like working, and now I try get working high speed, but not successful yet. There are other chips with a working ISO, but there are very few chips with high-speed PHY which cheap and easy to buy now. And it's only hobby for me and I'm ready to fail.

techlabz commented 1 year ago

Hey @nikkov , I got ISO working for High Speed. After reading parts of the USB 2.0 Specification from USB-IF, p. 47 talks about having to change the bInterval on the Endpoint Standard Descriptor for USB HS vs USB FS. It seems like 0x03 or 0x04 works. Let me know if it works for you.

sakumisue commented 1 year ago

Hey @nikkov , I got ISO working for High Speed. After reading parts of the USB 2.0 Specification from USB-IF, p. 47 talks about having to change the bInterval on the Endpoint Standard Descriptor for USB HS vs USB FS. It seems like 0x03 or 0x04 works. Let me know if it works for you.

Thanks for your effort, in my demo, hs and fs have difference with interval, fs is 1 and hs is 4.

sakumisue commented 1 year ago

If you like my project ,can you give my project a star? Thanks.

nikkov commented 1 year ago

Hey @nikkov , I got ISO working for High Speed. After reading parts of the USB 2.0 Specification from USB-IF, p. 47 talks about having to change the bInterval on the Endpoint Standard Descriptor for USB HS vs USB FS. It seems like 0x03 or 0x04 works. Let me know if it works for you.

I tried to set Hi-Speed for this example (audio microphone CherryUSB, UAC1). And as @sakumisue mentioned above, interval for HS already set to 4. Formally isochrone pipe was created but I have many errors for transfer. FS isochrone with same code (interval=1) working without errors.

techlabz commented 1 year ago

Hey @nikkov , for USB HS bInternal can be anywhere between 1-16, the bInterval is largely influenced by the wMaxPacketSize. Try bInterval numbers 1,2..16 etc. and let me know if any of those numbers work.

sakumisu commented 1 year ago

Hey @nikkov , I got ISO working for High Speed. After reading parts of the USB 2.0 Specification from USB-IF, p. 47 talks about having to change the bInterval on the Endpoint Standard Descriptor for USB HS vs USB FS. It seems like 0x03 or 0x04 works. Let me know if it works for you.

I tried to set Hi-Speed for this example (audio microphone CherryUSB, UAC1). And as @sakumisue mentioned above, interval for HS already set to 4. Formally isochrone pipe was created but I have many errors for transfer. FS isochrone with same code (interval=1) working without errors.

you should enable uac2 in usb_config.h, modify version with 0200

nikkov commented 1 year ago

Now I have working UAC1 and UAC2 code for ch32v307. Isochrone support for usb hs needed only some small changes.