7usec delay seems to be required between SS and SCK on SPI Slave

I'm trying to access the nRF5340 over SPI Slave from another processor who is SPI Master. Running a simple "looback test" between an nRF5340 SPI Master and SPI Slave seems to work fine but when I try it with the external processor's SPI Master the data sent on the MOSI line isn't read correctly by the nRF5340  SPI Slave. Taking a snapshot with the Logic analyzer produces some interesting results. The loopback tests I ran is too1/ncs-spi-master-slave-example (github.com) and it works fine (although it does use the deprecated call spi_transeive_async()). However, I notice about a 7 microsecond delay between the SS going low and the SCK transitions. During this time MOSI is idle but MISO toggles 

When I try my own SPI Master there's only about 70ns delay between SS and SCK. However, everything is shifted in terms of when SPI Slave starts reading the data. I ran a "walking ones" tests and found that on a 16 bit transfer only bits 7-14 are detected by SPI Slave which reads them as bits 8-15. Also the MISO line still toggles, now being read as 0x3F 0x80

Is there any way to remove this delay requirement? 14usec of wasted time per SPI transaction will create very low transfer rates plus the only way I can perform the delay on the SPI Master side is to replace the SS signal with a GPIO that I toggle manually before making the SPI transfer call.

Here is how I am setting up the SPI Slave port in my device tree overlay file

&pinctrl {
    spi_slave_default: spi_slave_default {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 1, 5)>,
                    <NRF_PSEL(SPIS_MOSI, 1, 4)>,
                    <NRF_PSEL(SPIS_MISO, 1, 1)>,
                    <NRF_PSEL(SPIS_CSN, 1, 0)>;
        };
    };

    spi_slave_sleep: spi_slave_sleep {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 1, 5)>,
                    <NRF_PSEL(SPIS_MOSI, 1, 4)>,
                    <NRF_PSEL(SPIS_MISO, 1, 1)>,
                    <NRF_PSEL(SPIS_CSN, 1, 0)>;
            low-power-enable;
        };
    };
};
Here is how I'm setting up the SPI config structure:
static const struct spi_config spi_slave_cfg = {
    .operation = SPI_WORD_SET(8)
                 | SPI_TRANSFER_MSB
                 | SPI_MODE_CPHA
                 | SPI_OP_MODE_SLAVE
                 ,
    .frequency = 8000000,
     .slave = 0,
};
These settings match the SPI Master's.
I've tried running the master at 16MHz all the way down to 3.5MHz with the same result.
For the test app, I'm simply using the loopback app above but removing the SPI Master portion.
I"m using ncs version 2.4.2
Parents Reply Children
No Data
Related