Hi I have a question regarding DMA used by I2S (SAI). This is on zephyr but maybe someone will be able to describe what wrong might be happening with DMA. So when either I2S TX or RX are used there is no problem with DMA but once both channels are enabled to work together strange thing happens with TX DMA TCD and DESTADDR gets corrupted. I enable a watchpoint on the adress of TCD0 which TX from I2S is enabled and it looks like this corruption comes from DMA engine itself
(gdb) c
Continuing.
Hardware watchpoint 4: *0x40071010
Old value = 1077952544
New value = 0
EDMA_TcdReset (tcd=tcd@entry=0x40071000) at /home/radekp/projects/zephyrproject/modules/hal/nxp/mcux/mcux-sdk/drivers/edma/fsl_edma.c:459
459 tcd->DLAST_SGA = 0U;
(gdb) x/16w 0x40071000
0x40071000: 0x00000000 0x00000000 0x00000000 0x00000000
0x40071010: 0x00000000 0x00000000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5894 0x006c0002 0x80000200 0x03720012
(gdb) c
Continuing.
Hardware watchpoint 4: *0x40071010
Old value = 0
New value = 1077952544
0x3003ce9c in EDMA_InstallTCD (base=, channel=, tcd=0x80000140 ) at /home/radekp/projects/zephyrproject/modules/hal/nxp/mcux/mcux-sdk/drivers/edma/fsl_edma.c:101
101 base->TCD[channel].DOFF = tcd->DOFF;
(gdb) x/16w 0x40071000
0x40071000: 0x80aa6734 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x00000000 0x00000000 0x00000000
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5894 0x006c0002 0x80000200 0x03720012
(gdb) c
Continuing.
Breakpoint 1, dma_mcux_edma_reload (dev=0x3004c4b0 <__device_dts_ord_486>, channel=0, src=2158649424, dst=1077952544, size=1764) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:476
476 struct call_back *data = DEV_CHANNEL_DATA(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa6734 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x03720000 0x80000160 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5894 0x006c0002 0x80000200 0x03720012
(gdb) c
Continuing.
Breakpoint 1, dma_mcux_edma_reload (dev=0x3004c4b0 <__device_dts_ord_486>, channel=1, src=1077952672, dst=2158645896, size=1764) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:476
476 struct call_back *data = DEV_CHANNEL_DATA(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa67a2 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x033b0000 0x80000160 0x03720012
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa596c 0x03720002 0x800001e0 0x0372000a
(gdb) c
Continuing.
Breakpoint 1, dma_mcux_edma_reload (dev=0x3004c4b0 <__device_dts_ord_486>, channel=1, src=1077952672, dst=2158644132, size=1764) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:476
476 struct call_back *data = DEV_CHANNEL_DATA(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa67b2 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x03330000 0x80000160 0x03720012
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa596c 0x03720002 0x800001e0 0x03720012
(gdb) c
Continuing.
Breakpoint 2, dma_mcux_edma_irq_handler (dev=0x3004c4b0 <__device_dts_ord_486>, channel=0) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:191
191 uint32_t hw_channel = dma_mcux_edma_add_channel_gap(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa605a 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x036d0000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5f7c 0x006a0002 0x800001e0 0x03720012
(gdb) c
Continuing.
Breakpoint 2, dma_mcux_edma_irq_handler (dev=0x3004c4b0 <__device_dts_ord_486>, channel=0) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:195
195 LOG_DBG("IRQ OCCURRED");
(gdb) x/16w 0x40071000
0x40071000: 0x80aa605e 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x036b0000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5f80 0x00680002 0x800001e0 0x03720012
(gdb) c
Continuing.
Breakpoint 2, dma_mcux_edma_irq_handler (dev=0x3004c4b0 <__device_dts_ord_486>, channel=1) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:191
191 uint32_t hw_channel = dma_mcux_edma_add_channel_gap(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa6132 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x03010000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa528c 0x03700002 0x80000200 0x03720012
(gdb) c
Continuing.
Breakpoint 2, dma_mcux_edma_irq_handler (dev=0x3004c4b0 <__device_dts_ord_486>, channel=1) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:195
195 LOG_DBG("IRQ OCCURRED");
(gdb) x/16w 0x40071000
0x40071000: 0x80aa6136 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x02ff0000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5290 0x036e0002 0x80000200 0x03720012
(gdb) c
Continuing.
Breakpoint 1, dma_mcux_edma_reload (dev=0x3004c4b0 <__device_dts_ord_486>, channel=1, src=1077952672, dst=2158651188, size=1764) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:476
476 struct call_back *data = DEV_CHANNEL_DATA(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa616a 0x01010002 0x00000002 0x00000000
0x40071010: 0x40404020 0x02e50000 0x80000180 0x0372000a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa52c4 0x03540002 0x80000200 0x03720012
(gdb) c
Continuing.
Breakpoint 2, dma_mcux_edma_irq_handler (dev=0x3004c4b0 <__device_dts_ord_486>, channel=0) at /home/radekp/projects/zephyrproject/zephyr/drivers/dma/dma_mcux_edma.c:191
191 uint32_t hw_channel = dma_mcux_edma_add_channel_gap(dev, channel);
(gdb) x/16w 0x40071000
0x40071000: 0x80aa6734 0x01010002 0x00000002 0x00000000
0x40071010: 0xc04041a0 0x03720000 0x80000180 0x0372008a
0x40071020: 0x404040a0 0x01010000 0x00000002 0x00000000
0x40071030: 0x80aa5894 0x006c0002 0x80000200 0x03720012
(gdb)
Leaving the fact this is zephyr specific I would like to understand what is happening that causes this behaviour as I am willing to fix this behaviour on zephyr once I understand what wrong is going on.
Hi @radoslawp ,
How did you set up the TCD for both TX and RX DMA? Did it make a difference if you switch the buffer for RX DMA to another place?
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------