The nRF51822-mKIT is a low cost ARM mbed enabled development board for Bluetooth® Smart designs with the nRF51822 SoC. The kit gives access to all GPIO pins via pin headers …

Using different SPI pins than those in the pin map

31 Oct 2014

Hi all,

I'm trying to use pins p1,p2,p3,p4 for SPI (master) on the Nordic nRF51822-mkit. But I get the dual-blink-of-death whenever I use any pins other than the two default sets (SPI0 and SPI1) to instantiate an SPI object.

Is it possible to use pins p1 - p4 for SPI, and if so, what is the correct way to initialise SPI? It works with SWSPI (software SPI library) but that's not fast enough for my usage.

Thanks.

EDIT: apparently this has been discussed before, by me nonetheless. Somehow I missed Erik's reply. http://developer.mbed.org/questions/4351/SPI-init-problem/

However I would like to keep this thread open to draw attention as it's a recurring issue. I would be glad to help rewrite spi_api.c to make it compatible with all pins. How do I start? After converting the mbed library project within the online compiler, I cannot find the same tree as on github.

11 Mar 2016

I had this same problem with RX/TX UART pins. I wanted them different from what was mapped out. It is possible.

First, import the 'mbed-src' library for mbed, not the one that just comes with. That way the compiler will recompile the whole mbed library and not just link to the standard one.

Then in mbed-src, go to the 'targets' directory, then 'TARGET_NORDIC' then 'TARGET_MCU_NRF51822' and then your board, for me this was the 'TARGET_HRM1017'. Now edit the PinNames.h file. In there, you can remap UART/serial pins, USBTX, USBRX, and your SPI pins. After your changes, save your file and go and try to use your remapped SPI or Serial classes. Worked for me for Serial.

The nrf51822 is a pretty flexible chip, I don't think it cares what pins you assign to what peripherals.