This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debug and old IRQ

Hello, When I restart my application with debugger, i have strange IRQs called (TWI, ...) before init. Possibly IRQ still active and debug don't touch them.

Can I disable all IRQ on restart ? Is there a magic cleaning function ? :-)

  • I propose

    // disable all external interrupts
    		NVIC->ICER[0] = 0xFFFFFFFF;
    		NVIC->ICER[1] = 0xFFFFFFFF;
    		NVIC->ICER[2] = 0xFFFFFFFF;
    		NVIC->ICER[3] = 0xFFFFFFFF;
    		NVIC->ICER[4] = 0xFFFFFFFF;
    		NVIC->ICER[5] = 0xFFFFFFFF;
    		NVIC->ICER[6] = 0xFFFFFFFF;
    		NVIC->ICER[7] = 0xFFFFFFFF;
    		
    		// clear all external pending interrupts
    		NVIC->ICPR[0] = 0xFFFFFFFF;
    		NVIC->ICPR[1] = 0xFFFFFFFF;
    		NVIC->ICPR[2] = 0xFFFFFFFF;
    		NVIC->ICPR[3] = 0xFFFFFFFF;
    		NVIC->ICPR[4] = 0xFFFFFFFF;
    		NVIC->ICPR[5] = 0xFFFFFFFF;
    		NVIC->ICPR[6] = 0xFFFFFFFF;
    		NVIC->ICPR[7] = 0xFFFFFFFF;
    
  • For the brocken CPU is there a hard way to erase all ?

  • Why did you do that???? We were talking about disabling peripheral interrupts and not using __disable_irq because it was disabling SVC exception also. Clearing all bits in ICER register means everything except reset, NMI and hardfault are disabled. This is out of my knowledge of to what debugger needs to halt the CPU here. I will talk to few other guys here tomorrow and see if there is any possibility to unbrick your device.

  • I did that because when a peripheral is working and debugger restart application you get some unexpected irq (end of started DMA xfer) and application crash. With that lines, no more issue, debug by nRF52 DK is stable in my case.

  • I still do not understand why the chip is bricked? debugger accessing chip from SWD is a different thing. I think there is a reset happening at the early phase of your startup, so your chip is in infinite loop of reset.

Related