2024-01-11 05:38 AM
Hello,
I'm using BLE_p2pClient and BLE_p2pServer programs.
I had pairing request in BLE_p2pClient to have both devices bonded.
Now, I want to have a fast connection between client and server; actually, the connection between client and server is about 2.5 seconds.
I should like not to have to discover again and again services and characteristics of the server by the client at each re-connection. Only once when the program starts.
How to do that?
Have you documentation descriving this? (I have only found PM0271 §5.1.2).
I have activated the SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_USED in CFG_BLE_OPTIONS to initialize the BLE stack. But it is not sufficent!
Thank you for your help.
Best regards.
FWX.
Solved! Go to Solution.
2024-01-16 05:48 AM
Hi,
I have solved this problem by copying IRAM1/IRAM2 characteristics from:
- BLE_p2pClient_Ext to my BLE_p2pClient project
- BLE_p2pServer_Ext to my BLE_p2pServer_ota
And I have modified each scatter file from each model.
Now, each application seems running on STM32WB55 board.
I continue to test the GATT Caching...
Best regards,
FWX.
2024-01-12 06:06 AM
Hi FWX,
To avoid discovering every time services and characteristics, there are two methods to notify peer devices about the change:
Service Change Indication only works if the peer devices are bonded.
GATT Caching feature overcome the bonding problem. Using GATT caching, every device can make sure that it has stored the latest version of the GATT database structure.
This is achieved by:
To implement it :
Server side :
Use SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_USED to configure CFG_BLE_OPTIONS in app_conf.h
NB : This feature is available only in "full extended" BLE stack and certified in STM32Cube v1.16 MCU package or later.
Client side :
Read the Database Hash characteristic upon each connection and compare its value with the last stored value.
If the values match, it is safe to use stored characteristic handles.
If they do not match, start a service discovery to discover characteristic handles.
Enable Robust Caching by writing to the Client Supported Features characteristic of the server.
You will also need to check for database out-of-sync error after each GATT operation.
I hope this information will help you. If you need more information regarding Database Hash/Client Supported Feature characteristic or Database out-of-sync error code, do not hesitate to come back to me.
BR, Joé
2024-01-12 06:18 AM
Hi Joé,
Thank you very much for your detailed answer.
I'm going to add code as described and test that.
Best regards,
FWX.
2024-01-15 07:11 AM
Hi Joé,
I have begun to modify the BLE_p2pServer and BLE_p2pClient programs to follow your indications.
But I encounter another problem.
You wrote that this feature is available only in "full extended" BLE stack. I want to use the last firmware stm32wb5x_BLE_Stack_full_extended_fw.bin from STM32Cube_FW_WB_V1.18.0.
But I need to follow this:
My question is how to modify the two projects to use this firmware. I'm developping with Keil5.
I have tried to change the options of the target "Read/Write memory areas" with:
- IRAM1 Start: 0x20000008 Size: 0x2FC00
-IRAM2 Start: 0x20030000 Size: 0x20030000
but the application do not run. I suppose there something else to change, but what?
Thank you for your help.
Best regards,
FWX.
2024-01-16 05:48 AM
Hi,
I have solved this problem by copying IRAM1/IRAM2 characteristics from:
- BLE_p2pClient_Ext to my BLE_p2pClient project
- BLE_p2pServer_Ext to my BLE_p2pServer_ota
And I have modified each scatter file from each model.
Now, each application seems running on STM32WB55 board.
I continue to test the GATT Caching...
Best regards,
FWX.
2024-01-16 07:29 AM
Hi Joé,
Could you explain me that:
"Enable Robust Caching by writing to the Client Supported Features characteristic of the server."
How to do that? Because I do not find aci_gatt_write_using_char_uuid() function, for example.
Do I need to enable the Robust Caching after each connection? Or juste after call to aci_gatt_store_db() and paire_request?
Thank you for help.
Best regards,
FWX.