Rezo,
I see you've changed the buffer size to 27. It was 512 in the example. I think it must be a power of 2, and likely it must be 512 (2^9) for the
T4_DMA_SPI_SLAVE class to work as intended.
This is due to the way the DMA works, with auto incrementing address pointers and masking the last N bits (done inside the IMXRT1062 DMA hardware). If it's not that then it's due to the way the circular buffers are defined in the T4_DMA_SPI_SLAVE code. I see some & 0x1ff in there, so you bet that's assuming the buffer is 512 bytes long...
Details on that in i.MX RT1060 Processor Reference Manual, Rev. 3, 07/2021 , section eDMA.
By using a buffer of only 27 bytes, you likely had the DMA target address going above those 27 bytes, so overwriting whatever program variables reside there. With a crash as result...
I see you've changed the buffer size to 27. It was 512 in the example. I think it must be a power of 2, and likely it must be 512 (2^9) for the
T4_DMA_SPI_SLAVE class to work as intended.
This is due to the way the DMA works, with auto incrementing address pointers and masking the last N bits (done inside the IMXRT1062 DMA hardware). If it's not that then it's due to the way the circular buffers are defined in the T4_DMA_SPI_SLAVE code. I see some & 0x1ff in there, so you bet that's assuming the buffer is 512 bytes long...
Details on that in i.MX RT1060 Processor Reference Manual, Rev. 3, 07/2021 , section eDMA.
By using a buffer of only 27 bytes, you likely had the DMA target address going above those 27 bytes, so overwriting whatever program variables reside there. With a crash as result...