nrf52832 / nrf52840 NUS

Hi All,

I have been trying to implement NUS on my nrf52832/nrf52840. I have that application working on both of them. Recently I wanted to implement the same functionality (NUS) on another application. I have ported the code from my old application to the new also taking care of all the dependencies. The application runs but it is not able to advertise. I play with Placement Macros (RAM and Flash) size which atleast doesn't give me ud memory fail.

if (nrf_sdh_ble_enable(&ram_start) != NRF_SUCCESS)
    {
        printf("ud memory fail\n");
    }

But still I am not able to receive advertisement. I believe I am not setting the RAM and Flash parameters correctly. Here is the current configuration.

FLASH_PH_START=0x0
FLASH_PH_SIZE=0x80000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x10000
FLASH_START=0x26000
FLASH_SIZE=0x5a000
RAM_START=0x20003d18
RAM_SIZE=0xe2e8

Also is it possible to use s132 with nrf52840?

I have gone through this link but couldn't use it properly. Any help much will be much appreciated. 

Thanks

Regards

  • Hello,

    Try to turn on logging, and monitor the logs from inside nrf_sdh_ble_enable(). It should say what you need to adjust your RAM settings to. I can't tell from your description, but it will calculate it for you, and display it in the log.

    Best regards,

    Edvin

  • So I tried to printed out the RAM start address using the following but it doesn't even cross

    err_code = nrf_sdh_enable_request();

    The following function initializes my stack:

    void ble_ud_stack_init(void)
    {
        uint32_t err_code;
        uint32_t ram_start = 0;
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
        printf("--------------------here1\n");
        if (nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start) != NRF_SUCCESS)
            printf("ud fail\n");
        if (nrf_sdh_ble_enable(&ram_start) != NRF_SUCCESS)
        {
            printf("ud memory fail\n");
        }
        printf("BLE Application RAM start address = %x\n", ram_start);
        NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_ud_stack_evt_handler, NULL);
    }

    I am able to compile but when I run I get following error:

    ERROR 8 [NRF_ERROR_INVALID_STATE]

    Currently I have the following macros for nrf52840:

    FLASH_PH_START=0x0
    FLASH_PH_SIZE=0x100000
    RAM_PH_START=0x20000000
    RAM_PH_SIZE=0x40000
    FLASH_START=0x27000
    FLASH_SIZE=0xd9000
    RAM_START=0x20003460
    RAM_SIZE=0x3dd00

  • nordicuser91 said:
    I am able to compile but when I run I get following error:

    What function returns this? nrf_sdh_enable_request() or nrf_sdh_ble_enable()?

    Either way, I suggest you replace line 8 -> 15 with nrf_sdh_ble_enable() from nrf_sdh_ble.c. This will print in the log what you need to change your RAM settings to. Again, I don't know without having your entire application. 

    BR,

    Edvin

  • err_code = nrf_sdh_enable_request();

    Return the error

    ERROR 8 [NRF_ERROR_INVALID_STATE]

  • Yes, it will return that.

    But what did the log say?

    Do you see the log output at all? If not, please let me know.

    BR,
    Edvin

Related