cancel
Showing results for 
Search instead for 
Did you mean: 

I2S Tx Complete callback is never called while the TX Half Complete callback is.

SP4RKZZ
Associate II

Hi There,

Im currently trying to move some basic I2S code over from a STM32F407 to a STMG030K8.

All the code is doing is using a circular DMA mode to transfer a buffer. As with any circular mode transfer, Im wanting to fill the buffer with new data in both the Half and Complete callbacks.

My code was working perfectly on the F407 but when moved over to the G030, only the Half Tx Complete callback is called repeatedly(checked with breakpoints and status LED's).

The only code I have added to the brand new project is the following:

HAL_I2S_Transmit_DMA(&hi2s1, (uint16_t *)outputBuf, 100);

And the callbacks:

void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s){
}
 
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s){
}

I have only initialised the single DMA channel for I2S_TX (SPI1_TX) and the I2S is the only peripheral currently initialised. The DMA settings i'm using are shown below in the image;

0693W000007Cct1QAC.pngI understand that the F407 DMA and G030 DMA have differing features but from what I can tell, that shouldn't be effecting a basic transfer such as this. From a quick search online it seems that there was a similar issue in the F4xx firmware which has since been fixed.

Any help/tips as to why only the half complete callback is called would be appreciated.

I can provide a full project or ioc file if needed but it is a newly generated project with only the few additional code snippets mentioned above.

Thanks.

Kind Regards,

Brandon

5 REPLIES 5

Read it and check the DMA control register for channel in question and check if TC interrupt is enabled.

If that's OK, yes it's quite likely the Cube/HAL bug you mention is present here, too. Cube is open source so you can debug and fix it yourself. Our just don't use Cube at all - as you've said, it's just basic code.

JW

Thanks for your reply, I have checked the control register and confirmed that both interrupts are enabled.

I'm not entirely sure how best to approach this as I'm not very well versed in lower level STM32 and have used the HAL pretty exclusively up until now.

Is there any particular locations to start looking at? Im more than happy to try and work through this but Im just not sure where to start looking.

Ive stepped through the code from the DMA Interrupt Request Handler within stm32g0xx_it.c and everything seems to check out. It just always meets the conditions for the half complete vs full complete.

Thanks,

Brandon.

Start by familiarizing yourself with the DMA registers both in RM and in debugger.

DMA keeps running while you single-step, so with circular DMA both HT and TC flags are set after each step you take (your steps are way slower than a full DMA cycle).

Try to find the thread you've mentioned, I'd guess you'll find hints there too.

JW

Thanks for linking that, that was the one I had come across earlier.

I think I may have come across something that may be causing the issue when comparing the checks against other series firmware.

I2S still doesn't seem to work with it but both the callbacks are being called.

Once I get to a stage where I feel like it is a solution I will update here and/or open an issue on the G0 github for further consideration.

Brandon.