4 years, 8 months ago.

SPI not working on NRF52

Hello,

I experience problems with SPI on NRF52 boards, but not on others (NXP, ST etc.).

This is the code that fails:

SPI         _spi(p4, p3, p5);
DigitalOut  _cs(p7);

 _spi.frequency(1000000);
 _spi.format(8, 0);
  
 _cs = 0;
 pc.printf("before write.\r\n");
 _spi.write(0x01);//This line fails
 pc.printf("after write\r\n");//this does not get called any more
 _cs = 1;

The very same code works fine on other platforms. What could be the reason and how to investigate into it?

Thanks Peter

1 Answer

4 years, 8 months ago.

I do not think that NRF52 exposes SPI on the pins you are using. Here is the list of pins used for SPI in mbed OS - https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/TARGET_NRF52_DK/PinNames.h#L144-L157