cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55MMG SPI slave doesn't receive when BLE advertising starts

Anna3
Associate

I'm using a custom board with an STM32WB5MMG acting as an SPI slave. The board should receive data frames from a master via SPI, and send them to the computer via BLE. The SPI works fine, but as soon as the BLE advertising starts, the SPI reception breaks. I'm using SPI1 with a circular DMA to identify terminators of single data frames sent by the master. I've already tried 2 configurations:

  1. a circular DMA 1024 bit large, the HAL_SPI_Receive_DMA called in the while(1) and data parsing in the while(1);
  2. a normal DMA, the HAL_SPI_Receive_DMA is called in the HAL_GPIO_EXTI_Callback when CS goes low and data parsing in the HAL_SPI_RxCpltCallback.

My hypothesis is that the BLE introduces a latency on the CPU that causes the SPI reception to be slower than the transmission from the master, that causes mis-alignment of data frames, which means that the terminators are not identified anymore. Is this possible?

Also, a weird thing that I noticed, is that as soon as the terminators are not identified anymore, i.e. the data reception stops working properly, the MOSI line goes instantly low and stays low. This does not make any sense to me, because the MOSI line should be driven by the master, not the slave. Why does this happen?

More in general, what could cause SPI1 in slave mode to stop receiving full frames once BLE advertising is running?

0 REPLIES 0