Hello,
I'm currently working with an MCXN947 microcontroller.
I'm trying to trigger a DMA transfer into a sample buffer via a CTIMER match interrupt.
The idea is to write into the sample buffer the state of a GPIO register (specifically the input values of some pins) via DMA at every x timer intervals (specifically every 10 us).
I can confirm that my GPIO pin is correctly configured as an input.
I can confirm that my timer is working correctly and triggering a match at every 10 us.
I can confirm that my DMA transfers are working correctly because the buffer gets filled up with values.
I can confirm that the source address (GPIO PDIR reg) is correctly set in the DMA configuration.
I can confirm that my destination address is also correctly set in the DMA configuration as it is always in between the start and end address of my buffer (meaning it increments and wraps around correctly).
But for some reason, the wrong values are being copied into the buffer. I can see in my debugger that the value of the register I'm trying to transfer is 0x00020000 (pin 17 is high, the rest are low). However, my buffer is only being filled with 0s. It's a uint32_t type buffer of 512 elements initialized all at 0xFF. As the DMA transfers increment, the whole buffer progressively gets filled with 0x0 and not the expected value of 0x00020000 (which never changes - pin 17 is always high).
Do you have any idea what causes this? Or if I'm possibly missing something?
Here are my driver configurations:
Timer:
CTIMER0
kCTIMER_Match_1
CTIMER0_IRQn (triggering callback on interrupt is optional but I use it in my code for debugging purposes)
DMA:
DMA0
kDma0RequestMuxCtimer0M1
kINPUTMUX_Ctimer0M1ToDma0Ch8Ena
EDMA_0_CH8_IRQn (triggering callback on interrupt is optional but I use it in my code for debugging purposes)
GPIO:
GPIO3
PORT3
Pin 17
Here are the states of the registers right before I start sampling
reg_gpio3.png
reg_port3.png
reg_edma0_ch8.png
reg_inputmux0_dma.png
reg_inputmux0_timer.png
reg_ctimer0.png