Search code examples
armkeillpccortex-m

LPC1114 re-directed interrupt handling


LPC1114 bootloader (location 0-0x2000) and user application (location 0x2000-0x6000) where bootloader is using polling and user application is using interrupts.

Description- Bootloader runs systick polling ok, times out based on systick count and jumps to user application at 0x2000, where systick interrupts are used.

Problem-
If __disable_irq() is called in bootloader before jump to user application user application runs ok (not using interrupts as intended, but at least it runs).
If no __disable_irq() before user application jump, user application fails, ends up in default_handler in startup_LPC11xx.s.

Added code to determine interrupt source - this is a HardFault


Solution

  • Seems to me you don't have proper handling for some (maybe all) interrupts in your code. As far as the question has been already asked without providing a real code, it can be only a general recommendations here.

    The scenario can be seen so far is that after you have interrupts enabled some event causes the interrupt, program counter jumps to nowhere/random address and system fails. Another reason for the issue can be in incorrect handling, but again, it's analyzing code has to be taken, which you didn't provided.

    In order to narrow the problem down I would recommend to split the whole code to parts, make it as simpler as possible and run with just minimal code and at least one interrupt enabling - make sure you can produce the event for the interrupt.

    Do you have a debugger or working serial communication with the device? If you are stuck with this you need to analyze the IRQ status register - most likely to read it right after IRQ happens.