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.
8 years ago.
SPI (slave mode) and BLE on nRF51822
I'm trying to put together a SPI (slave) <-> BLE bridge with a nRF51822. My problem is that if I call BLE::startAdvertising()
(after setting up everything BLE-related), then the SPI reception stops after a random period of time (I'm continously sending data to it, but that's not forwarded over BLE). SPISlave::receive()
returns 0 no matter what I send to it. My guess is that something gets messed up with interrupts. I'm not touching interrupt handling in any way in my code. Here's my main loop:
while(true) { ble.processEvents(); if(run_cnt++ == 100000) { run_led = !run_led; run_cnt = 0; } if(spi.receive()) { if(comm_cnt++ == 1000) { comm_led = !comm_led; comm_cnt = 0; } spi.reply(0); } }
I'm blinking two LEDs, one to see if the main loop is running (run_led
) and one to indicate SPI reception (comm_led
). After a random amount of time, comm_led
stops blinking while run_led
continues.
Does anyone have an idea how to get SPI slave mode and BLE working at the same time?
See the root of this problem here: https://devzone.nordicsemi.com/question/105249/spi-slave-and-ble-on-nrf51822
posted by Szabolcs Székelyi 04 Dec 2016