Content originally posted in LPCWare by ECamino on Wed Jun 12 11:13:22 MST 2013
Hi,
Trying to do a simple byte write to EEPROM. Is there an app note that details how to do this? Here is my function code. I'm trying to write a byte in the first EEPROM mem address (0x0?). The return status code after the write call is (5): "DST_ADDR_NOT_MAPPED"
typedef uint8_t (*EEP)(unsigned int [],unsigned int[]); // modified 'stock' iap_entry prototype with new prototype to allow for return value (casting from void gives warnings)
EEP eep_entry;
uint32_t * pdata; //global
void ee_write(a_struct * pstruct){
unsigned long command[5];
unsigned long result[4];
uint8_t returnstatuscode; // get status of IAP command
*pdata = pstruct->data;
eep_entry = (EEP) IAP_LOCATION;
command[0] = 61; // EEPROM Write IAP call
command[1] = 0; // EEPROM address. What is this address? not specified in UM or Product data sheet!
command[2] = (unsigned long)&pdata; // cast from uint32_t
command[3] = 1; // write one byte
command[4] = 72000; // processor speed in kHz
returnstatuscode = eep_entry(command, result); // returns a '5', so what is the correct EEPROM address?
//;
}
Thanks,
EC