cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2S_TxHalfCpltCallback and HAL_I2S_TxCpltCallback are not called on a 50:50 duty cycle as expected when using a circular buffer to I2S.

RAdam.1
Associate III

I am outputting audio over I2S at 8k with a 128 sample buffer. I was getting timing issues so I turn on an LED on the Half way callback and turn it off on the complete callback. I expect a 50% duty cycle. But I get the output below on my scope. Anyone else see this or know what can cause it? The overall time is about right for a 256 sample buffer at 8k but the timing is wrong

 

0693W000004K6E5QAK_image.png

4 REPLIES 4
RAdam.1
Associate III

Seems to be that the Complete callback is being called immediately after the Half Complete callback every time

Anyone have any ideas why this should happen. I derived my code from the DK - the DK does work however with the expected 50:50 duty cycle

TDK
Guru

Your image doesn't show up. Maybe slow down the rate and see if it works as expected. Maybe you're doing too much within the interrupt.

If you feel a post has answered your question, please click "Accept as Solution".
RAdam.1
Associate III

Thanks. I have tried different rates. I actually looked closer at the standard DK code from ST and that fails also. I'm doing nothing in the interrupt except turning an LED on on one callback and off on the other. The Half Complete callback fires immediately before the Complete callback on DMA transfer for SPI and I2S when in circular mode

RAdam.1
Associate III

or info - this is on a BlueNRG-LP