2023-09-09 04:14 AM
Hello,
I'm pretty new in working with STM32WB-Chips and trying to implement a BLE-Application.
I am using a STM32WB55 Chip and for initial steps I created a project using Cube IDE and a Custom Template according to ST's "Getting Started" - Series on YouTube (https://www.youtube.com/watch?v=CKYWy7LKL68&list=PLnMKNibPkDnG9JRe2fbOOpVpWY7E4WbJ-&index=16).
This works in general and I can read and write characteristics using the BLE Toolbox App on my smartphone.
Now I want to update a characteristic value from my main-function, e.g. to distribute new sensor data via BLE.
I added the needed header files in my main and try to call the functions
Custom_STM_App_Update_Char() or aci_gatt_update_char_value().The compiler gives me no warnings or errors, but calling this functions in the main loop leads to a HardFault during runtime.
Stepping into showed that the HardFault occurs after calling the static void SendCmd()-function probably.
Calling this functions from custom_stm.c works fine, e.g. if I am calling it in an Event_Handler after a read access there. So probably some parameters in my main.c are missing.
Problably I am just doing something stupidly wrong and don't get it. So how can i easilly update a characteristic value from a main function if new data is available?
Many thanks in advance :)
Solved! Go to Solution.
2023-09-09 04:40 AM
Hello @werner_f
The easiest way is to replace the message that the program is already sending by the data you want to send. By :
Best regards .
II
2023-09-09 04:40 AM
Hello @werner_f
The easiest way is to replace the message that the program is already sending by the data you want to send. By :
Best regards .
II
2023-09-09 06:00 AM
Thank you, like this I can now transfer my own data using the BLE stack.
But I want to run my code in server mode and want to send a notification to the client(smartphone) everytime new data occurs. How can I trigger this event from my main code? Just updating the buffer seems not to be enough.
Right now, I am calling the update_char() function in my ble_app.c everytime an event occurcs, i.e. if the client reads a characteristic it is getting updated. This works fine. But I want to notify the client that new data is available without the client asking for it.
2023-09-09 06:14 AM
Hello again @werner_f
Happy to now about your progress.
I suggest you to close this post by choosing a best answer and ask your second question in a new post to give it more visibility. Personally, I'm not understanding your new request.
Best regards.
II
2023-09-09 06:31 AM
Okay, I'll try to ask more precisely in another thread. Many thanks for your help.