2019-08-18 08:44 AM
Platform: STM32WB55 discovery board connected to I2S codec.
My mission: To receive data from the codec using DMA transfer.
Calling to HAL_SAI_Receive function returns the data correctly so I guess that everything is configured correctly.
When calling to HAL_SAI_Receive_DMA, hdma->Instance->CNDTR stays on the same initial value.
When debugging the code and running the HAL functions in single step - I do get the half full interrupt and the buffer contains the correct values. So again - I guess that everything is configured correctly.
The base code is generated with CubeMX.
HAL_SAI_Receive_DMA is called from the main loop, so I guess it is not related to interrupt priority issues.
Any other ideas?
Thanks!
Solved! Go to Solution.
2019-08-18 10:41 PM
Issue solved.
Due to high I2S clock frequency (~12Mhz), an AFSDET interrupt occurred and aborted the DMA transfer before it even started.
Reducing the clock frequency to ~2Mhz solved this issue.
I didn't check if 12Mhz clock should be supported when SAI1 clock mux is set to 48Mhz, but in fact - the HAL drivers behave differently.
Thanks.
2019-08-18 01:43 PM
Read out and check the SAI and DMA registers, including the DMA status register. Compare between working and not working case.
JW
2019-08-18 10:41 PM
Issue solved.
Due to high I2S clock frequency (~12Mhz), an AFSDET interrupt occurred and aborted the DMA transfer before it even started.
Reducing the clock frequency to ~2Mhz solved this issue.
I didn't check if 12Mhz clock should be supported when SAI1 clock mux is set to 48Mhz, but in fact - the HAL drivers behave differently.
Thanks.
2019-08-19 12:56 AM
Thanks for coming back with the solution.
I'm not sure why do you see AFSDET interrupt, as it should occur only in slave mode, but I don't know exactly what do you do and I'm definitively not going to investigate Cube/HAL's workings.
Please mark your post as "Best" so that the thread is marked as solved.
JW