cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 Cube MX 5.6 Generated Code Errors

BPaik
Senior

When using the Custom Template option in Cube MX 5.6 for the WB55, the generated "custom_stm.c" file contains some bugs in the "Custom_STM_App_Update_Char" function. Namely, the calls to "aci_gatt_update_char_value" mistakenly pass the characteristic handles twice rather than first passing the service handle and corresponding characteristic handle. I'm hoping this will be fixed in the next update to Cube MX.

Additionally, I would have expected Cube MX to generate code for the cases in the "Custom_STM_Event_Handler" function. I filled the code out for the "EVT_BLUE_GATT_ATTRIBUTE_MODIFIED" case on the material from the WB workshop video (part 4) which seems to work, but it seemed fairly standard to me so I was wondering if it could just be generated by Cube MX in the future.

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

​Hello @BPaik​ ,

You're right, issue in aci_gatt_update_char_value already detected and it will be fixed .

Thanks for your feedback.

Khouloud

View solution in original post

5 REPLIES 5
Khouloud ZEMMELI
ST Employee

​Hello @BPaik​ ,

You're right, issue in aci_gatt_update_char_value already detected and it will be fixed .

Thanks for your feedback.

Khouloud

Thanks for your response. As for my other question regarding the "Custom_STM_Event_Handler" function in "custom_stm.c", would it be possible to auto generate some default code in the "EVT_BLUE_GATT_ATTRIBUTE_MODIFIED" case? The user-defined bluetooth routines seem to be expected to be called from here, but nothing is generated by Cube MX. I was able to figure out what to write in this case statement by referencing example code, but even so it isn't clear to me what exactly is going on (especially with the attribute handles and their offsets). I'm concerned that I may have trouble adding to or modifying this code if I were to update my services/characteristics. Thus, it would be very useful if Cube MX added default code here based on how I define my services and characteristics.

TPunt.1
Associate II

Hi,

I'm really having a hard time trying to file this case EVT_BLUE_GATT_ATTRIBUTE_MODIFIED...

is there any tutorial somewhere ? or do we have to alter somehow the workshop code ?

Best regards,

Théodore

I followed the tutorial here https://www.youtube.com/watch?v=5Lp9cDBzG94&t=1s

The tutorial doesn't use custom template generation through CubeMX, but using this as a reference, I was able to figure out which files need to be modified after generating CubeMX code. I've attached the .ioc file I used to generate the project. Then I added  UTIL_SEQ_Run(~0);  to main to start the sequencer, I added the otp code from the tutorial to stm32wbxx_hal_msp.c, I added the RTC ISR code from the tutorial to stm32wbxx_it.c (note that the code added to push button ISR is called like this "UTIL_SEQ_SetTask(CFG_TASK_SW1_BUTTON_PUSHED_ID, CFG_SCH_PRIO_0);" in more recent versions of CubeMX as opposed to the way it is done in the tutorial), and lastly I added code to custom_app.c and custom_stm.c as shown in the tutorial.

Thanks @BPaik​

I also try to follow this tutorial, that's the "workshop" i was talking about.

But yes, it seems we have to figure out by ourselves how to this is all working.

Thank you for your file, i'll give it a look.

See you