This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Migrating to SDK17.0.2 gives Memory issue in NRF52840 development kit.

Hi,

 I am migrating my project from SDK15 to SDK 17.0.2. I am using NRF52840 development kit and using s140 softdevice for bluetooth services. When I load the softdevice hex file and later load the Firmware hex file, I am getting memory error as follows:- 

<warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
<warning> nrf_sdh_ble: Change the RAM start location from 0x20002220 to 0x20002B 88.
<warning> nrf_sdh_ble: Maximum RAM size for application is 0x3D478.
<error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
<error> app: ERROR 4 [NRF_ERROR_NO_MEM] at ..//ble/ble_app.c:369

How to solve this error??

The code was working fine with sdk15 version. My linker file has this configuration..

MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
RAM (rwx) : ORIGIN = 0x20002220, LENGTH = 0xDDE0
}

Parents
  • Hello,

    I am getting memory error as follows:- 

    <warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
    <warning> nrf_sdh_ble: Change the RAM start location from 0x20002220 to 0x20002B 88.
    <warning> nrf_sdh_ble: Maximum RAM size for application is 0x3D478.
    <error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at ..//ble/ble_app.c:369

    Please try to change the RAM start location from 0x20002220 to 0x20002B88, as suggested by the warning.
    In SES, you can find the Section Placement Macros in the Linker tab of the Project Options. Please make sure to have selected the Common configuration, like shown in the included image:
      
    Do this, and let me know if it resolves your issue.

    Best regards,
    Karl

  • Hi Karl.

    Thank you for the reply. I am not using ses compiler. I have one linker file in which I do the memory configurations and compile the code on linux environment. I changed the linker file RAM memory address as you suggested. Changed it like this:-

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
    RAM (rwx) : ORIGIN = 0x20002B88, LENGTH = 0xDDE0
    }

    but then it gives me error and suggest me to change 0x20002B88 to 0x20002B98. I later changed it to 0x20002B98 also

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
    RAM (rwx) : ORIGIN = , LENGTH = 0xDDE0
    }

    but then when I load the file, log disappears and nothing works. Not even error is shown on the teraterm.

    Heres my linker file.

    /* Linker script to configure memory regions. */
    
    SEARCH_DIR(.)
    GROUP(-lgcc -lc -lnosys)
    
    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
      RAM (rwx) :  ORIGIN = 0x20002B98, LENGTH = 0xDDE0
    }
    
    SECTIONS
    {
    }
    
    SECTIONS
    {
      . = ALIGN(4);
      .mem_section_dummy_ram :
      {
      }
      .log_dynamic_data :
      {
        PROVIDE(__start_log_dynamic_data = .);
        KEEP(*(SORT(.log_dynamic_data*)))
        PROVIDE(__stop_log_dynamic_data = .);
      } > RAM
      .fs_data :
      {
        PROVIDE(__start_fs_data = .);
        KEEP(*(.fs_data))
        PROVIDE(__stop_fs_data = .);
      } > RAM
      .cli_sorted_cmd_ptrs :
      {
        PROVIDE(__start_cli_sorted_cmd_ptrs = .);
        KEEP(*(.cli_sorted_cmd_ptrs))
        PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
      } > RAM
    
    } INSERT AFTER .data;
    
    SECTIONS
    {
      .mem_section_dummy_rom :
      {
      }
      .sdh_soc_observers :
      {
        PROVIDE(__start_sdh_soc_observers = .);
        KEEP(*(SORT(.sdh_soc_observers*)))
        PROVIDE(__stop_sdh_soc_observers = .);
      } > FLASH
      .pwr_mgmt_data :
      {
        PROVIDE(__start_pwr_mgmt_data = .);
        KEEP(*(SORT(.pwr_mgmt_data*)))
        PROVIDE(__stop_pwr_mgmt_data = .);
      } > FLASH
      .sdh_ble_observers :
      {
        PROVIDE(__start_sdh_ble_observers = .);
        KEEP(*(SORT(.sdh_ble_observers*)))
        PROVIDE(__stop_sdh_ble_observers = .);
      } > FLASH
      .log_const_data :
      {
        PROVIDE(__start_log_const_data = .);
        KEEP(*(SORT(.log_const_data*)))
        PROVIDE(__stop_log_const_data = .);
      } > FLASH
        .nrf_balloc :
      {
        PROVIDE(__start_nrf_balloc = .);
        KEEP(*(.nrf_balloc))
        PROVIDE(__stop_nrf_balloc = .);
      } > FLASH
      .sdh_state_observers :
      {
        PROVIDE(__start_sdh_state_observers = .);
        KEEP(*(SORT(.sdh_state_observers*)))
        PROVIDE(__stop_sdh_state_observers = .);
      } > FLASH
      .sdh_stack_observers :
      {
        PROVIDE(__start_sdh_stack_observers = .);
        KEEP(*(SORT(.sdh_stack_observers*)))
        PROVIDE(__stop_sdh_stack_observers = .);
      } > FLASH
      .sdh_req_observers :
      {
        PROVIDE(__start_sdh_req_observers = .);
        KEEP(*(SORT(.sdh_req_observers*)))
        PROVIDE(__stop_sdh_req_observers = .);
      } > FLASH
        .nrf_queue :
      {
        PROVIDE(__start_nrf_queue = .);
        KEEP(*(.nrf_queue))
        PROVIDE(__stop_nrf_queue = .);
      } > FLASH
        .cli_command :
      {
        PROVIDE(__start_cli_command = .);
        KEEP(*(.cli_command))
        PROVIDE(__stop_cli_command = .);
      } > FLASH
      .crypto_data :
      {
        PROVIDE(__start_crypto_data = .);
        KEEP(*(SORT(.crypto_data*)))
        PROVIDE(__stop_crypto_data = .);
      } > FLASH
    
    } INSERT AFTER .text
    
    INCLUDE "nrf_common.ld"
    

  • Hello Snehal,

    Thank you for your patience.

    sne_333 said:
    I am not using ses compiler.

    Could you elaborate what toolchain you are using? 

    sne_333 said:
    but then when I load the file, log disappears and nothing works. Not even error is shown on the teraterm.

    I it is a good sign that the space warning and error no longer shows - it indicate that this particular issue is resolved. So, we may then move on to general debugging of the application.
    Could you confirm that you are able to successfully flash the firmware? What does your log say when you flash the device? Could you step through your code, to find out where it stops working?

    Best regards,
    Karl

Reply
  • Hello Snehal,

    Thank you for your patience.

    sne_333 said:
    I am not using ses compiler.

    Could you elaborate what toolchain you are using? 

    sne_333 said:
    but then when I load the file, log disappears and nothing works. Not even error is shown on the teraterm.

    I it is a good sign that the space warning and error no longer shows - it indicate that this particular issue is resolved. So, we may then move on to general debugging of the application.
    Could you confirm that you are able to successfully flash the firmware? What does your log say when you flash the device? Could you step through your code, to find out where it stops working?

    Best regards,
    Karl

Children
  • Hello Karl,

               Thank you for the reply. The code works with sdk version 15. now we are migrating to 17.0.2.Did all the changes necessary for migration and compiled the code successfully.  I am compiling the code on linux platform using "make" commands and uploading the firmware through NRF connect. I am actually new to nrf52 devices. I will tell you what errors I got in the flow:- 

    Configurations and error msgs:-

    1) got overlapping error in 1st setting.

      FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000 overlapping error in nrf connect
      RAM (rwx) :  ORIGIN = 0x20002220, LENGTH = 0xDDE0

    2) changed address to remove overlap error

     FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xD9000 <warning> nrf_sdh_ble: Change the RAM start location from 0x20002220 to 0x20002BF0.
      RAM (rwx) :  ORIGIN = 0x20002220, LENGTH = 0xDDE0 <warning> nrf_sdh_ble: Maximum RAM size for application is 0x3D410.

    3) changed address as suggested, got no log on teraterm

     FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xD9000 no error on teraterm
      RAM (rwx) :  ORIGIN = 0x20002BF0, LENGTH = 0x3D410

    4)changed address again, got no log on teraterm

     FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xD9000 no error on teraterm
      RAM (rwx) :  ORIGIN = 0x20002BF0, LENGTH = 0xDDE0

    In my sdk config file NRF log is enabled, RTT is also enabled but still I am not able to see any logs in console.I dont know how to debug in linux environment when logs are not visible. It seems it is getting stuck somewhere. I have attached my sdk config file. Your help is appreciated. 

    sdk_config.h.txt 

    Thanks & Regards,

    Snehal.

  • Hello Snehal,

    Thank you for your patience.

    sne_333 said:
    The code works with sdk version 15. now we are migrating to 17.0.2.Did all the changes necessary for migration and compiled the code successfully.

    Could you confirm for me that you have also updated the S140 SoftDevice version you are working with, to be compatible with the nRF5 SDK v17.0.2?

    sne_333 said:
    4)changed address again, got no log on teraterm

    Could you elaborate why you made the change from 3) to 4)?

    sne_333 said:
    RTT is also enabled but still I am not able to see any logs in console.

    I see that you have both the UART and RTT backend enabled in your sdk_config.h file. Please define NRF_LOG_BACKEND_UART_ENABLED 0. I would think this causes an error when you try to initialize the logger.
    How are you reading your RTT output, by the way - are you using the SES debug terminal or the standalone Segger RTT Viewer application?

    Please do this, and let me know if you then are able to see your logs again.

    Best regards,
    Karl

  • Hi Karl,

               I have solved the issue Karl :D 

    I adjusted the memory config and did some changes in sdk_config.h. I guess the problem was solved in step 3,4 but because of wrong configuration in sdk_config.h, logs were not seen on RTT viewer.

    This is my memory configuration:-

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xD9000
    RAM (rwx) : ORIGIN = 0x20002BF0, LENGTH = 0x3D410
    }

    Though i dont understand what was blocking the logs.

  • sne_333 said:
    I have solved the issue Karl :D 

    Fantastic, I am happy to hear that Snehal :D 
    Well done!

    sne_333 said:
    I guess the problem was solved in step 3,4 but because of wrong configuration in sdk_config.h, logs were not seen on RTT viewer.
    sne_333 said:
    Though i dont understand what was blocking the logs.

    Did you do the disabling of logger UART backend, like I suggested in my previous comment? 

    sne_333 said:

    This is my memory configuration:-

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xD9000
    RAM (rwx) : ORIGIN = 0x20002BF0, LENGTH = 0x3D410
    }

    Thank you for sharing what the final memory configuration should be.

    Best regards,
    Karl 

Related