This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

State of CS (SS) pin after nrfx_spim_xfer

Im using SPI interface to read data from https://docs.rs-online.com/7d34/0900766b81327f26.pdf using the D2 opcode.

The opcode starts reading the page from the flash (528 bytes) from the defined offset until it reaches the end of page, then starts reading the same page again until the CS (SS) pin transitions from low to high. 

From my understanding the nrfx_spim_xfer command defines the number of RX bytes it expects from the SPI (flash memory), but Im not sure what happens to the CS (SS) line after this amount of data is clocked (RX) on the MOSI line. Does the NRF SDK transition CS pin high or not? My target is to stop the D2 command on the flash to stop sending any more data over SPI after a certain number of bytes and currently every time I request the D2 opcode on initialized SPI I get a correct number of bytes from invoking nrfx_spim_xfer, but this data are offset from those requested in the D2 opcode, which seems like Im reading data from a buffer that was filled by a previous nrfx_spim_xfer command. 

Shall I control the CS (SS) pin manually in this case?

If there is any SPI RX buffer on NRF52 is there a way to flush this before the nrfx_spim_xfer command? 

Thanks!

Parents
  • The handling of CS (SS) pins depends on whether you have configured it when calling nrf_drv_spi_init()/nrfx_spim_init().

    If ss_pin != NRFX_SPIM_PIN_NOT_USED, then it will be handled by the driver (before and after transfers), if ss_pin == NRFX_SPIM_PIN_NOT_USED, then it must be handled by the application.

    Kenneth

  • Thanks, I do have SS pin set to a specific pin so I believe the driver is managing the pin, however to put this into my perspective - the flash chip keeps reading the pages and sending data over MISO until lo->hi is detected on the SS line. So my question really is:

    Does the nrfx driver in SDK pull the SS line high when it receives a certain amount of data as defined in nrfx_spim_xfer()?

    Marcel

  • Marcel said:
    Does the nrfx driver in SDK pull the SS line high when it receives a certain amount of data as defined in nrfx_spim_xfer()?

    Yes. I recommend to get a logic analyzer to get more details on what is happening here.

    Kenneth

Reply Children
No Data
Related