Hi
I have now tried out the FAIM example for the LPC845.
It is fairly simple, but i can't figure out how it works (and it does not work):
I use Rowley Crossworks, but I simple copied the necessary source to my main.c, to try it out:
When i call FAIMRead like this:
FAIMRead( 0, (uint32_t)&read_data);
...it returns OK, but "read_data" is never updated by the call to FAIMRead.
Do I do anything wrong, or have I misunderstood something?
Here is the source I copied from the FAIM and clocks example:
struct sIAP
{
uint32_t cmd; // Command
uint32_t par[4]; // Parameters
uint32_t stat; // Status
uint32_t res[4]; // Result
};
static struct sIAP IAP;
// Pointer to ROM IAP entry functions
#define IAP_ENTRY_LOCATION 0x0F001FF1
enum eIAP_COMMANDS
{
IAP_PREPARE = 50, // Prepare sector(s) for write operation
IAP_COPY_RAM2FLASH, // Copy RAM to Flash
IAP_ERASE, // Erase sector(s)
IAP_BLANK_CHECK, // Blank check sector(s)
IAP_READ_PART_ID, // Read chip part ID
IAP_READ_BOOT_VER, // Read chip boot code version
IAP_COMPARE, // Compare memory areas
IAP_REINVOKE_ISP, // Reinvoke ISP
IAP_READ_UID, // Read unique ID
IAP_ERASE_PAGE, // Erase page(s)
IAP_READ_MISR=70,
IAP_READ_MISR_EX=73,
IAP_READ_PAGE_FAIM=80,
IAP_WRITE_PAGE_FAIM=81
};
// IAP Call
typedef void (*IAP_Entry) (uint32_t *cmd, uint32_t *stat);
#define IAP_Call ((IAP_Entry) IAP_ENTRY_LOCATION)
int FAIMRead (uint32_t adr0, uint32_t adr1)
{
IAP.cmd = IAP_READ_PAGE_FAIM; // READ FAIM PAGE
IAP.par[0] = adr0; // FAIM page number
IAP.par[1] = adr1; // Destination RAM address to store the read value
IAP_Call (&IAP.cmd, &IAP.stat); // Call IAP Command
if (IAP.stat) return (IAP.stat); // Command Failed
return (0); // Finished without Errors
}