AnsweredAssumed Answered

IAP EEPROM Anomaly LPC11U68

Question asked by Matt Ferrari on Nov 3, 2016
Latest reply on Nov 4, 2016 by Matt Ferrari

This causes a Hard Fault IRQ when iap_entry() is called (only partial code shown, the other provisions are coded):

 

uint32_t      clock_speed;

 

clock_speed = 12000000;


iap_command[0] = IAP_EEPROM_WRITE;
iap_command[1] = eeprom_start_address;
iap_command[2] = (uint32_t)byte_ptr;
iap_command[3] = byte_count;
iap_command[4] = clock_speed / 1000;

iap_entry( iap_command, iap_result );

 

But this works fine:

 

clock_speed = 12000000 / 1000;


iap_command[0] = IAP_EEPROM_WRITE;
iap_command[1] = eeprom_start_address;
iap_command[2] = (uint32_t)byte_ptr;
iap_command[3] = byte_count;
iap_command[4] = clock_speed;

iap_entry( iap_command, iap_result );

 

This makes no sense to me.  Is this a compiler bug, possibly due to optimization?

I'm using LPCXpresso IDE v7.6.2 [Build 326] for LPC11U68.

 

Thanks,

 

Matt

Outcomes