STM32 I2S DMA re-initialization problem
Posted: Fri Aug 14, 2015 12:42 pm
I'm tried to write a code that can record some data from UDA1380 chip and play it back (just simple test).
I2S2 is configured to run always because it supplies MCK clock to UDA1380 IC, while I2S3 turns on when recording only.
First sequence (i2sStartExchange/i2sStopExchange) runs OK, but not second one.
In i2s_lld.c function i2s_lld_init() initializes rxdmamode/txdmamode, then i2s_lld_start() function sets mode with dmaStreamSetMode(). All looks like charm at this point.
Then, after I do not need running transfer anymore, I calls i2sStopExchange(), and it calls dmaStreamDisable() at the end, which is resetting STM32_DMA_CR_TCIE|STM32_DMA_CR_HTIE|STM32_DMA_CR_TEIE|STM32_DMA_CR_DMEIE|STM32_DMA_CR_EN flags in DMA stream CR register.
When I call i2sStartExchange again, it is calls dmaStreamEnable(), what sets STM32_DMA_CR_EN only.
So. in second transfer I get all the same except DMA interrupts, so we have failed callbacks, error checking and so on.
I can stop entire service here and re-initialize it, but I think it is mistake in I2S engine, isn't it?
Or this was done for some reason?
Thanks!
I2S2 is configured to run always because it supplies MCK clock to UDA1380 IC, while I2S3 turns on when recording only.
First sequence (i2sStartExchange/i2sStopExchange) runs OK, but not second one.
In i2s_lld.c function i2s_lld_init() initializes rxdmamode/txdmamode, then i2s_lld_start() function sets mode with dmaStreamSetMode(). All looks like charm at this point.
Then, after I do not need running transfer anymore, I calls i2sStopExchange(), and it calls dmaStreamDisable() at the end, which is resetting STM32_DMA_CR_TCIE|STM32_DMA_CR_HTIE|STM32_DMA_CR_TEIE|STM32_DMA_CR_DMEIE|STM32_DMA_CR_EN flags in DMA stream CR register.
When I call i2sStartExchange again, it is calls dmaStreamEnable(), what sets STM32_DMA_CR_EN only.
So. in second transfer I get all the same except DMA interrupts, so we have failed callbacks, error checking and so on.
I can stop entire service here and re-initialize it, but I think it is mistake in I2S engine, isn't it?
Or this was done for some reason?
Thanks!