Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Hard fault with enabling of softdevice

Hey!

I am strugling with this for a few weeks now, so i decided to finaly put up a ticket for my problem here.

I am working on a BLE feature on a custom board with a N52832 chip on it.
The electrical part of the settup of the N52832 is basically a copy of the nRF52 Dev Kit, accept for a SPI connection, so it should be able to run nRF5 SDK example features.

The problem i keep running into, is that when enabling the soft device a hard fault occurs.
The fault seems to be triggered bij a SVC call to #16, after this the Hard_Fault function is called and a report of the register that triggered the fault is made.
Then te program resets or holds on NRF_BREAKPOINT_COND;

In the screenshot it is visible that fault occured at adress 0x0003021A after the SVC #16 call.

It caught my eye that things like the clock data, found in the sdk_config.h file, cant be found when i ad them to the watch list when debugging.  

When debugging with Ozone, the reason of the fault: A fault with configurable priority has been escalated to a HardFault exception at 0x0003021A, is given.

The code for the project is made up of C++ and C from the SDK functions, to make it future proof, better maintanable and unit testible.
When compiled through the Keil IDE, the code works on the custom board with no problem. 
I however work with the Segger IDE and get the hard fault problem.

I tried running the example projects on the custom board, they also dont work.
The custom software also dont works on the dev kits.

I think there is a configuration isue between the two IDE's.
I use the same configuration from the sdk_config.h file and tried the same flash and ram start and size numbers, but with no positive outcome.

The equipment i use is: Windows 10 pc, Segger Strudio V5.42, nRF5 SDK 17.1.0, softdevice s132_nrf52_7.2.0.
As programming tool i tried the nRF52 Dev Kit and the nRF52842 Dev Kit.


Could you please help me with this problem, ive searched al over the devzone and found some simular problems, but with no working solution.
Thanks in advance!

Parents
  • Hi,

    As you see this working when you build with Keil but not with Segger Embedded Studio I wonder what the difference is in the configuration between these two? Are there differences in the include path for instance? Differences in the processor defines? Or differences in the linker configuration / memory layout?

    And as this happens when you enable the SoftDevice - are you building with the include files for the correct SoftDevice variant and version in your include path?

  • Hi Einar,

    We use the nRF5 SDK files as a submodule in the Git repo of the project. We checked the file paths and the adds of the .c files in the project. There dont seem to be any differences there. 
    I load the softdevice out of the SDK folder in the Git repo. 

    When we ran through the differencves we had'nt thought off, indeed the precompiler definitions came to mind. In Segger these seem to be called Preproscessor Definitions. 
    In here we found some differences, those were the inclusion of difinitions: 
    CONFIG_NFCT_PINS_AS_GPIOS, 
    NRF_SD_BLE_API_VERSION=7, 
    S132, 
    __HEAP_SIZE=8192, 
    __STACK_SIZE=8192 

    I included these definitions under the Preprocessor Definitions in my Segger project and this seemed to make a difference.
    For a moment a came pass the SVC #16 call and out of the function also pass the Critical Region part. Which seemed to point out that the Softdevice is working.
    After that with a bit of debugging again i get a new fault:

     

    Which stil seems to point to a problem with SVC adresses, but is i think an improvement over the hard fault.

  • That is interesting. I am also wondering about the other preprocessor defines and linker configuration. If it is difficult to find, perhaps you can upload your Keil and Segger projects here so that I can have a look? Not the code, just the project files (but please include all, as for instance with Segger, the linker configuration is in a separate xml file).

  • Hey Einar,

    Sorry for the late reaction.

    I messed around with some of the Preprocessor Definitions and the addation of NO_VTOR_CONFIG finaly did the trick. The code runs stable through the startup sections now and reaches the nain loop.

    I tried adding NO_VTOR_CONFIG before when i was diiging in to the essentials needed for enabling the softdevice, but then it didnt work. So i wonder why it was the key stone this time.

    The other preprocessor definitions i use are: 

    APP_TIMER_V2
    APP_TIMER_V2_RTC1_ENABLED
    CONFIG_GPIO_AS_PINRESET
    CONFIG_NFCT_PINS_AS_GPIOS
    ENABLE_SWO
    FLOAT_ABI_HARD
    NO_VTOR_CONFIG
    NRF52
    NRF52832_XXAB
    NRF52_PAN_74
    S132
    NRF_SD_BLE_API_VERSION=7
    SOFTDEVICE_PRESENT

    I can sent the other files if you are stil interested in the problem, but it is working for me now, so my problem is solved.

Reply
  • Hey Einar,

    Sorry for the late reaction.

    I messed around with some of the Preprocessor Definitions and the addation of NO_VTOR_CONFIG finaly did the trick. The code runs stable through the startup sections now and reaches the nain loop.

    I tried adding NO_VTOR_CONFIG before when i was diiging in to the essentials needed for enabling the softdevice, but then it didnt work. So i wonder why it was the key stone this time.

    The other preprocessor definitions i use are: 

    APP_TIMER_V2
    APP_TIMER_V2_RTC1_ENABLED
    CONFIG_GPIO_AS_PINRESET
    CONFIG_NFCT_PINS_AS_GPIOS
    ENABLE_SWO
    FLOAT_ABI_HARD
    NO_VTOR_CONFIG
    NRF52
    NRF52832_XXAB
    NRF52_PAN_74
    S132
    NRF_SD_BLE_API_VERSION=7
    SOFTDEVICE_PRESENT

    I can sent the other files if you are stil interested in the problem, but it is working for me now, so my problem is solved.

Children
No Data
Related