Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 months ago.
Nordic nRF51822 SPI pin assignment error
- include "low_level_leds.h"
- 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
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/
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 28 Aug 2014Those 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 29 Aug 2014
BTW, we tried to reduce the code and this also creates the same error:
SPI Foo (p11, p12, p13);
int main() { while (1) { } }
posted by Thaddeus Fortenberry 28 Aug 2014