This blog is to give the idea how to create the multiple role (central x 2 , peripheral x 2) on the Nordic nRF52805 chipset. All the idea should be based on the Nordic Softdevice framework nRF5 SDK.
Follow up the blog (https://jimmywongiot.com/2021/05/23/non-secure-bootloader-on-nrf52810/), if you need to support the bootloader feature on the nRF52805/58210 series, you can use the non-secure bootloader which is removed the code of the secure routine.
Then, if you would like to run the BLE multiple role on the smallest chipset such as nRF52805, what should you do?
Here are some hints that you can take into consideration.
- Use the default MTU 23 instead of the long MTU in order to save the memory (RAM) usage.
- Minimize the GATT server table and client as small as possible. For example you can use the Nordic UART Service (1 characteristic for TX and 1 characteristic for RX).
- Don’t use any bonding / security feature. It means that you don’t need to reserve 2 pages (2 x 4 KB) for the FDS. 1 Page for the bonding application and 1 page for the swap region.
- Try to call the softdevice API directly instead of using the BLE module such as ble_advertising, ble_gatts because the module from the ble in Nordic SDK.
- Select the minimum size of the multiple role BLE softdevice which can support. Then, it is better to use the SDK 14.2 / S132v5.1 softdevice (which is BT 5.0 compliance). The size of the S132v5.1 is 140KB.
- Remove all the unused module inside the SDK such as app_schedule, app_timer (replace by app_timer2).
- Reduce the number of GATT Client / service inside the ble_discovery module.
How to set the advertising payload instead of using the ble_advertising module
You can refer to the source code from the bootloader. It directly sets the parameter on the advertising payload.
Select the minimum GATT Server table example such as Nordic Uart Service (ble_app_uart)
Configure the ATT table on the RAM (fine tune the parameters in the sdk_config.h)
The default size of the ATT table is 0x580. (1408 bytes)
Configure the Vendor Specific UUID to 1 because only use 1 TX and 1 RX (same vendor base UUID).
Use the app_button instead of bsp driver
Optimize the BLE GATT client service number
Optimize the linking / compile and disable all the nRF log configuration / Remove the RTT routine
If you follow all my suggestion, you should get the optimize source code which is similar to my project.
Number of Peripheral role = 2
Number of Central Role = 3
The size of the application region (flash) is 192KB – 155.3KB = 36.7KB
The size of the application region (RAM) is 24KB – 17.5KB (including the call stack) = 6.5KB
Welcome to give any comment and suggestion on this blog.
Thanks for your interests on my blog. Since 2019, I have created this blog and shared the idea how to do some funny stuffs. I am very pleasure that I get quite a lot of positive feedback. I really hope that this blog helps your own embedded solution development. May I get support from you to keep it in order to maintain the wordpress host service? Your appreciation would be very helpful.