I'm not convinced DMA would help. It's sending the two bytes quickly: the time is taken executing the while loop. It might be instructive to look at the timing for (fragment):
Code: Select all
while True:
spiWrite(b'\x00\x00')
spiWrite(b'\x00\x00')
I was thinking of doing some raw test, by just toggling a GPIO pin. From tests I made with PyBoard I learned that the while loop plus function call would take about 6us per loop at 168 MHz (see
https://github.com/robert-hh/SSD1963-TF ... or-PyBoard, README.md, section Remarks). Since WiPy runs at 80MHz, at least twice the time should be needed.
The underlying SPI tranfer code should be fast. Therefore data should be sent & received in as big chunks as possible.
Unfortunatelly I cannot send data in big chunks because I need to toggle CS pin in between each two bytes sent to SPI slave.
Please take a look at these test results of forum member @manitou. Not sure if he made the comparison for CC3200 platform with pure compiled C code or with MicroPython. It seems that DMA might help to speed up SPI communication.
CC3200 LAUNCHPAD @ 80MHz (SPI max clock 20mhz)
SPI clock transfer DMA (4-byte)
2MHz 1.2 mbs 1.9
4MHz 1.7 mbs 3.8
5MHz 4.8
10MHz 2.2 mbs 9.2
20MHz 2.7 mbs 17.2
https://github.com/manitou48/DUEZoo/blo ... PIperf.txt