Crash with SPI transfers larger than 32 bytes

gswdh1
Posts: 2
Joined: Wed May 11, 2022 11:08 am

Crash with SPI transfers larger than 32 bytes

Postby gswdh1 » Tue May 17, 2022 9:57 pm

Hi,

I wonder if anyone can help with this issue.

I'm using the HSPI to write to a TFT display where I need high speed for a good refresh rate. I understand there is a maximum transfer size of 4096KB so I try breaking down the 115200KB into chunks and transfer however any chunk size larger than 32 bytes results in the following panic. I am running the SPI in a freeRTOS task, no other tasks have access to the HSPI - this is the only SPI peripheral. 32 bytes works fund but is very slow, 33 bytes and above is a crash.

Thank you!

Code: Select all

Guru Meditation Error: Core  0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d66f0: e51a0cfe f01dfefc 22006136
0x400d66f0: GC9A01_write_data at /Users/georgewaller/Projects/pocketmoon_sw/GC9A01_demo/GC9A01.c:25

Core  0 register dump:
PC      : 0x400d66f6  PS      : 0x00060530  A0      : 0x00000000  A1      : 0x3ffd81f0
0x400d66f6: GC9A01_write_data at /Users/georgewaller/Projects/pocketmoon_sw/GC9A01_demo/GC9A01.c:27

A2      : 0x3ffb2bfc  A3      : 0x00000021  A4      : 0x80087fe5  A5      : 0x3ffb0b30
A6      : 0x00000003  A7      : 0x00060023  A8      : 0x800d66f6  A9      : 0x3ffd81d0
A10     : 0x00000001  A11     : 0x00000021  A12     : 0x8008a299  A13     : 0x3ffd3d30
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x0000001b  EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff


Backtrace:0x400d66f3:0x3ffd81f0
0x400d66f3: GC9A01_write_data at /Users/georgewaller/Projects/pocketmoon_sw/GC9A01_demo/GC9A01.c:26

Code: Select all

#include "driver/spi_master.h"

spi_device_handle_t spi;

void spi_init()
{
    spi_bus_config_t buscfg = {
        .miso_io_num     = 2,
        .mosi_io_num     = 23,
        .sclk_io_num     = 18,
        .quadwp_io_num   = -1,
        .quadhd_io_num   = -1,
        .max_transfer_sz = 256
    };

    spi_device_interface_config_t devcfg = {
        .clock_speed_hz = 30000000,
        .mode           = 0,
        .spics_io_num   = -1,
        .queue_size     = 7,
        .pre_cb         = (void *)NULL,
    };

    spi_bus_initialize(HSPI_HOST, &buscfg, SPI_DMA_CH_AUTO);
    spi_bus_add_device(HSPI_HOST, &devcfg, &spi);
}

void spi_tx(uint8_t * data, uint32_t len)
{
    spi_transaction_t t = { 0 };

    t.length = (size_t)(len * 8);
    t.tx_buffer = data;
    t.rxlength = 0;
    t.flags = SPI_TRANS_USE_RXDATA;

    spi_device_transmit(spi, &t);
}

gswdh1
Posts: 2
Joined: Wed May 11, 2022 11:08 am

Re: Crash with SPI transfers larger than 32 bytes

Postby gswdh1 » Wed May 18, 2022 10:44 am

I have an update. I changed the value of

Code: Select all

max_transfer_sz
to 4000 but no change. If I disable DMA it works but then I'm limited to 64 bytes per transfer.

Selecting

Code: Select all

SPI_DMA_CH1
or

Code: Select all

SPI_DMA_CH2
doesn't help. I still get the following error. I have also tried HSPI and VSPI with no difference.

It seems Double Exception is quite rare.

Code: Select all

Guru Meditation Error: Core  0 panic'ed (Double exception).

Core  0 register dump:
PC      : 0x4008764b  PS      : 0x00040336  A0      : 0x800d66fd  A1      : 0x3ffd8010
0x4008764b: _xt_context_save at /Users/georgewaller/esp/esp-idf/components/freertos/port/xtensa/xtensa_context.S:195

A2      : 0x3ffb2bfc  A3      : 0x00000fa0  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x800d6fdc  A9      : 0x3ffd7fe0
A10     : 0x00000000  A11     : 0x3ffd8010  A12     : 0x00000000  A13     : 0x00000000
A14     : 0x00000001  A15     : 0x00000000  SAR     : 0x0000001b  EXCCAUSE: 0x00000002
EXCVADDR: 0xfffffff0  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff


Backtrace:0x40087648:0x3ffd80100x400d66fa:0x00000000  |<-CORRUPTED
0x40087648: _xt_context_save at /Users/georgewaller/esp/esp-idf/components/freertos/port/xtensa/xtensa_context.S:194

0x400d66fa: GC9A01_write_data at /Users/georgewaller/Projects/pocketmoon_sw/GC9A01_demo/GC9A01.c:25

Who is online

Users browsing this forum: Majestic-12 [Bot] and 73 guests