2024-02-11 10:41 AM
Hello,
Short: I'm developing a USB to I2S bridge, hopefully multi-channels in the end. I don't understand ST designers intention about flow for I2S DMA callbacks . How to do it correctly as expected by ST designers, based on CubeMX generated code?
Longer: I want to rely as much as possible on CubeMX code generation and on ST USB UAC1 middleware for future portability reasons. I have a difficulty to understand how ST code intends to implement the mechanism to rearm the I2S DMA once the first transfer is complete between the usbd_audio_if.c and the driver BSP code,
I looked at 3 ST examples:
USB Audio middleware defines in usbd_audio_if.c two functions TransferComplete_CallBack_FS and HalfTransfer_CallBack_FS but they are not used/called in the examples.
The I2S/SAI DMA callbacks is always coded in the driver BSP code, which looks to be expected to be independent from lower level layers (especially usbd_audio_if). So no easy call from there to TransferComplete_CallBack_FS and HalfTransfer_CallBack_FS.
This middleware USB stack, and the logic behind the Audio Class is let's say not KISS / natural (at least to me). Different levels of abstraction makes the execution flow complex. I imagine there was a plan, and some intention for the mandatory management of DMA callbacks, BSP_AUDIO_OUT_xxxxTransfer_CallBacks, ransferComplete_CallBack_FS and HalfTransfer_CallBack_FS.
How to do it according to the ST designers intention ? How to do it correctly?
(I'm using the last versions of STM32CibeIDE and F4 packages).
Best regards,
JMF