7 years, 11 months ago.

Is a __enable_irq() instruction required at program start?

Just been dealing with a puzzling issue with IAP. I've been using ISP to program a LPC1768 but I thought it would be nice to have my program detect incoming "?" characters and trigger ISP automatically.

One odd thing is happening: it seems that when ISP ends and the program restarts then interrupts are disabled when normally they would be enabled.

I can see this because code that occurs on interrupt won't run unless I've explicitly enabled interrupts in "main".

This only seems to be the case for IAP-invoked ISP, selecting ISP by pulling the pin low and resetting doesn't seem to have this problem.

To enter ISP I'm using https://developer.mbed.org/users/sgrove/code/Re-InvokeISP/ as it only implements the IAP call I want not the whole API, also it resets the PLL settings.

I find it hard to believe that the entire MBED startu code doesn't touch the interrupt enable state at any point?

As far as I am aware a soft reset will simply move the program pointer to the first address in the flash memory, and probably won't do a true reset. So if the mbed code nowhere enables the interrupts they stay disabled indeed.

posted by Erik - 25 May 2016

Well it gets stranger still, I altered the program so it entered ISP with the interrupts enabled and still when it gets back to program start the interrupts appear disabled anyway.

posted by Oliver Broad 26 May 2016

1 Answer

7 years, 11 months ago.

Hello,

the default value of PRIMASK is 0 (it's cleared).

Accepted Answer

I think the issue I have belongs in the forum. I suspect I'm seeing the result of a programming tool branching to the reset entry point without actually performing a true reset.

posted by Oliver Broad 25 May 2016