It's important to have in mind, that DMA is only of advantage when sending a minimum amount of data. Below are some benchmarks to have an idea when DMA may be of advantage.
Times [ms] for sending a data buffer of length N:
bytes | native write | writeInterlaced* | writeInterlaced$*
----------------------------------------------------------
20k | 42.0 | 4.2 / 18.4 | 3.0 / 18.0
10k | 22.2 | 4.2 / 11.8 | 3.0 / 11.4
1k | 4.1 | 4.2 / 9.9 | 3.0 / 8.7
0.5k | 3.0 | 4.2 / 9.9 | 3.0 / 8.7
*) 1st number is the net time for calling writeInterlaced, 2nd number is the total transmission time
CONCLUSIO:
writeInterlaced() overhauls native write() at 1k+ bytes
writeInterlaced$() overhauls native write() at 500+ bytes
When sending a small buffer of 1, 2 or 4 byte multiple times, the results are as below.
QSPIx.writeInterlaced( buf, N); // is compared with
SPIx.write({data:..,count:N});
CONCLUSIO:
1 byte buffer: advantage for writeInterlaced at N > 1800
2 byte buffer: advantage for writeInterlaced at N > 3000
4 byte buffer: advantage for writeInterlaced at N > 3500
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I published the current status of the SPI DMA driver at https://github.com/andiy/espruino.git
It's important to have in mind, that DMA is only of advantage when sending a minimum amount of data. Below are some benchmarks to have an idea when DMA may be of advantage.
Times [ms] for sending a data buffer of length N:
CONCLUSIO:
When sending a small buffer of 1, 2 or 4 byte multiple times, the results are as below.
CONCLUSIO:
1 Attachment