0

I'm using a Bluefruit nRF52 with Arduino framework, and using Bluefruit library. It's connected to the Bluefruit connect app, but also acting as an SPI slave for another device (an stm32).

I'm having to bit-bang the SPI as the Arduino SPI library won't work as a slave (for nordic nrf52 devices), and using a GPIO from the nRF52 to tell the stm32 I'm ready to receive SPI (normally 5 to 10 bytes), after it detects SPI nCS assertion. To bitbang the SPI data, I'm then waiting on an interrupt on rising edge SPI CLK, at which point clock in the MOSI data.

It's mostly working except the odd message (1 in 5ish full transfers) gets missed. I've traced this to one SPI clk interrupt being missed during the transfer. (each transfer is 10 bytes).

As the nrf52 softdevice has higher priority than any user code, including interrupt handlers - I'm wondering if the irq is being missed because it happens during a period where the softdevice is in control. which is asynchronous.

So I'm wondering if I wait until soft device takes control, then wait till its done, then I signal that I'm ready to receive over SPI, that will give me the best chance to receive a full message.

Is there a way that I can poll some flag / variable / register to know that the softdevice has just been busy?

jsotola
  • 1,554
  • 2
  • 12
  • 20
elMick
  • 1

0 Answers0