Can't get DMA to SPI to work #17764
-
I'm trying to use DMA for writing to an ILI9225 based display from a Raspberry Pi Pico 2, but I can't get it to work. This is my test code:
If I set _USE_DMA to False it works (using spi.write) suggesting that my SPI setup is correct and the display driver works, but if set to True it doesn't, so the problem must be with the DMA setup. If I run it I get the following output:
This suggests that DMA writing never finishes (timeout) and that the DMA callback never fires (probably also because it never finishes). What could be the issue? Added just to be complete: CS (chip select) isn't set anywhere in the code because it is hardwired to ground. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Looks like you've got your DMA requests wrong. |
Beta Was this translation helpful? Give feedback.
-
There is the data register at offset 8, and the DMA control register at offset 24. The latter controls, whether DMA is enabled for RX and TX. The former has the data. |
Beta Was this translation helpful? Give feedback.
-
Your DMA routine sends HALFWORDS (16bit) to the SPI. Check whether that's OK. |
Beta Was this translation helpful? Give feedback.
-
Thanks @GitHubsSilverBullet and @robert-hh, now it works. For if anybody find this in search of a solution, this is my working test code:
|
Beta Was this translation helpful? Give feedback.
Thanks @GitHubsSilverBullet and @robert-hh, now it works.
For if anybody find this in search of a solution, this is my working test code: