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

nRF51822 SPI with more than one CS signal

how can I program SPI to select more than only one slave device with any GPIO ?

SPI Routine "spi_master_int" can select SPI0 or SPI1 only with one dedicated GPIO as Slave-Select Signal.

Parents
  • I think Reinhard is referring to the spi configuration source from the SDK (spi_master.c), which expects SPI_PSELSS0 or SPI_PSELSS1 to be defined to a specific GPIO line. spi_master_tx_rx asserts the defined GPIO line during the SPI transaction.

    If you have a multidrop SPI bus, then this clearly won't work. But it would be a trivial matter to adapt your own version of spi_master_tx_rx that took the SS line as a parameter (assuming CPOL and CPHA are still the same across your devices, of course).

Reply
  • I think Reinhard is referring to the spi configuration source from the SDK (spi_master.c), which expects SPI_PSELSS0 or SPI_PSELSS1 to be defined to a specific GPIO line. spi_master_tx_rx asserts the defined GPIO line during the SPI transaction.

    If you have a multidrop SPI bus, then this clearly won't work. But it would be a trivial matter to adapt your own version of spi_master_tx_rx that took the SS line as a parameter (assuming CPOL and CPHA are still the same across your devices, of course).

Children
No Data
Related