External Flash on the LPC-E2214 Board using Keil (resolved)

I am trying to use the drivers for the external MXIC MX26LV800B flash. I am using Keil and so I am attempting to port the code provided by Olimex, this code was written for IAR tools.

To start I am attempting to read the device id, so far I hav had no luck, I read back 0xFFFF. I have written a flash.id file which sets:

BCFG0 = 0x1000FBEF; // BCFG0 Flash Bus Configuration

PINSEL2 = 0x0F6001E4; // CS0, OE, WE,

// D0…31, A1…23, JTAG

The command and read_id functions:

int command(unsigned char command, unsigned short *address)

{

*address = (unsigned short)command;

return PASS;

}

int FlashID(unsigned short* address)

{

unsigned int hold;

// Put device into ‘READ_ID’.

command(KEY_AA,(unsigned short*)(FIRST_KEY_ADD+FLASH_BEGIN));

command(KEY_55,(unsigned short*)(SECOND_KEY_ADD+FLASH_BEGIN));

command(READ_ID,(unsigned short*)(THIRD_KEY_ADD+FLASH_BEGIN));

hold = *address; // Read Data

command (RESET_DEV, address); // Reset 26LVXXXX

command (READ_ARRAY, address); // C3 Put device back into read mode.

// Return Item

return(hold);

}

Thanks

Rich

Headslap

Incorrect BCFG0 setting

Rich