hatdfault BLE application on srf52833 with s140 softdevice

Hello,
I'm trying to use BLE on nrf52833. I'm developping with segger embedded studio and I' m usign the BLE peripheral example "ble_app_blinky".
Firstly I erased the flash memory and installed the softdevice:

nrfjprog --eraseall
nrfjprog --program s140_nrf52_7.2.0_softdevice.hex --verify

Then I compiled the application and debugged. When the application go to sd_softdevice_enable, the system go to hardfault!

The linker setup is:
FLASH_PH_START=0x27000
FLASH_PH_SIZE=0x59000
RAM_PH_START=0x20002C00
RAM_NOINIT_SIZE=0x3000
RAM_PH_SIZE=0x1d400
FLASH_START=0x27000
FLASH_SIZE=0xa59000
RAM_START=0x20000000
RAM_SIZE=0x20000
DEFAULT_CONFIG_START=0x27000
DEFAULT_CONFIG_SIZE=0x400
FCONFIG_START=0x28000
FCONFIG_SIZE=0x1000
INIT_START=0x29100

Thank you in advance for support.
Davide

  • Another test:

    just the debug call: 

    SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler));

    the debug stop at void vPortSVCHandler( void ) and the register values are there:

    Go forward by 1 step and the debug goes to hardfault handler, and  the register values are there:

    I hope it is usefull to solve the issue.

  • Hello Davide,

    I am a little confused now. Are you having the hardfault with the unmodified ble_app_blinky example, or are you trying to integrate the ble_app_blinky features into your UWB with RTOS project?

    If you are working on an unmodified example, then please check your SEGGER Embedded Studio version. nRF5 SDK v17.1.0 was tested and released with SES v5.42a. That is the version you should use.

    If you are working on integrating BLE into your UWB project, then please give some more information about your project. It might be outside of my expertise then, but Susheel will return next week and resume helping you in this case.

    Best regards,

    Hieu

  • Hello Hieu,

    yes I'm  integrate the ble_app_blinky features into UWB with RTOS project. I confirm I'm using nRF5 SDK v17.1.0.

    I started my project with "DWM3001CDK-DW3_QM33_SDK_CLI-FreeRTOS.emProject" example project by Qorvo (UWB with RTOS). Then I added my application and all works fine. Now, I want to add  BLE functionalities. So, my steps were as follow:

    1) I modified the linker as shown above.

    2) I installed the s140_nrf52_7.2.0_softdevice.hex as shown above.

    3) I setup following parameters in sdh_config.h:

    NRF_SDH_BLE_ENABLED 1

    NRF_SDH_BLE_ENABLED 1
    NRF_SDH_BLE_VS_UUID_COUNT 1
    NRF_SDH_BLE_SERVICE_CHANGED 1

    4) I add following parametrs in Project Options->Preprocessor->Preprocessor Definitions:

    SOFTDEVICE_PRESENT

    S140

    NRF_SD_BLE_API_VERSION=7

    5) I compiled the application (WITHOUT add BLE functionalities) and everything continues to work well.

    6) Then, in  main.c, after board initialization, I added BLE call as follow:

    int main(void) {

       disable_nfc_pins(); 
       BoardInit();
       APP_ERROR_CHECK(nrf_sdh_enable_request());

     ......

    }

    In debug mode, when I go into APP_ERROR_CHECK(nrf_sdh_enable_request(), the debug jump to SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, and right after click "Step Into", the debug stop at void vPortSVCHandler( void ) and the register values are like there:

    Go forward  1 step and the debug goes to hardfault handler, and  the register values are there:

    I hope I have been clear, and you can help me.

    Best regards,

    Davide 

  • Check that the debugger is set up correctly.

    We had another case some weeks ago where the debugger was set up to run the processor from the application reset vector - which ignores the required softdevice setup that must be run before the application start.

    Hard faulting in the first SD call sounds a lot like such a problem.

    I strongly recommend switching to NRF connect SDK.

  • I Turbo J,

     actually putting in debug, I notice in the Disassembly pane, that the application starts from the 'address 0x26100 instead of 0x000000 where is located the softdevvice. How can do to start the appplication from 0x000000 address? I tried putting in Project options->Debug->Loader->Additional file[0]:s140_nrf52_7.2.0_softdevice.hex, and Additional File Address[0[]=0x000000, but the application alway start from  0x26100.

    Thank you for support,

    Davide

1 2 3