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

SPI slave timeout

Hello, I am running an SPI slave application based on examples I found online for the nrf connect sdk. I now get the following error when I run the application:

[00:00:03.011,871] <err> spi_nrfx_spis: Timeout waiting for transfer complete

I noticed it is connected to the CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE configuration, where the timeout is controlled. Seems logical. But I did not expect to get timeouts for an SPI slave, as this is a SLAVE. It has to wait for the clock to become available by the master.

The only thing I could think of was the device expecting an active clock signal within the timeout time. And could it be the spi driver activates the timeout because the CS IO line is currently always low (so, slave active). I have no control over the master right now, that is being worked on. I just need to know if this will error resolve itself when the master is available or do I need to fix something in my SPI slave driver?

Thank you

Parents
  • Hi 

    The timeout occurs if the CS line is kept low too long after the last byte was clocked out on the master side. In your case I expect the timeout counter will start soon after you initialize the driver, if the CS line is low all the time. 

    Once you connect a master to the bus, and the CS line is high by default, this should not happen. 

    Alternatively you can just pull the line high externally until you got a master in place. 

    Best regards
    Torbjørn

Reply
  • Hi 

    The timeout occurs if the CS line is kept low too long after the last byte was clocked out on the master side. In your case I expect the timeout counter will start soon after you initialize the driver, if the CS line is low all the time. 

    Once you connect a master to the bus, and the CS line is high by default, this should not happen. 

    Alternatively you can just pull the line high externally until you got a master in place. 

    Best regards
    Torbjørn

Children
No Data
Related