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

RAM related issue / What are the best practices (armgcc, linker) > nRF51 16 kB vs 32 kB

Hello Nordic Team,

I have a question about RAM Related Issue for our program or rather more generally in relation to a board test that we just received and for which, with my astonishment a fairly simple program does not fit in. This PCB is based on chip nRF51822-QFAAH0 - 1534KP (technical spec: 256 kB Flash / 16 kB RAM)

I started to make it simple by inserting a program related to the blinking of a Led: Blinky (nRF5_SDK_12.2.0_f012efa : examples/peripheral/blinky). This works perfectly by taking (pca10040/s132) on the [nRF52 Development Kit]. To stick to this PCB which causing problem at best, I took the (pca10028/s130) Which also works perfectly on [nRF51 Dongle]. (technical spec: nRF51422-QFACAx > 256 kB Flash / 32 kB RAM).

I therefore adapt the connection of the LEDs in the source code to conform to the connection of the LED for my custom circuit. And after compilation and upload with success. The program does not seem to be running! Would be strongly related to the RAM configuration in blinky_gcc_nrf51.ld After several searches, I arrived on this post: devzone.nordicsemi.com/.../

Indeed by taking these settings:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
  RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x1f80
}

It works perfectly! Almost normal this setting being done!

Now regarding the development of our specific program, that I would like to get into this chip in order to test (Which I have for the moment maintained on [nRF52 Development Kit]), and on which I added a lot of brick for a while, and for which I had regarding to the code base I taken in example ANCS, on which I was recommended To increase the RAM by this message that was displayed to me in the Segger RTT Debugger Log, suggested me to increase the RAM of so much Specific Size. I can not figure out how to find or bring again out this message. But I guess you know what I'm talking about.

— But I'm wondering what tools are used or the best way to proceed when we are not using SEGGER Embedded Studio neither Keil Embedded Development Tools for ARM. And that we take care of making the project by hand, to adjust the right amount of RAM with respect to our Project and what running into ?

— And second question but I guess the answer (it depends) do you think technically on that chip: nRF51822-QFAAH0 Which therefore has only 16 kB of RAM ; It is possible to run:

  • ANCS
  • UART/NUS
  • HID
  • DFU Button Less
  • Libs for MEMS

?

Thank you for your best advice,

  • I'm quite a beginner in embedded (with a past doing low level stuff on PC, though) so pardon me if I'm wrong. Regarding this RAM adjustment you're talking about, I think you always want to use the full RAM (or... there's not reason not to use it), however how RAM will be free depends on the SD configuration (bondings...). Thus, the sd_check_ram_start() function and CHECK_RAM_START_ADDR macro will help you determine how much RAM the softdevice needs, and the rest is yours.

  • Hi, I squeezed a program onto a nRF51 with 16kB RAM, which uses the following components: Softdevice, which takes around 8kB, UART/NUS, DFU, OTA, Libfix math and LIS2/3 DH libraries. I am close to the edge, but it fitted into. As programming environment I use, eclipse, arm gcc and openocd. HTH Johannes

  • I've used NRF51 with 16k RAM, it should work with in your case. You can try to slim down the softdevice RAM usage by only enabling the minimum amount of stuff.

    Note that Segger RTT and NRF_LOG can be a memory hogs, especially when using DEFERRED mode. One could try to minimize buffer sizes here - but more messages would be lost.

    Note that hid profile has the side effect that any computer or mobile device will keep the connection active once pairing/bonding is complete. Also, the connection interval on both windows and IOS is lower, resulting in higher data rates - but higher current consumtion, too.

Related