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!

Parents
  • 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)

Reply
  • 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)

Children
No Data
Related