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

How many max SPI slave sensor I can connect with Nrf52840 via SPIM

Hello Folks,

I am using PCA 10056 Eval board. I am using SPIM0 to connect 5 slave sensors. The Chip select is done by the UART Tx pin. So If I send 0x01 over UARt then the sensor- 1 will be selected.

UART Tx byte -- Sensor 0x01 -- 1 0x02 -- 2 etc

Sensors are LSM6DSL

I have five sensors connected via SPIM0 to nordic nrf52840. I am only able to get the reading from 1 or 2 sensors only which is connected closely to nordic. Is there any max limit with the current SPIM hardware and software limitations in terms of max slaves?

ALso, How to change the CS duration and RX delay timing of the SPIM hardware using the SDK 14?

Thank you

Parents
  • This will vastly increase the complexity of your solution though. Instead of letting the nRF52 driver control the CS pin(s) you are now using two independent drivers for this. You will likely have alot of timing issues as a SPI interface is clocked based on the state of the CS chip. Delays in enabling/disabling the CS can result in data corruption. I'd recommend against this method is possible.

    If you have to use this solution you'll have to re-write the SPI driver code for your application to include the UART control. It will get a little messy but it should work. Look at the nrf_drv_spi.c and nrf_drv_spi.h files in the /spi_master folder of the SDK. Look at each section which sets/clears the CS pin. Here is where you would have to set your UART->CS commands. This means you have to include the UART driver files and configure the module accordingly.

Reply
  • This will vastly increase the complexity of your solution though. Instead of letting the nRF52 driver control the CS pin(s) you are now using two independent drivers for this. You will likely have alot of timing issues as a SPI interface is clocked based on the state of the CS chip. Delays in enabling/disabling the CS can result in data corruption. I'd recommend against this method is possible.

    If you have to use this solution you'll have to re-write the SPI driver code for your application to include the UART control. It will get a little messy but it should work. Look at the nrf_drv_spi.c and nrf_drv_spi.h files in the /spi_master folder of the SDK. Look at each section which sets/clears the CS pin. Here is where you would have to set your UART->CS commands. This means you have to include the UART driver files and configure the module accordingly.

Children
No Data
Related