Content originally posted in LPCWare by chuckp on Thu Jun 07 10:16:56 MST 2012
I now have it working. The key missing piece seems to have been the definition of the __Setup function in the .mac file referenced in the .flash file and used for downloading. Some of the examples of this file (for instance, in the 2012-04-17 CMSIS) have an empty __Setup function. Others use the wrong address to enable the clock. The function I am now using is below.
Of course you need to get all of the the other settings correct. With luck I've made enough noise that these fixes will be incorporated in a release.
__Setup()
{
/* set SPIFI clock */
//LPC_CGU->BASE_SPIFI0_CLK = 1<<24 | 1<<11; /* IRC 12 MHz is good enough for us */
__writeMemory32( 1<<24 | 1<<11, 0x40050070, "Memory");
// As delivered, used 0x40051304, which was the wrong address.
/* set up SPIFI I/O (undocumented bit 7 set as 1, Aug 2 2011) */
//LPC_SCU->SFSP3_3 = 0xF3; /* high drive for SCLK */
__writeMemory32( 0xF3, 0x4008618C, "Memory");
/* IO pins */
//LPC_SCU->SFSP3_4=LPC_SCU->SFSP3_5=LPC_SCU->SFSP3_6=LPC_SCU->SFSP3_7 = 0xD3;
__writeMemory32( 0xD3, 0x40086190, "Memory");
__writeMemory32( 0xD3, 0x40086194, "Memory");
__writeMemory32( 0xD3, 0x40086198, "Memory");
__writeMemory32( 0xD3, 0x4008619C, "Memory");
//LPC_SCU->SFSP3_8 = 0x13; /* CS doesn't need feedback */
__writeMemory32( 0x13, 0x400861A0, "Memory");
// map SPIFI to shadow area at address 0
__writeMemory32(0x14000000, 0x40043100, "Memory");
}