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

nRF51822 BLE and SPI slave

Hi,

I am working with the BLE Nano module and the mbed online compiler. I have the Nano acting as an SPI slave. The problem occurs when I try to add BLE functionality. As soon as I add the ble.init() call to the code, SPI stops working and I receive only ones at the master.

In the code below the "spiRunner" function simply loads the reply buffer with some dummy data at every reception. If I comment out "ble.init()" that works perfectly.

#include "mbed.h"
#include "ble/BLE.h"
#include "ble/DiscoveredCharacteristic.h"
#include "ble/DiscoveredService.h"
#include "ble/GapScanningParams.h"
#include "ble_radio_notification.h"
#include "ble_gap.h"

BLE    ble;
SPISlave    device(p9, p11, p8, p10); // mosi, miso, sclk, ssel

void spiRunner(){
    while(1) {
        device.reply(0x11);
        if(device.receive()) {
            device.read();
            device.reply(0x99);
        }
    }
}

int main(void)
{
 device.reply(0x00);

 ble.init(); // initialize bluetooth

 spiRunner();

}

Any experiences using BLE and SPI together?

Best Regards Mikael

Related