high RAM consumption for a BLE app

Hi all!

I have created a simple application that only turns on a led and power it off using BLE in NRF52810. The thing is that simple app uses a huge RAM (~85%) and flash. There is a way to reduce the consumption of RAM? I have seen a post were configuring some parameters to reduce the consumption, I have tried it, but it led to some errors when using BLE.

Best regards

  • Hi,

    NRF52810 have only 24kB RAM. So, for BLE S112 stack needs 3.7kB. so about 20 kB should be available for your application (free 85%).

    Further, if you use Segger, then the size of the stacks (main and process) and heap area is also indicated in the project settings. I don’t know how many you have indicated, I had these values ​​at the level of 2kB each. 

    And then you need to look at what kind of code in general you are trying to compile, what is connected and what is being used.

    For a more precise answer, indicate which SDK you are using, which stack, and also, if possible, show the code. Then the answer will be more informative.

    Regards, Max

  • Hi Max,

    Thanks for the answer. I've forgot to indicate the SDK, I'm using zephyr and with the example project of BLE with the function for turn on a LED. Using that, the value of RAM used is very high.

    Best regards

  • unfortunately I can't help here. I tried to build a project (NCS 2.0.0, peripheral_lbs) for 52810, but I get an error: flash memory overflow. 
    Here is discussed a similar problem, read the branch to the end.

  • Hi

    For our SoCs that are on the lower end in terms of RAM and Flash memory, it's strongly recommended to build them with the minimal build variant overlay config. You can see how to do so in the "Activating sample extensions" or make your own "minimal" config file based on the prj_minimal.conf file. The projects in NCS should build for the nRF52810 as well with the minimal configs set.

    As CheMax says, the nRF52810 only has 24kB RAM, so there won't be too much left with the Zephyr or SoftDevice controller as well as a BLE application on top, but you can use the Memory Report in our VS Code nRF Connect extension to see what files, etc. is taking up most of your RAM and/or ROM.

    Best regards,

    Simon

  • Hi Sominr,

    I'll have a look at it. So the best way can be use the nrf SDK instead of using zephyr?

    Also for CheMax, I use the project peripheral_lbs and compile for the nrf52dk_nrf52810 without problems but this is the RAM/FLASH consumption of that project:

    [225/225] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      173960 B       192 KB     88.48%
                SRAM:       24073 B        24 KB     97.95%
            IDT_LIST:          0 GB         2 KB      0.00%

    Best regards

Related