I would really need some help to get working an USB audio Async interface on the stm32F4 discovery board, with explicit feedback. I'm working on that topic since several weeks and cant't get it work. This is a showstopper for my project if I can't get it work.
I developped my application based on the ST usb device class audio class firmware. I started from previous attempts as presented here and here here, and ported the code to the newer HAL libs. But didn't succeeded to get the thing work.
I finally stripped down my application to a minimum implementation, to help solve the issue. It is attached to this message
The main part is a modified usbd_audio.c (modification of the audio class source). This code adds the feedback end point to the descriptor. in the dataout function, I read the incoming data from the PC et get the number of samples. Different leds are used to show:
- 48 samples in the frame => expected value without feedback
- more samples => feedback has an effect
- less samples => feedback has an effect
Every 4 SOF (feedback rate in the descriptor: 2), I send through the feedback EP a fixed value 0x0C0666, which corresponds to 48.1 instead of the normal expected value of 48 (0x0C0000). This should pull the number of received samples per frame toward a different value from 48. But this never happens.
The feedback is only sent if a dedicated flag has been reset by the DataIn function, which I think means that the previous feedback has been read by the host.
In fact, it seems that I can send the feedback 1 or 2 times, and then the datain function is not called anymore (which could mean that the feedback value is not read by the PC anymore?). I still receive the data stream and music...
I don't have any other idea to debug the thing. Help would be warmly welcomed.
Note that once this will be working, I will rework on a proper measurement of the feedback using a timer gated by the SOF interrupt.
I attach my streamlined project.
More general information are also available here: