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.
https://jimmywongiot.com/2021/05/26/asking-for-support/

hello
What soft device did you used?
LikeLike
the example is based on the S132v5.1
LikeLike
Hello
What development board did you used to test it?
Nordic is stating on their website that for NRF52805 / nRF52810 they provide only peripheral role softdevice.
I see that you’re using pca10040e which is nRF52810, not nRF52805
LikeLike
This is just proof of concept. I don’t provide any guarantee on such all the demo.
LikeLike
Yes, sure I understand and I appreciate your good work and willlingness to share; many thanks for that.
For me it just was not clear wether you tried this for nRF52810 or nRF52805. I want to try this too, but on nRF52805 and that it is why I asked.
LikeLike
Thanks for your interests on my blog. You can give me a like or support !!
LikeLike
Hi Jimmy, nice to meet you here. I am doing a similar project for multiple peripherals to one central based on NUS service. Can I follow your code on NRF52840 with S140v17.02? Thanks.
LikeLike
Yes, you can try at your side. you can use the S140v17.02 to do the same things on the nRF52840.
LikeLike
Thank you Jimmy. Your example code is very helpful for my project. My project is to set up multiple peripherals to one cental via the NUS service system. How can I get data from the peripherals individually? Do I need to add a timer in the cental to scan and transfer data between every peripheral? Thanks.
LikeLike
You can contact me through the email.
LikeLike