cancel
Showing results for 
Search instead for 
Did you mean: 

BLE questions related to WB55

ABN
Associate III

Hello,

The objective of the project is to develop a BLE custom server profile and I need some clarifications.

  1. The maximum number of characters AD_TYPE_COMPLETE_LOCAL_NAME_LENGTH for the complete name for advertisement is restricted to 11. Is there any way that the developer can change the number to support more than 11 characters?
  2. The maximum number of characteristics for a given service is restricted to 5. I browsed through some of the community posts and got to know that I can add more characteristics with the help of 'aci_gatt_add_char()' function. But while doing this the function is returning the error code 0x48(attaching the debug photo). What is the meaning of this error code?
  3. When the services get initialized, there is a parameter 'Max_Attribute_Records' which is sent as an argument for the service. Is there any way that the developer can change this number so that the above mentioned point number 2 can be achieved?
  4. The project has also requirement to add RTOS middleware. When I enable the RTOS, the custom server template is not available. Only the SIG HeartRate profile is provided for the user. Is there a way to have Custom server template along with the RTOS. (attaching the snapshots from the CubeIDE)

0693W00000WJywBQAT.png0693W00000WJJcUQAX.png

5 REPLIES 5
Ugilten
Associate III

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.

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:

ABN
Associate III

@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?

Remy ISSALYS
ST Employee

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

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?