cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 - Where the value is stored?

SikandarLF
Associate III

I have stm32wb55 , i have created a service using stm32cubeIDE, in that i have like 3 characteristics  1:: myChar, 2: mynotify and 3: mywrite,, ( mynotify has nothing to do with this problem). mychar is used to read the value only and mywrite is set to read and write the value, so in my st tools app if i try to update the value of mychar using this command, it does update the value    (  Custom_STM_App_Update_Char(CUSTOM_STM_MYCHAR, (uint8_t *)UpdateCharData);

SikandarLF_0-1697705560484.png

 

BUT

 

If i try to write the value for MYWRITE in the app, it does write the value and read exactly the same, but i dont know where the value is stored in the program,   i have tried to get value from a instance like (CUSTOM_STM_MYWRITE)   it does have some value but its not what i have written in the app. 

i have tried this command as well    (   Custom_STM_App_Update_Char(CUSTOM_STM_MYWRITE,CUSTOM_STM_MYCHAR);

to get the MYCHAR value in MYWRITE but as there is already a random value sitting there so its not working. 

 

all of these things are from ( ''CUSTOM_APP.C'')

All i want is get my mywrite value from the app to the program and do some maths.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks for you reply , I got it figured it out with help of Alan from ST , so like if we send some data from app  then its stored in  #####

attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data;

if (attribute_modified->Attr_Handle == (CustomContext.CustomMycharHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))

{

return_value = SVCCTL_EvtAckFlowEnable;

/* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */

Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length;

Notification.DataTransfered.pPayload=attribute_modified->Attr_Data;

USERMODEVALUE =( attribute_modified->Attr_Data[0]<<8) + (attribute_modified->Attr_Data[1]<<0);

Notification.Custom_Evt_Opcode = CUSTOM_STM_MYCHAR_WRITE_EVT;

Custom_STM_App_Notification(&Notification);######

 

Custom_stm.c

 

 

View solution in original post

2 REPLIES 2
_Joe_
ST Employee

Hi SikandarLF,

In the STM32Cube MCU Package for STM32WB series, you can find an application called BLE_Custom at :
Firmware\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\BLE_Custom. 

This application includes the HeartRate and p2pServer services. You can take inspiration from the p2pServer implementation, which, like yours, uses a read and write characteristic.
 

To test the application, you need to write the values 0x0001 and then 0x0000 to this characteristic to turn the LED on and off. It is important to check the "HEX" checkbox beforehand.
 

By taking inspiration from this implementation, you should be able to solve your problem.
 

I hope this helps! Don't hesitate to get back to me if you need more information.

Best regards, Joé

Thanks for you reply , I got it figured it out with help of Alan from ST , so like if we send some data from app  then its stored in  #####

attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data;

if (attribute_modified->Attr_Handle == (CustomContext.CustomMycharHdle + CHARACTERISTIC_VALUE_ATTRIBUTE_OFFSET))

{

return_value = SVCCTL_EvtAckFlowEnable;

/* USER CODE BEGIN CUSTOM_STM_Service_1_Char_1_ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE */

Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length;

Notification.DataTransfered.pPayload=attribute_modified->Attr_Data;

USERMODEVALUE =( attribute_modified->Attr_Data[0]<<8) + (attribute_modified->Attr_Data[1]<<0);

Notification.Custom_Evt_Opcode = CUSTOM_STM_MYCHAR_WRITE_EVT;

Custom_STM_App_Notification(&Notification);######

 

Custom_stm.c