I have a 240x240 picture for a display, 115,200 bytes. I know, it’s huge and I should store it externally.
I can’t store it in RAM, so I declare it as const:
const uint8_t Bitmap[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,.....
The program works if I use single byte transfers over SPI. This is too slow, so I implemented DMA.
SPI.beginTransaction(SPISettings(30*MHZ, MSBFIRST, SPI_MODE0));
digitalWrite(dc, HIGH);
digitalWrite(cs, LOW);
SPI.transfer(Bitmap, NULL, sizeof(Bitmap), NULL);
digitalWrite(cs, HIGH);
SPI.endTransaction();
The compiler (WebIDE) gives me this error:
invalid conversion from 'const void*' to 'void*' [-fpermissive]
I tested the code above with a smaller buffer in RAM, declared as:
uint8_t Bitmap[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,.....
This compiles fine and I get the faster transfer speed.
I don’t understand the type conversion issue.
Does SPI DMA support transferring data from Flash?
Running on Photon with OS 1.5.2
I also learned that I cannot change the contents of Flash during run time (compiler error). I guess it makes sense since it is declared as const. Are there ways of doing this?