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

nRF52832 NVIC_SetPendingIRQ Crash

Using SDK14.0.0, nRF52832, GCC, GDB/Ozone, secure DFU

This question seems to get close to asking about my problem.

I am trying to debug my application with a loaded using either Ozone or JLinkGDBServer. I followed the advice here in Appendix 1 in order to be able to flash my application without using the DFU, which works just fine. However, using:

JLinkGDBServer -device nRF52832_xxAA -if swd -speed 1000

As my debugger, results in GDB choking when I pause the application and try to jump to main. On the other hand, when using Ozone I can get some use out of debugging, but after using the "Download and Reset Program" option the nRF seems to halt after running this line:

NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));

The strange part is that it only crashes at this point after a fresh reprogramming; if I use the "Reset Program to Main" button at any point the nRF wont have any issues at the listed line. My code is based off of the Secure Buttonless DFU example, and it crashes in the power_management_init() function.

I'm not sure what's causing this, debugging with GDB would be ideal. Any advice would be appreciated!

  • Hi,

    By crash you mean hardfault? Is it the function timer_list_handler_sched() that is calling the NVIC_SetPendingIRQ() that is causing this?

  • Ozone isn't behaving as if it's a typical hardfault, it normally will indicate that I'm in the hardfault handler but in this case it jumps to address 0x8CC which is a LDR (R3, [R3, #+0x0C]). And continuing execution in Ozone results in execution being immediately paused at the same address. It appears as if the CPU just stopped...

    And you are correct, timer_list_handler_shed() is the function calling the NVIC_SetPendingIRQ. The full function call stack is:

    power_management_init() -> nrf_pwr_mgmt_init() -> PWR_MGMT_TIMER_CREATE() -> app_timer_start(m_pwr_mgmt_timer, APP_TIMER_TICKS(1000), NULL) -> timer_start_op_schedule(p_node, timeout_ticks, timeout_periodic, p_context) -> timer_list_handler_sched() -> NVIC_SetPendingIRQ(SWI_IRQn)

  • Hi,

    It’s probably caused by how Ozon is handling the “Download and Reset Program” in combination with the SoftDevice, i.e. it’s not starting the application in a stream-lined fashion.


    Note that we have now released SDK 14.1, where we have added support for Segger Embedded Studio (SES) IDE. You can use Segger Embedded Studio for commercial and non-commercial purpose with Nordic Semiconductor devices free of charge without any code limit. This could be a better option for you than your current toolchain setup. See this article for more information.

    You can download SDK 14.1 here.

    You can download Segger Embedded Studio from here.

  • Hi kbb64 ,

    The sdk_config.h that comes with the examples\ble_peripheral\ble_app_template example should have the defines you need. If you are not using the SoftDevice, take a look at the sdk_config.h for examples\peripheral\template_project instead.

Related