I’m trying to load pixel data over Serial so that I can communicate with my display via my animation library BiblioPixel and it works great for a 32x64 panel, but when I try to up it to two of these panels for a total of 32x128 it just hangs while trying to load into the background buffer.
uint16_t count = 0;
uint8_t emptyCount = 0;
rgb24 *buffer = backgroundLayer.backBuffer();
if (size == packSize)
{
while (count < packSize - 1)
{
c = Serial.readBytes(((char*)buffer) + count, packSize - count);
if (c == 0)
{
emptyCount++;
if(emptyCount > EMPTYMAX) break;
}
else
{
emptyCount = 0;
}
count += c;
}
}
uint8_t resp = RETURN_CODES::SUCCESS;
if (count == packSize)
{
backgroundLayer.swapBuffers(false);
}
else
resp = RETURN_CODES::ERROR_SIZE;
Serial.write(resp);
The above example seems to crash the Teensy. It simply never returns. At first I thought that it was a max serial buffer size issue, but then I replaced “rgb24 *buffer” with “byte buffer[12288]” and, while it doesn’t update the actual display because I cannot figure out how to get that buffer into the BackgroundLayer (see here), it does read the data and return properly so that as far as BiblioPixel is concerned it’s sending the data. So it would seem that the issue lies in backgroundLayer or backBuffer. My guess is that the buffer returned by backBuffer is not 12288 bytes as expected and I’m overwriting into areas of memory not actually owned by the backgroundLayer buffer. Which doesn’t make a whole lot of sense since it works for half the pixel count… but that’s my best guess.
Any thoughts here?