2022-12-01 04:38 AM
Hello,
The objective of the project is to develop a BLE custom server profile and I need some clarifications.
2022-12-18 11:47 PM
Hi, I can't help you with all of your questions, but I have had the same issue with the COMPLETE_LOCAL_NAME.
I think this a a limitation in CubeMX, because it inherits some limits from the P2P example where they use a bunch of advertising data for the MANUFACTURER_SPECIFIC_DATA and thus it is limited to 11 characters.
I found out that you can add your own advertising data by assembling it manually in the Adv_Request(...) function in app_ble.c.
But you can only call aci_gap_update_adv_data(...) once. All successive calls return error != 0 (I don't know what that means either).
I have done it like this
advCnt = 0;
a_AdvData[advCnt++] = 6; //length
a_AdvData[advCnt++] = AD_TYPE_MANUFACTURER_SPECIFIC_DATA;
a_AdvData[advCnt++] = BLE_COMPANY_ID_LSB;
a_AdvData[advCnt++] = BLE_COMPANY_ID_MSB;
a_AdvData[advCnt++] = 0x45;
a_AdvData[advCnt++] = 0x21;
a_AdvData[advCnt++] = 0xAA;
a_AdvData[advCnt++] = 3; //length
a_AdvData[advCnt++] = AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST;
a_AdvData[advCnt++] = (uint8_t)(NOTIFY_SERVICE_UUID & 0x00FF);
a_AdvData[advCnt++] = (uint8_t)((NOTIFY_SERVICE_UUID & 0xFF00) >> 8);
a_AdvData[advCnt++] = DEVICE_NAME_LENGTH + 1;
a_AdvData[advCnt++] = AD_TYPE_COMPLETE_LOCAL_NAME;
memcpy(a_AdvData + advCnt, DEVICE_NAME, DEVICE_NAME_LENGTH);
advCnt += DEVICE_NAME_LENGTH;
ret = aci_gap_update_adv_data(advCnt, a_AdvData);
Note, this gives a total length (advCnt) that is 1 longer than necessary. But without the 0 termination of the COMPLETE_LOCAL_NAME, the aci_gap_update_adv_data(...) function returns an error.
I don't know if this is on purpose, but it does not say anything about it in the documentation.
2022-12-19 12:56 AM
The extra 1 in the length is because the sizeof(DEVICE_NAME) includes the 0 termintation of the string... and the aci_gap_update_adv_data(...) checks the length parameter to the number of bytes written... so this is clearly an operator fault on my part :face_without_mouth:
2022-12-27 03:19 AM
@Ugilten
Thanks for the response. I will try this method and update.
Also can you or anyone help me with the rest of the questions?
2023-01-05 09:07 AM
Hello,
The limitation to 5 characteristics for 1 service comes from STM32CubeMX tool, indeed you can add more characteristics with the aci_gatt_add_char() function, to do this you should increase the Max_Attribute_Records parameter used in aci_gatt_add_service() function. To calculate this parameter follows this formula:
Max_Attribute_Records = 1
+ 2*no_of_char
+ 1*no_of_char_with_notify_or_indicate_property
+ 1*no_of_char_with_broadcast_property
The error code 0x48 means Out of memory.
STM32CubeMX tool supports only the SIG HeartRate profile with the RTOS, to port your project on FreeRTOS, you can look the difference between BLE_HeartRate and BLE_HeartRateFreeRTOS.
Best Regards
2023-07-27 10:23 AM
Remy,
"STM32CubeMX tool supports only the SIG HeartRate profile with the RTOS, to port your project on FreeRTOS, you can look the difference between BLE_HeartRate and BLE_HeartRateFreeRTOS."
Will STM32 configuration custom templates be supported while using FreeRTOS in the near future? What is the major issue with this... it would seem to be a simple coding of adding a new process for each BLE service needed. Or is there something more complicated going on here?