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

Adjustment of Ram and Flash

Hey everyone,

i would like to use the NRF52811 with the new Softdevice S140 V 7.0. Therfore i took the ble_app_blinky (pca10056) example and changed some preprocessor defines. My problem is to adjust the RAM and Flash settings. I found a table with some Information about the new Softdevice, but i dont know how to adjust Flash/Ram Origin & length with this.

Softdevice

Version

Minimum RAM Start

Flash Start

S140

7.0.0

0x20001678

0x27000

Sorry for this (stupid?) question, but i just started playing around with something else than an arduino/esp32. So i don't know if the question can be answered in general.

Not sure if this is needed: I use eclipse with openocd

Thanks =)

Parents
  • Believe the NRF52811 is intended to be used with the S112 Softdevice (pca10056e). s140 is used for the NRF52840 (pca10056).

    I am assuming you are using gcc compiler since you mention eclipse and openocd.
    In the makefile.
    Under the comment:
    # C flags common to all targets

    Add this:
    CFLAGS += -DDEBUG

    This will print the ram values that are needed if it is set to too little (too much does not give an error). After a call to sd_ble_enable().

    Flash is Origin is set to Flash Start.

    Don't believe that S140 V7 is supported in the SDKs as of SDK15.3 unless there was a new release.

    Also do a clean build after adjusting linker values.

Reply
  • Believe the NRF52811 is intended to be used with the S112 Softdevice (pca10056e). s140 is used for the NRF52840 (pca10056).

    I am assuming you are using gcc compiler since you mention eclipse and openocd.
    In the makefile.
    Under the comment:
    # C flags common to all targets

    Add this:
    CFLAGS += -DDEBUG

    This will print the ram values that are needed if it is set to too little (too much does not give an error). After a call to sd_ble_enable().

    Flash is Origin is set to Flash Start.

    Don't believe that S140 V7 is supported in the SDKs as of SDK15.3 unless there was a new release.

    Also do a clean build after adjusting linker values.

Children
  • Hey,

    you are right the NRF52811 is "normaly" used with the Softdevice S112. There was a S140 Update V 7.0.0 so it also can be used with the NRF52811. This is advertised on the Softdevice & NRF52811 webpage. It is also true that the new S140 is not included in the current SDK15.3. My idea was to just exchange the S140 in the current SDK and then be able to use it (of course i dont have any specific examples then). Isnt this possible?

    Currently the blinky example crashes at this point:  err_code = nrf_sdh_ble_enable(&ram_start); (without the flag DDEBUG)

    so i guess something is wrong with my RAM adjustment. After i add the DDEBUG flag i dont get any ram information :/ (should i see this in the console or debugger console?)

    EDIT:

    I changed my RAM settings to RAM_START=0x20003000;RAM_SIZE=0x3000

    like in this post:

    https://devzone.nordicsemi.com/f/nordic-q-a/50723/how-to-use-softdevice-s140-v7-0-0

    with this adjustment the ble_blinky example works! I have no idea why but at least something =)

  • should i see this in the console or debugger console?

    i'm not familiar with using openocd. Using JLink RTT Viewer.

    The debug also need to be enabled with this macro:

    // <e> NRF_SDH_BLE_LOG_ENABLED - Enable logging in SoftDevice handler (BLE) module.
    //==========================================================
    #ifndef NRF_SDH_BLE_LOG_ENABLED
    #define NRF_SDH_BLE_LOG_ENABLED 1
    #endif


    Also have a look at:

    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 1
    #endif
    
    
    // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_UART_ENABLED
    #define NRF_LOG_BACKEND_UART_ENABLED 0
    #endif


    These are the lines you are looking for in nrf_sdh_ble.c :

            NRF_LOG_WARNING("Insufficient RAM allocated for the SoftDevice.");
    
            NRF_LOG_WARNING("Change the RAM start location from 0x%x to 0x%x.",
                            app_ram_start_link, *p_app_ram_start);
            NRF_LOG_WARNING("Maximum RAM size for application is 0x%x.",
                            ram_end_address_get() - (*p_app_ram_start));



    There is a guide posted about adjusting the ram and rom settings on this site. Can't seem to find it now.

    My idea was to just exchange the S140

    Yes you can do this. I just don't like doing this cause it creates a devops nightmare.


  • mh im still not able to get LOG prints, anyway i figured out with your hint that i can debug the log prints directly. This is also described here in point 9:

    https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/adjustment-of-ram-and-flash-memory

    Overall my first Problem is solved (blinky example with S140 V7.0 works) but now i would like to use this to get the "relay" example working. Unfortunately this example does not fit on the nrf52811 due to flash overflow.

    Is it possible to reduce the needed flash memory?

    Thanks for your help!

  • I think it will be difficult to reduce the code size of the relay example enough to fit on the 52811. The example is approx. 55KB compiled with GCC and -Os while you only have  0x30000 - 0x27000 (flash end - Softdevice start) = 36KB available. I would recommend you to consider s112/s113 or use nRF52840 with s140 if you need the extra features. 

Related