|
#define SDRAM_BASE_ADDR 0xA0000000
#define SDRAM_SIZE 0x2000000
config.ChipSize = 256;
config.AddrBusWidth = 16;
config.AddrMap = EMC_ADD_MAP_ROW_BANK_COL;
config.CSn = 0;
config.DataWidth = 16;
config.TotalSize = SDRAM_SIZE;
config.CASLatency= 2;
config.RASLatency= 1;
config.Active2ActivePeriod = 10;
config.ActiveBankLatency =2;
config.AutoRefrehPeriod = 10;
config.DataIn2ActiveTime = 5;
config.DataOut2ActiveTime = 5;
config.WriteRecoveryTime = 2;
config.ExitSelfRefreshTime = EMC_NS2CLK( 70);
config.LoadModeReg2Active = 2;
config.PrechargeCmdPeriod = 3;
config.ReadConfig = 1; /* Command delayed strategy, using EMCCLKDELAY */
config.RefreshTime = EMC_SDRAM_REFRESH( 64);
config.Active2PreChargeTime = 7;
config.SeftRefreshExitTime = EMC_NS2CLK( 70);
DynMem_Init(&config);
做如上初始化,然后分别定义8,16,32位的指针从0xA0000000开始写数据并读出来验证,8和16位读写没有问题,但是写32位的数据就出错,
移植了FATFS之后,把SD卡的操作放在SDRAM中,就出错:SD中没有有效的FATFS卷
#define FATFS_BASEADDR ((uint32_t)SDRAM_BASE_ADDR + 0x100000)
#define file_BASEADDR ((uint32_t)SDRAM_BASE_ADDR + 0x200000)
#define ftemp_BASEADDR ((uint32_t)SDRAM_BASE_ADDR + 0x300000)
#define fatbuf_BASEADDR ((uint32_t)SDRAM_BASE_ADDR + 0x600000)
FATFS *fs[_VOLUMES];/
FIL *file; /
FIL *ftemp;
UINT br,bw;
FILINFO fileinfo;
DIR dir;
uint16_t *fatbuf;
uint8_t exfuns_init(void)
{
fs[0]=(FATFS*)FATFS_BASEADDR;
file=(FIL*)file_BASEADDR;
ftemp=(FIL*)ftemp_BASEADDR;
fatbuf=(uint16_t*)fatbuf_BASEADDR;
return 0;
}
求给个思路 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|