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

Hardfault in nrf_drv_clock_hfclk_request() with S112 softdevice/nRF52810

I have the following trivial program which has almost identical functionality to the connectivity/ble_connectivity/pca10040e example:

int main(void)
{
    uint32_t err_code =0;
    
    err_code = nrf_drv_clock_init();
    if ((err_code != NRF_SUCCESS) &&
        (err_code != NRF_ERROR_MODULE_ALREADY_INITIALIZED))
    {
        APP_ERROR_CHECK(err_code);
    }
    
    nrf_drv_clock_hfclk_request(NULL);broken.zip

I am using the S112 softdevice, which I have programmed to the nRF52 Development Board (pca10040) which has an nRF52832 chip emulating an nRF52810.

I have used the ble_connectivity/pca10040e project as a template and when I compile and run the ble_connectivity project, it runs perfectly.

I have also taken the ble_connectivity project and reduced it to the bare essentials, so that it is identical to my trivial project.

ble_connectivity works, mine hardfaults.

  • The sdk_config.h is identical
  • The linker configuration file is identical
  • After the stripdown of the ble_connectivity project, the main.c file in both projects are identical.
  • The compiler settings are identical (no optimisation).

I've run out of things to try. Please help.

Parents
  • I cannot reproduce this issue when the system is running normally. But I can see the issue when i start the debugger. 

    Are you by any chance debugging when you're seeing this issue? We have seen that there's an issue with IAR + S110 when debugging. The issue is that IAR jumps directly to the applications reset handler (0x14000).

    This can be worked around by adding this line under "Options > Debugger > Extra Options > Command line options":

    • check the box
    • add this in the options without the quotes "--drv_vector_table_base=0x0"
Reply
  • I cannot reproduce this issue when the system is running normally. But I can see the issue when i start the debugger. 

    Are you by any chance debugging when you're seeing this issue? We have seen that there's an issue with IAR + S110 when debugging. The issue is that IAR jumps directly to the applications reset handler (0x14000).

    This can be worked around by adding this line under "Options > Debugger > Extra Options > Command line options":

    • check the box
    • add this in the options without the quotes "--drv_vector_table_base=0x0"
Children
No Data
Related