Article Directory
1 Introduction
nRF52810 supports Bluetooth 5.1 BLE Central and Peripheral protocol stack. The SDK provided by Nordic provides a sample code of how to use BLE Central and Peripheral protocol stack. How to download the SDK can refer to this article: "[Nordic] Official Website Download nRF52810 Related Information"
Below we mainly introduce how to port the BLE Central protocol stack nRF5_SDK_17.0.2_d674dde.zip
on the nRF52810 hardware platform in the official SDK . Therefore, we choose SoftDevice S132 here , why we choose can refer to this article: "Question 4: How to choose SoftDevice version for nRF52810"S132
2. How to port BLE Central to nRF52810
- Refer to the SDK provided by Nordic official website, but the default is nRF52823 platform, we need to migrate to nRF52810 platform, the path is as follows:
PATH:nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_uart_c\pca10040\s132\arm5_no_packs
-
Open the magic wand
options
configuration project
-
Amended
Device
tonRF52810_xxAA
-
The modification is
Target
mainly for the configuration of System Clock, Rom and Ram partitions as follows:- Xtal(MHz): 64.0 // According to nRF52810_xxAA datasheet
- IROM1: 0x26000 ~ (0x26000 + 0xA000) //It
0 ~ 0x26000
is the ROM size occupied by the SoftDevice Bin. The size0xA000
is because nRF52810_xxAA Flash Size is192KB
. - IRAM1: 0x20002A28 ~ (0x20002A28 + 0x35D8) //
0x20000000
is the base address of Ram, and0x2A28
is the RAM size that SoftDevice needs to use,0x35D8
because nRF52810_xxAA RAM Size is24KB
.
Note: If the ROM and RAM settings are wrong, the device cannot start normally, and the following error log may be printed:
Insufficient RAM allocated for the SoftDevice.
Change the RAM start location from 0x200022c8 to 0x20002a28.
Maximum RAM size for application is 0x35d8.
-
Amended
Output
tonrf52810_xxaa
-
Modify the
C/C++
related macro definition: the
default macro definition is:
APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED BOARD_PCA10040 CONFIG_GPIO_AS_PINRESET FLOAT_ABI_HARD NRF52 NRF52832_XXAA NRF52_PAN_74 NRF_SD_BLE_API_VERSION=7 S132 SOFTDEVICE_PRESENT __HEAP_SIZE=8192 __STACK_SIZE=8192
modified to:
APP_TIMER_V2 APP_TIMER_V2_RTC1_ENABLED BOARD_PCA10040 CONFIG_GPIO_AS_PINRESET FLOAT_ABI_HARD NRF52810_XXAA NRF52_PAN_74 NRF_SD_BLE_API_VERSION=7 S132 SOFTDEVICE_PRESENT __HEAP_SIZE=4096 __STACK_SIZE=4096
-
The modification
Debug
tool isJLink
-
Amended
Project Target
tonrf52810_xxaa
-
Compile the project
3. Burn verification
4. Relevant errors in the migration process
- Error 1:
.\_build\nrf52810_xxaa.axf: Error: L6200E: Symbol UARTE0_UART0_IRQHandler multiply defined (by nrfx_uarte.o and nrfx_uart.o).
Solution:#ifndef NRFX_PRS_BOX_2_ENABLED #define NRFX_PRS_BOX_2_ENABLED 1 #endif
- Error 2:
.\_build\nrf52810_xxaa.axf: Error: L6406E: No space in execution regions with .ANY selector matching nrf_log_backend_rtt.o(.data).
.\_build\nrf52810_xxaa.axf: Error: L6406E: No space in execution regions with .ANY selector matching nrf_sdh_ble.o(.data).
.\_build\nrf52810_xxaa.axf: Error: L6407E: Sections of aggregate size 0x84 bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list the image map.
Solution:
Because RAM memory is not enough, itSoftDevice S132
takes up a lot, so Application needs to reduce the use of RAM. My temporary approach here is to shield the log printinglog_init();
, as follows:int main(void) { // Initialize. //log_init(); // 由于RAM内存不够,暂时屏蔽 timer_init(); uart_init(); buttons_leds_init(); db_discovery_init(); power_management_init(); ble_stack_init(); gatt_init(); nus_c_init(); scan_init(); ... }
5. Related articles
1. "[Nordic] Frequently Asked Questions about Using nRF52810"
2. "[Nordic] Official Website Download nRF52810 Related Information"