This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI delay betwen byte

Hello,

I have a problem with the SPI of the nRF52DK 52832, and Zephyr 1.6.1. I have to transmit 10 frames of 5760 bytes each to the TFT display with the ST7789 driver.

The transmission is successful but I measured a delay between one byte and the next of almost 2 uS,

which makes the writing of the frame perceptible. Is it possible to reduce this delay between bytes?

The SPI is thus initialized.

static const struct spi_config spi_cfg = {
.operation =SPI_OP_MODE_MASTER|SPI_WORD_SET(8)| SPI_TRANSFER_MSB | SPI_MODE_CPOL | SPI_MODE_CPHA,
.frequency = 8000000,
.slave =0,

};

and I use spi_write to send the frame:

uint16_t fBuffer[5760];

void sendfBuffer(int y)
{

struct spi_buf tx_buf = {
.buf = fBuffer,
.len = sizeof(fBuffer)
};

struct spi_buf_set tx = {
.buffers = &tx_buf,
.count = 1
};


startWrite();// cs low
setAddrWindow(0, y,240,24); // set the position of the frame 
spi_write(spi2_dev,&spi_cfg,&tx); // send buffer to display
endWrite();//cs high

}

Best regards

Parents Reply Children
  • Hi Sigurd,

    thanks a lot for your help, I have reprogrammed the DK and now works.

    I Have tested your example and work perfect and I have noted tha the buffer of SPI is 255 bytes.

    I found why in my application  i see a pause 2 uS every byte , because in overlay file i have this code

    &spi2 {
    compatible = "nordic,nrf-spi";
    status = "okay";
    label ="SPI_2";
    sck-pin = <2>;
    mosi-pin = <3>;
    miso-pin = <4>;
    cs-gpios = <&gpio0 25 0>;
    };

    I have changed "nordic,nrf-spi" to "nordic,nrf-spim" and now work well.


    Thanks

    Fausto

Related