2025-12-15 7:54 AM - edited 2025-12-15 7:59 AM
Hello Community,
I have been working on a BLE project in which the server needs to send notification of a characteristics that is up to 512 bytes long. As in previous CubeMX versions (6.12 and before), I was expecting CubeMX to generate the function Custom_<CHAR_NAME>_Send_Notification() within custom_app.c to properly call aci_gatt_update_char_value_ext(), which indeed supports chars up to 512 (see code below).
However, this is no longer the case from Ver. 6.13 onwards. Instead, CubeMX now generates only functions based on aci_gatt_update_char_value(), which handles lengths lesser than the limit (BLE_CMD_MAX_PARAM_LEN - 6), which is 243 maximum. Needless to say, my project no longer works without the proper notification function.
ST Support said that the latest CubeMX behavior is "normal", but it did not explain why the code generation was changed, and most importantly how to handle long characteristics in the latest examples and documentation.
Has anyone noticed this and could share a potential solution, other than re-coding the function manually? Thanks!
void Custom_CHAR_Send_Notification(void) /* Property Notification */
{
uint8_t updateflag = 0;
/* USER CODE BEGIN Data_NS_1*/
updateflag = Custom_App_Context.Data_Notification_Status;
/* USER CODE END Data_NS_1*/
if (updateflag != 0)
{
Custom_STM_App_Update_Char_Ext(Connection_Handle, CUSTOM_STM_CHAR, (uint8_t *)NotifyCharData);
}
/* USER CODE BEGIN Data_NS_Last*/
/* USER CODE END Data_NS_Last*/
return;
}