Page 3 of 3

Re: Usage of USB driver in isochronous mode (STM32)

Posted: Thu Mar 24, 2016 4:35 pm
by Kosyak
Hello again, folks!

Here is updated demo project. It's using new ChibiOS USB API now.

1- In order for this to become a more general demo, use differen endpoints for audio stream output and feedback, because while it's totally OK to use a single endpoint working bidirectionally as you do, the USBv1 peripheral in devices other than the STM32F4 family can't do bidirectional isochronous. It's an inherent limitation of the peripheral.

Done, feedback moved to EP2.

2- Use a GPIO and a scope and display your data pump execution time. You'll be surprised. chIQReadTimeout is awfully slow, in fact, in my tests on a STM32F072 @49.152Mhz (yes, slightly overclocked) it takes >1ms for each 192 byte packet (48 samples, 16 bit, 2 channels) which means it can't cope with the actual data inflow. It's a no go. You probably got away with it because you're running a much faster STMF4.

Fixed, USB driver is writing directly to I2S buffer. Now you can enjoy nice dubstep-like effects when buffer is underruning often :) (shouldn't happen if your host supports async USB audio).

Re: Usage of USB driver in isochronous mode (STM32)

Posted: Fri Dec 04, 2020 8:24 pm
by yusuf.husainy
Hello,

I understand this is an older thread, I have migrated this project to Chibi20.3 on stm32f4 discovery board I have. I've connected MCLK to ITR of TIM2 using a jumper wire for samplerate feedback, as discussed in earlier posts.

On building and running, I am able to get usb audio device enumerated as ChibiOS/RT USB Audio Device. On playback, the media is audible, but has a lot of loud noise. I am not sure what type of noise, it is like a constant level, humm noise. I tried with 2 outputs, a set of earphones and my PC speakers connected to f4 discovery's audio jack.

I am not sure what to debug or look at to understand where this noise comes from and how can approach to fix it or have a workaround in firmware for it?

Any help appreciated, Thanks!

Re: Usage of USB driver in isochronous mode (STM32)

Posted: Fri Dec 04, 2020 10:07 pm
by Giovanni
Are you sure it is not some AC coupling noise?

Giovanni

Re: Usage of USB driver in isochronous mode (STM32)

Posted: Sat Dec 05, 2020 7:28 pm
by yusuf.husainy
Thank you for the quick reply!

No, I don't think it is from AC coupling noise.

I ran the STM32Cube example "Audio_playback_and_record", which is basically an OTG host based device, reading from a memory thumb drive "audio_sample.wav", without any noise, very clean. This is a bare-metal application, using the Cube ecosystem firmware libraries.

So I believe, it isn't a hardware issue, need to investigate the on-board codec, CS43L22 initialization in this Chibi example code, compare it with the Cube example's initialization sequence?

Re: Usage of USB driver in isochronous mode (STM32)

Posted: Sun Dec 06, 2020 9:02 am
by Giovanni
Hi,

That is contributed code that I never had time to try, please go ahead.

Giovanni