10 years, 2 months ago.

Nordic nRF51822 SPI pin assignment error

  1. include "low_level_leds.h"
  2. include "mbed.h"

DigitalOut LE (p2); DigitalOut OE (p3); SPI LED_Shifter (p5, p6, p7); MOSI, MISO, Clk

This is the first part of the code. Everything compiles fine, but when the mbed board tries to run, LED1 and LED2 start flashing back and forth. This should be fine according the the reference material and SPI.h.

Any ideas what is happening here? Also, what exactly does the LED1 and LED2 flashing mean?

Thanks, Thaddeus

BTW, we tried to reduce the code and this also creates the same error:

  1. include "mbed.h"

SPI Foo (p11, p12, p13);

int main() { while (1) { } }

posted by Thaddeus Fortenberry 28 Aug 2014

1 Answer

10 years, 2 months ago.

To mention it again: Those pins are not SPI pins. Look at the pinout which pins you can use for SPI: https://mbed.org/platforms/Nordic-nRF51822/

Accepted Answer

If you notice the code above, I initially used: SPI LED_Shifter (p5, p6, p7); MOSI, MISO, Clk. These are the suggested pins in the document you're referring to.

Any other suggestions?

posted by Thaddeus Fortenberry 28 Aug 2014

Those pins are NOT shown as SPI pins in the document I linked (https://mbed.org/platforms/Nordic-nRF51822/). There are shown as general SPI example yes, but it depends per board which pins you can use as SPI pins. In that link it shows in the pinout which pins can be used as SPI pins, use them.(p12, p13, p15 there seems to do it).

posted by Erik - 29 Aug 2014