Philin05 (16.11.2010 13:13, просмотров: 2443)
Только начинаю работать с SDRAM (МК AT91SAM9261) и не понятен один момент ее инициализации: Откуда взялось вот это число (0xCAFEDEDE) и как его понять при выполнениии комманды "Load Mode Register"
Не проходите мимо :) Спасибо.
void AT91F_InitSDRAM32 (void)
{
volatile unsigned int i;
AT91PS_SDRAMC psdrc = AT91C_BASE_SDRAMC;
AT91F_SDRAMC_CfgPIO();
psdrc->SDRAMC_CR = AT91C_SDRAMC_NC_9 |
AT91C_SDRAMC_NR_13 |
AT91C_SDRAMC_CAS_2 |
AT91C_SDRAMC_NB_4_BANKS |
AT91C_SDRAMC_DBW_32_BITS |
AT91C_SDRAMC_TWR_2 |
AT91C_SDRAMC_TRC_7 |
AT91C_SDRAMC_TRP_2 |
AT91C_SDRAMC_TRCD_2 |
AT91C_SDRAMC_TRAS_5 |
AT91C_SDRAMC_TXSR_8 ;
psdrc->SDRAMC_MR = 0x00000002; // Set PRCHG AL
*AT91C_SDRAM = 0x00000000; // Perform PRCHG
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 1st CBR
*(AT91C_SDRAM+4) = 0x00000001; // Perform CBR
psdrc->SDRAMC_MR = 0x00000004; // Set 2 CBR
*(AT91C_SDRAM+8) = 0x00000002; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 3 CBR
*(AT91C_SDRAM+0xc) = 0x00000003; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 4 CBR
*(AT91C_SDRAM+0x10) = 0x00000004; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 5 CBR
*(AT91C_SDRAM+0x14) = 0x00000005; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 6 CBR
*(AT91C_SDRAM+0x18) = 0x00000006; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 7 CBR
*(AT91C_SDRAM+0x1c) = 0x00000007; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_RFSH_CMD; // Set 8 CBR
*(AT91C_SDRAM+0x20) = 0x00000008; // Perform CBR
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_LMR_CMD; // Set LMR operation
*(AT91C_SDRAM+0x24) = 0xcafedede; // Perform LMR burst=1, lat=2
//psdrc->SDRAMC_TR = (AT91C_MASTER_CLOCK * 7)/1000000; // Set Refresh Timer 390 for 25MHz (TR= 15.6 * F )
// (F : system clock freq. MHz
psdrc->SDRAMC_MR = AT91C_SDRAMC_MODE_NORMAL_CMD; // Set Normal mode
*AT91C_SDRAM = 0x00000000; // Perform Normal mode
}
//*------------------------------------------------------------------------------