I can not able to send more than 15 bytes of data in SPI21 in nrf54L15

I am working with St7789v driver based RGB565 Display . I have chosen SPI21 configured at 8Mhz and if I send 15 bytes chunk of image bitmaps, I can see the image in the display .
if i increase it to more than 15 bytes , the image is distorted and showing like garbage .

I have kept the image bitmaps in RAM and trying to display the image .

even if I send 15 bytes chunks and decrease the SPI clock to 4Mhz , this time also I can not see the actual image .

here is the code for reference 

static struct spi_config spi_cfg = {

    .frequency = 8000000,

    .operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB | SPI_OP_MODE_MASTER,

    .slave = 0,

    .cs = NULL,

};

int spi_send(const uint8_t *data, size_t len,char continuous)

{

    struct spi_buf tx_buf = {

        .buf = (void *)data,

        .len = len,

    };

    struct spi_buf_set tx = {

        .buffers = &tx_buf,

        .count = 1,

    };

    gpio_pin_set(spi_cs_spec.port, spi_cs_spec.pin, 0); // CS = 0 to select the device

    int ret = spi_write(spi_dev, &spi_cfg, &tx);

    if (continuous == 0)

        gpio_pin_set(spi_cs_spec.port, spi_cs_spec.pin, 1); // CS = 1 to deselect the device

 

    if (ret)

    {

        LOG_ERR("SPI write failed: %d", ret);

    }

    return ret;

}


Function used to display the image 

 

static void DE_vDrawBuffer(const Position_t *pos,  uint8_t *buffer, size_t bufSize)

{

   

    const uint32_t w = pos->width;

    const uint32_t h = pos->height;

    const uint32_t total = w * h * 2u; // RGB565 = 2 bytes/pixel

 

    const int x0 = pos->x;

    const int y0 = pos->y;

    const int x1 = x0 + (int)w - 1;

    const int y1 = y0 + (int)h - 1;

 

    DE_vSetWindow(x0, y0, x1, y1);

    write_command(ST77XX_RAMWR); // 0x2C: start GRAM write

 

    int readData = 0;

   #define CHUNK_SIZE (12)

   //kb TOBO: why can not i increase above 15 bytes of chunk size?

   //if i send above 15 bytes, the display shows garbage

    uint8_t temp[CHUNK_SIZE];

    while (readData <= total)

    {

        int toRead = total - readData > CHUNK_SIZE ? CHUNK_SIZE : total - readData;

        memcpy(temp, &buffer[readData], toRead);

        write_data(temp, toRead,1);

        readData += toRead;

    }

    SetCSHigh();

   

}

Related