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

Why does SPI not work with nrf_delay

Why does SPI not work with nrf_delay, from this previous question devzone.nordicsemi.com/.../

Surely the SPI SCK is a PWM or other timer/interrupt driven clock?

Also, I comment out nrf_delay_ms(200); and then the clock runs, but the SPI_SS_PIN does not go low? I used \nRF5_SDK_13.0.0_04a0bfd\examples\peripheral\spi\pca10040\blank\iar but no go. I guess one needs to pull SPI_SS_PIN low manually? Any help appreciated

  • I use nRF5_SDK_13.0.0_04a0bfd I answered my own question after I spent a LOT of unnecessary time figuring out how to correct this.

    IAR Preprocessor Symbol add It seems the nrf_delay does NOT cause SPI_SCK to have any problems. As mentioned here.

    P0.09 and P0.10 of the nRF52 are set for use with the NFC antenna. To use these pins as GPIO, one has to add CONFIG_NFCT_PINS_AS_GPIOS as a Preprocessor Symbol. As Mentioned here.

    No need to manually set NFCPINS register in UICR, mentioned here.

    There is a #if defined (CONFIG_NFCT_PINS_AS_GPIOS) define in the bowls of the SDK, so adding the simple Preprocessor Symbol worked for me.

    NOTE: I don't want to change the system_nrf.c or .h files to make it work. Every time there is an updated SDK, you have to make changes to those files as well. Also, Editing uicr_config.h with const uint32_t UICR_ADDR_0x80 attribute((at(0x10001080))) attribute((used)) = 0x12345678; or whatever

    Seemed more of a hack than a solution?

    Dev Kit Resistor changes On the Development Kits resistors are used to route the NFC signals to connetors. Shown here.

    Hopefully this saves someone else some time.

  • Thank you so very much! You saved my day, thank you. I also spent a LOT of unnecessary time figuring this out. Thanks for posting this solution here.

    I owe you a nice cup of coffee.

Related