Page 1 of 1

M487 issues with SPIM DMA Write

Posted: 08 Mar 2024, 20:13
by sittinhawk
I've been messing around with the SPIM module to interface with a quad flash chip. So far I have achieved:

1) Using Normal IO Mode to read, erase, write flash
2) Using DMM mode to read flash

So the next task was to use DMA Write Mode to write to flash. I followed the instructions listed in 6.22.5.5 Move Data from System Memory to SPI Flash (DMA Write Mode), and it technically works (flash chip is written with expected values, and I can verify this with Normal IO Mode), but what is weird is that:

1) Neither of the methods listed to determine if the DMA transfer is complete seems to work. It says "Wait for interrupt or poll the SPIMEN (SPIM_CTL1[0]) until it turns to 0." but neither of these things ever happen, it will just waits forever until I reset the device
2) If I just delay a few seconds after performing the DMA Write, I can verify that it worked using Normal IO Mode, but the DMM mode now seems to be broken, and returns all zeros (and I did try it with and without cache invalidate). Once I reset the device, now DMM mode works again and I can verify that flash contents are correct.

Any ideas what I need to do? Seems like the hardware is performing the DMA write task but having trouble terminating successfully.

Re: M487 issues with SPIM DMA Write

Posted: 16 Mar 2024, 19:35
by sittinhawk
Never mind, I solved it. My software bug was resetting DWDELSEL to zero, and apparently the hardware doesn't like this value to be zero. All working now

Re: M487 issues with SPIM DMA Write

Posted: 22 Mar 2024, 15:14
by morgandu
sittinhawk wrote:
16 Mar 2024, 19:35
Never mind, I solved it. My software bug was resetting DWDELSEL to zero, and apparently the hardware doesn't like this value to be zero. All working now
You're very welcome! Thank you for your feedback.