Clarification of GPIO configuration for SPI master

Hi all

Chapter 26.1.1 of the nRF51 series reference manual v3.0 states that the pins used by the SPI master have to be configured in the GPIO registers according to table 221.

Now, I have some points that are not quite clear to me:

  1. Are the GPIO settings only necessary for the OFF mode or for the normal operation when the SPI master is enabled? We are using the SPI master already for a while and haven't realized that the GPIO registers must be configured, but so far we didn't run into any problems...
  2. Why is it necessary that the input buffer of the SCK pin has to be connected although the pin is configured as output?

Many thanks in advance for your help!

Kind regards

  • dont know for second question, but for the first one - if you are using nordic libs for SPI, they are configuring GPIO's when creating new instance of SPI which you are using.

  • Thanks for your answer, but we aren't using the SPI library from Nordic. We use our own SPI driver.

  • Well it would be good to see how "your" drivers look like, because if you don't modify values of SPI PSELSCK, PSELMOSI nad PSELMISO registers, then these registers will have default value of 0xFFFFFFFF, and that means that associated SPI master signal is not connected to any pin of your chip. So it is imposible to use SPI without modyfing these registers. Also, from reading reference manual i can see that these registers configurations are used only as long as SPI master is enabled. And i checked the manual to see about your second question, however i didn't find any answer. The only thing i was able to find is that input buffer must always be connected to the SCK pin to work.

  • You've understood me wrong. Of course do I modify the PSELx registers, otherwise our SPI driver won't work. The question was why it is necessary to configure the SPI pins also in the GPIO peripheral module.

  • Why wouldn't you? PSELSCK, PSELMOSI, and PSELMISO are only selecting which pins you are going to use for SPI. These pins do not modify the pins behavior. To modify pins behavior you have to modify it in GPIO module. It is kinda naturally . It is exactly the same in every mcu. First you select the pins used, then you modify them for desired interface.