Showing results for 
Search instead for 
Did you mean: 

STM32WB - sensor data sent via BLE and saved on SD card(SPI)

Associate II


I have an STM32WB and I am trying to get the data from some pressure, temperature and humidity sensors through DMA and send them to my Android via BT, while at the same time saving it as well on a SD card with SPI.

Both programs work quite well separately, both for SD and for BT (I used the Hands On from STM where you send random temperature data to the app) , however when I put them together neither of them works. Here I think I lack the knowledge of setting the Clock Source.

For my SD card and receival of sensor data I normally use the PLLCLK with 32Mhz on CPU1 and 16Mhz on CPU2. However for the BT app I used the HSE_SYS clock source with both CPUs on 32Mhz,

I can't seem the wrap my head around how to set the clock in order for both these functions to be able to work together.

Also as a second question would be how do you suggest to implement the two functions in a same program? I want the data to be transmitted simultaneously via BT while also storing the same sensor data on the SD card.

I notice that after I get to the UTIL_SEQ_Run function that starts my BT, everything else from main is ignored, so I cannot go for my SD card functions. How could I combine this? Does it have anything to do with the scheduler? I am not so sure how to have these two tasks run in parallel.

Thank you everyone,


Associate II

Hi @BNist.1 , I was just wondering if you figured it out? I am trying to accomplish something similar and was hoping that you could share your learnings here. Thanks in advance!