2024-05-18 06:33 PM - edited 2024-05-18 06:41 PM
Hello,
I'm working on an audio application using a NUCLEO-H723ZG, where I am trying to setup two DMA channels for full duplex audio. I am using the Zephyr RTOS with a modified I2S driver I am writing since the one in mainline zephyr is non-functional for duplex I2S (and I haven't seen it work for transmit I2S either). However, I am encountering FIFO errors in the DMA block while using direct mode, and I am not sure what is causing them. Unfortunately, I am not sure I can share this code publicly, but I can give the states of the registers in the peripherals.
DMA Streams:
TX DMA Stream (DMA1 Stream 0):
RX DMA Stream (DMA1 Stream 1):
I2S Configuration:
Clock Configuration:
Verified Clock Configuration:
DMA and I2S Configuration:
Synchronizing Clocks:
Interrupt and Error Handling:
Despite these efforts, the FIFO errors persist. Any insights or suggestions on additional steps to troubleshoot this issue would be greatly appreciated. Let me know if additional information is required, I feel like I'm pulling my hair out trying to figure out the issue
Thank you!
2024-05-19 01:00 AM - edited 2024-05-19 01:01 AM
Hi,
i dont know Zephyr and your codec , you dont tell anything about it, but for audio -> DMA -> I2S you should use circular mode - do you ?
Because you start the stream only one time and then its running continuous until power off, just in half/full callbacks you put + get new data on the stream...i never had fifo problems (on H743 + H563 ).
And for first, switch off D-cache, except you are sure about your cache manegement...
2024-05-19 03:03 AM
> I get a FIFO error in the DMA peripheral immediately after re-enabling the DMA peripheral at the end of the first TX callback.
That means, that I2S "run dry" (underrun), due to the ISR taking too long (longer than transmitting one I2S frame).
As @AScha.3 said above, I2S is to be served by a circular DMA.
JW
2024-05-22 07:16 PM
Well I started by trying to modify the existing Zephyr stm32 I2S driver which does not use circular mode - in the DMA callback (either TX or RX), the driver is managing a set of memory blocks to point the DMA peripheral to. I will investigate adding circular mode to the driver.
A question for you - regarding your comment on switching off D-cache: is the a compiler setting? or is this a register setting?
Thanks,
Michael
2024-05-23 12:36 AM
Caches D/I you can switch on at start, in Cube set it: (register setting done at start)
Problem with D-cache : when anything else, than the core/cpu moves data , (the DMA), the core/cache dont know about this and will use its cached data, so you get data inconsistency, cpu/cache data no more same as in RAM.
So with D-cache on and DMA , you need cache management or MPU settings, to define not cachable areas (that are used by DMA). But at start, if not needing the top last 2% performance , that D-cache might improve speed, just leave it off. Using I-cache (program->Instruction cache) is more important and creates no problems, because program is always executed by the cpu and nothing else .