Kurt, you probably know this answer too...
Here's a test program (wired up on a Teensy 4.1) that dumps a 320x240 16-bit image on to an ILI9341, using DMA. Works great as long as it statically constructs the ILI9341_t3n object. If I dynamically construct it with new(), then no image is displayed and the DMA frame counter doesn't increment via serial.
In some versions of this test, I've seen one of the three DMA update slices happen before it hangs but it never finishes a full frame when TESTNEW is 1. Always works a treat with TESTNEW set to 0.
The image (and a copy of that source) are in the attached zipfile.
I'm guessing there may be something ith the way the dma callback is allocated in RAM one way or the other that the 1062 doesn't like, but haven't found anything in the docs to confirm or deny that yet...
View attachment testili9341.zip
Here's a test program (wired up on a Teensy 4.1) that dumps a 320x240 16-bit image on to an ILI9341, using DMA. Works great as long as it statically constructs the ILI9341_t3n object. If I dynamically construct it with new(), then no image is displayed and the DMA frame counter doesn't increment via serial.
In some versions of this test, I've seen one of the three DMA update slices happen before it hangs but it never finishes a full frame when TESTNEW is 1. Always works a treat with TESTNEW set to 0.
Code:
#include <Arduino.h>
#include <ILI9341_t3n.h>
#include "image.h"
#define PIN_RST 8
#define PIN_DC 9
#define PIN_CS 0
#define PIN_MOSI 26
#define PIN_MISO 1
#define PIN_SCK 27
#define TESTNEW 0
DMAMEM uint8_t dmaBuffer[240*320*2] __attribute__((aligned(32)));
#if TESTNEW
ILI9341_t3n *tft = NULL;
#else
ILI9341_t3n tft(PIN_CS, PIN_DC, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO);
#endif
void setup()
{
Serial.begin(230400);
delay(200);
if (CrashReport) {
Serial.print(CrashReport);
delay(5000);
}
#if TESTNEW
tft = new ILI9341_t3n(PIN_CS, PIN_DC, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO);
tft->begin(50000000u);
tft->setRotation(3);
tft->setFrameBuffer((uint16_t *)dmaBuffer);
tft->useFrameBuffer(true);
tft->fillScreen(ILI9341_BLACK);
#else
tft.begin(50000000u);
tft.setRotation(3);
tft.setFrameBuffer((uint16_t *)dmaBuffer);
tft.useFrameBuffer(true);
tft.fillScreen(ILI9341_BLACK);
#endif
const uint8_t *p = testimg;
for (uint16_t y=0; y<240; y++) {
for (uint16_t x=0; x<320; x++) {
uint8_t v = pgm_read_byte(p++);
dmaBuffer[(y*320+x)*2+1] = v;
v = pgm_read_byte(p++);
dmaBuffer[(y*320+x)*2] = v;
}
}
}
void loop()
{
#if TESTNEW
tft->updateScreenAsync(true);
#else
tft.updateScreenAsync(true);
#endif
delay(1000);
#if TESTNEW
Serial.println(tft->frameCount());
#else
Serial.println(tft.frameCount());
#endif
}
The image (and a copy of that source) are in the attached zipfile.
I'm guessing there may be something ith the way the dma callback is allocated in RAM one way or the other that the 1062 doesn't like, but haven't found anything in the docs to confirm or deny that yet...
View attachment testili9341.zip