5 years, 1 month ago.

LPC824, RTOS and IAP

Team We had written a mbed app with a whole bunch of things including IAP for changing flash data (instead of EEPROM). All was working well and we then tried to implement RTOS Timer on it. With RTOS the program stops at IAP ERASE. Code given below

<code> result= iap.erase(targetSector, targetSector); 30th Sector

Erase is defined as

int IAP::erase( int start, int end ) { IAP_command[ 0 ] = 52; IAP_command[ 1 ] = (unsigned int)start; Start Sector Number IAP_command[ 2 ] = (unsigned int)end; End Sector Number (should be greater than or equal to start sector number) IAP_command[ 3 ] = cclk_kHz; CPU Clock Frequency (CCLK) in kHz

iap_entry( IAP_command, IAP_result );

return ( (int)IAP_result[ 0 ] ); } </code>

Any one facing this problem?

1 Answer

5 years, 1 month ago.

Since I am not sure the iap_entry does it automatically: try adding:


//Your IAP code


If an interrupt is serviced during IAP this could be a problem.

Accepted Answer

Erik I will add the above code. Thanks for your response. I thought IAP was a ROM call.

I am using th following IAP code https://developer.mbed.org/components/IAP-In-Application-Programming/


posted by ram k 23 Jun 2015

IAP is indeed a ROM call on LPC devices, but I don't know if the ROM code disables interrupts. For example I know for a fact that all flash access during programming/erasing of any sector results in the MCU crashing. It can handle a while(IAP_read) loop, most likely since that is prefetched from flash, for the LPC this is not relevant however since it is fetched from ROM. However if interrupts would not be disabled, it would jump to the interrupt vector where it would need to use the flash.

Note: Not a clue if this is indeed your problem :).

posted by Erik - 23 Jun 2015

Erik it worked.

Does this in any way affect CRP? Couple of my devices went into CRP3 mode (as i understand from the LPC82x user manual)

posted by siva surendar 02 Jul 2015

Your IAP code can do it, depending on what you write where. Disabling/enabling the interrupt routine has nothing to do with it for sure.

posted by Erik - 02 Jul 2015

I noticed that the IAP library should mention about disabling interrupt. I updated my notebook page for IAP. Thank you!

posted by Tedd OKANO 03 Jul 2015