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

Free memory on nRF52840

I'm having a problem with using all the memory in the nRF52 Thead SDK 0.10.0. Namely, even if I run one of the smallest examples (e.g. aes one from crypto examples) the flash size usage is very low (about 0x9000), BSS ram is also low (according to the linker map output about 2 kilobytes).

But when I want to allocate some static memory (e.g. static uint8_t buf[ 1024 * 100 ], the code links properly, but after execution I see no logs. I'm not sure if the cpu is dead, or just logging stops to work. If I use smaller array (e.g. 50k), it works.

If I understand correctly, BSS are located at the beginning of ram (0x20000000), stack is going down from RAM end (0x20040000), and anything in between should be unused. So, I should be able to extend BSS by 100kb, provided that I don't use stack so much to override that. My stack is virtually empty - just main() and logging.

Interestingly the FreeRTOS examples seem to be tuned to the stable value. Like, FreeRTOS has its own heap in bss section, and it is set to 14kb in the SDK. Setting it to larger value like, 18kb, crashes CPU - even if there should be ~190kb of free memory (running FreeRTOS+OpenThread).

Any ideas why that happens?

Parents
  • Hello Nopik,

    Thanks for using nRF5 SDK for Thread!

    The command that you have executed: JLinkExe -if swd -speed 4000 -device NRF52832_XXAA -autoconnect 1 uses config of NRF52832 which has 64kB of RAM.

    Because of that, JLink software try to find _SEGGER_RTT in flash range of this device (0-64kB). Since NRF52840 device has more RAM, depending of where _SEGGER_RTT is placed in memory layout, you may be not able to see RTT logs.

    Solution: Update JLink software to the newest version and use NRF52840_XXAA device, which effectively increase the memory range within which Jlink looks for _SEGGER_RTT structure.

  • Thanks for the answer! Indeed, using the correct device type solves the problem, too. I used ..32 because it was always a default for JLink and completely forgot about it.

Reply Children
No Data
Related