本帖最后由 static 于 2019-12-24 11:05 编辑
大家好,使用FSMC经验不足,现使用FSMC读取8bit 外部RAM,读到的数据有错位且只有第一次是正确的的,求教大家,谢谢大家帮忙指正。
如上图: CE接NE2,所以CS地址空间是:BANK2:6400 0000 --- 67ff ffff ;
FSMC 配置如下(根据官方代码修改):
读数据:
uint8_t data = 0x55 ;
/* Write data to the SRAM memory */
for(uwIndex = 0; uwIndex < 3; uwIndex++)
{
*(__IO uint8_t *)(0x64000000 + uwIndex) = data;
printf ( "FSMC read buffer[%d] fill = %x , \r\n" , uwIndex , data );
}
/* Read back data from the SRAM memory */
for(uwIndex = 0; uwIndex < 3; uwIndex++)
{
aRxBuffer[uwIndex] = *(__IO uint8_t *)(0x64000000 + uwIndex);
printf ( "FSMC read buffer[%d] READ = %x , \r\n" , uwIndex , aRxBuffer[uwIndex] );
}
uint8_t volatile *Test1,*Test2;
Test1=(uint8_t *)0x64000100;
*Test1++=0x99;
printf ( "FSMC read buffer3 = %x , \r\n" , *(volatile uint8_t *)0x64000100 );
printf ( "FSMC read buffer3 = %x , \r\n" , *(volatile uint8_t *)0x64000100 );
打印出数据为:
FSMC read buffer[0] fill = 55 ,
FSMC read buffer[1] fill = 55 ,
FSMC read buffer[2] fill = 55 ,
FSMC read buffer[0] READ = 5 ,
FSMC read buffer[1] READ = 5 ,
FSMC read buffer[2] READ = 5 ,
FSMC read buffer3 = 99 ,
FSMC read buffer3 = 1 ,
请问大家问题出在哪里?始终没搞懂
|