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

Is it possible switch SPI master role to slave role?

Hi, I'm using PCA10001 connect to a sensor chip.I would like to set the register values for sensor chip as SPI master role and I need to switch to slave role to read the sensor data from sensor chip. Unfortunately, I couldn't get any sensor data from sensor chip.I've used an oscilloscope to verify that the data of sensor chip is being sent out from MOSI ,clock and SS PIN.Is it possible to implement the SPI master and slave role together? Thanks.

  • Hi

    On the nRF51822, the SPI Master(SPI), SPI Slave(SPIS) (and TWI) communication are handled through two peripherals IDs, ID 3 and 4, see Table 15 in nRF51822 PS.

    ID 3 is associated with SPI0 and TWI0. ID 4 is associated with SPIS1, SPI1, and TWI1.

    Only one instance of the same ID can be used at the time, which means that it is possible to implement one instance of the SPI Master(SPI0) and one instance of the SPI Slave(SPIS1) together.

    If you, for example, also want to use TWI, you need to disable the peripheral associated with that ID before you configure and use it. Disabling a peripheral will not reset any of the registers that are shared. It is therefore important to configure all relevant registers explicitly to secure that it operates correctly. For more information please see "Shared resources" in Chapter 25, 26, and 27 in the nRF51 Series Reference Manual.

    Also be sure that your device includes a SPI Slave. Devices with the following markings include a SPI Slave: -QFAA: FA, GC, G0 -CEAA: CA, DA, D0 -QFAB: B0

  • Great that you found Petter's answer helpful, but it's much appreciated if you don't post thank-you replies, but instead just upvote the answers you like. :-)

Related