I'm seeing stability issues driving a display via SPI. I'm using LVGL as a rendering library. For stresstesting, I'm driving a continuous animation, which eventually will come to a halt. I debugged it down to the SPI DMA transfer not completing. When not using DMA, this works.
To further debug, simplified my code by remoing all threading code (Device OS is still threaded), and stopped relying on the interrupt to be notified for completion, yet the DMA transfer method eventually will not complete
I'm using DeviceOS 6.2 preview, but have not yet tested the same with an older DeviceOS.
The relevant, simplified code that block that communicates with the display is below. Note that if I transfer byte-by-byte (instead of DMA), i have not seen this hang. Am I fundamentally holding it wrong?
Thanks,
MikeS
void Display::SendCommandDma(const uint8_t *cmd, size_t cmd_size,
const uint8_t *param, size_t param_size) {
SPI1.beginTransaction(spi_settings_);
pinResetFast(pin_chipselect);
pinResetFast(pin_datacommand);
for (size_t i = 0; i < cmd_size; i++) {
SPI1.transfer(cmd[i]);
}
pinSetFast(pin_datacommand);
SPI1.transfer(param, NULL, param_size, NULL);
// Not getting here when it hangs
pinSetFast(pin_chipselect); // CS is not pulled up anymore
SPI1.endTransaction();
lv_display_flush_ready(display_);
}