【Nordic】 nRF52810 BLE Central 移植

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.zipon 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

  1. 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

Insert picture description here

  1. Open the magic wand optionsconfiguration project
    Insert picture description here

  2. Amended DevicetonRF52810_xxAA
    Insert picture description here

  3. The modification is Targetmainly 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) //It0 ~ 0x26000is the ROM size occupied by the SoftDevice Bin. The size0xA000is because nRF52810_xxAA Flash Size is192KB.
    • IRAM1: 0x20002A28 ~ (0x20002A28 + 0x35D8) //0x20000000is the base address of Ram, and0x2A28is the RAM size that SoftDevice needs to use,0x35D8because nRF52810_xxAA RAM Size is24KB.
      Insert picture description here

      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.

  4. Amended Outputtonrf52810_xxaa
    Insert picture description here

  5. 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
    Insert picture description here

  6. The modification Debugtool isJLink
    Insert picture description here

  7. Amended Project Targettonrf52810_xxaa
    Insert picture description here

  8. Compile the project
    Insert picture description here
    Insert picture description here

3. Burn verification

Insert picture description here

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 S132takes 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"

Guess you like

Origin blog.csdn.net/ZHONGCAI0901/article/details/111467343