/* Keil SDRAM timing and chip Config */ STATIC const IP_EMC_DYN_CONFIG_T MT48LC4M32_config = { EMC_NANOSECOND(64000000 / 4096),/* Row refresh time */ 0x01,/* Command Delayed */ EMC_NANOSECOND(18), EMC_NANOSECOND(42), EMC_NANOSECOND(70), EMC_CLOCK(0x01), EMC_CLOCK(0x05), EMC_NANOSECOND(12), EMC_NANOSECOND(60), EMC_NANOSECOND(60), EMC_NANOSECOND(70), EMC_NANOSECOND(12), EMC_CLOCK(0x02), { { EMC_ADDRESS_DYCS0,/* Keil Board uses DYCS0 for SDRAM */ 3,/* RAS */ EMC_DYN_MODE_WBMODE_PROGRAMMED | EMC_DYN_MODE_OPMODE_STANDARD | EMC_DYN_MODE_CAS_3 | EMC_DYN_MODE_BURST_TYPE_SEQUENTIAL | EMC_DYN_MODE_BURST_LEN_4, EMC_DYN_CONFIG_DATA_BUS_32 | EMC_DYN_CONFIG_LPSDRAM | EMC_DYN_CONFIG_4Mx32_4BANKS_12ROWS_8COLS | EMC_DYN_CONFIG_MD_SDRAM }, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} } }; |
Chip_EMC_Dynamic_Init((IP_EMC_DYN_CONFIG_T *) &MT48LC4M32_config); |
/* Setup external memories */ void Board_SetupExtMemory(void) { /* Setup EMC Delays */ /* Move all clock delays together */ LPC_SCU->EMCDELAYCLK = ((CLK0_DELAY) | (CLK0_DELAY << 4) | (CLK0_DELAY << 8) | (CLK0_DELAY << 12)); /* Setup EMC Clock Divider for divide by 2 - this is done in both the CCU (clocking) and CREG. For frequencies over 120MHz, a divider of 2 must be used. For frequencies less than 120MHz, a divider of 1 or 2 is ok. */ Chip_Clock_EnableOpts(CLK_MX_EMC_DIV, true, true, 2); LPC_CREG->CREG6 |= (1 << 16); /* Enable EMC clock */ Chip_Clock_Enable(CLK_MX_EMC); /* Init EMC Controller -Enable-LE mode */ Chip_EMC_Init(1, 0, 0); /* Init EMC Dynamic Controller */ Chip_EMC_Dynamic_Init((IP_EMC_DYN_CONFIG_T *) &MT48LC4M32_config); /* Init EMC Static Controller CS0 */ Chip_EMC_Static_Init((IP_EMC_STATIC_CONFIG_T *) &S29GL64N90_config); /* Enable Buffer for External Flash */ LPC_EMC->STATICCONFIG0 |= 1 << 19; } |