cancel
Showing results for 
Search instead for 
Did you mean: 

Data transfer via BLE to mobile app

barathi_0206
Associate II

I'm working on sensor data transfer via BLE to mobile app (like nrf connect). My STM32WB board gets connected with the app, but the data is not transmitted. When I give functions in the main while loop for transmitting, it stop the device advertisement at mobile app. How to transfer the data to mobile app? I need to send continuous sensor data to mobile app.
I've also tested timer function as well. But still, it's impossible for me to transfer the data. 

I'm attaching the image of mobile app connection, there you can see that the value is 0. There, I need sensor data to be printed.
Can anyone help me to resolve this issue? Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @barathi_0206 

I suggest you to take a look at this application and compare it to your configuration. It should be really helpful.

Dont forget to read the readme file of this project and take a look at the wiki pages mentionned there. It should be helpful too.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

9 REPLIES 9
STTwo-32
ST Employee

Hello @barathi_0206 

I suggest you to take a look at this application and compare it to your configuration. It should be really helpful.

Dont forget to read the readme file of this project and take a look at the wiki pages mentionned there. It should be helpful too.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thankyou @STTwo-32! It works. However it works for static continuous data. But with varying data (like from sensors), it doesn't receive it. In mobile app I receive data like 2E-16-00-00-00. I have also increased my UUID type into 128 bits. Still it receive like this. How to solve it?

 

Hii Barathi_0206,
i am new with BLE can you help me with steps in stm32cube ide how to transmit and receive data through BLE,

 

barathi_0206
Associate II

Hi @mihirsinha_ 

You can go through this wiki link for better understanding and practice this procedures. let me know if you need help at any particular areas.

Thank you, Barathi_0206.
This will help me a lot. Actually, I already generated the code by following some tutorials, and I can see my device name on my mobile. But I want to send some data as well. Can you help me with the code where and what should I write to continuously send data like "Hello, World" for now?

barathi_0206
Associate II

Try this for sending data via BLE to mobile app.

Hi Barathi_0206,
Thanks for this tutorial — it's working!

Actually, what I'm working on involves using multiple ADCs with my mcu stm32wb55cgu6. Earlier, I was printing the data to the serial monitor via USB. Now, I want to use BLE instead of serial print. In main.c, I have done some calculations and all the initialization steps.

After using this tutorial, I saw that data is sent using a button press. But when I try to send the data directly from the main function, either it goes to the" void HardFault_Handler()" or the value is not advertised.

barathi_0206
Associate II

Yes, I’ve faced this issue too. To resolve it, you should use a timer to handle your ADC readings. For continuous data transmission over BLE, go to custom_app.c and locate the Custom_YourCharacteristicName_Update_Char() function. This is where the BLE data gets updated.

Inside this function, you’ll find a line responsible for updating the characteristic value—comment that line out. Instead, move that line into your timer callback function. Then, simply call the timer callback from within the update function.

This approach worked for me, and I hope it helps you too!

Thank you Barathi_0206,
it is working.
Will you help me with one more doubt? I also want to send commands through my mobile. Can you tell me where and how to store that command in a variable.