FSMC異步傳輸?shù)谝淮巫x取的數(shù)據(jù)為0,后續(xù)讀取正常是怎么回事?用邏輯分析儀捕獲到數(shù)據(jù)總線上是有正常數(shù)據(jù)的。
異步傳輸?shù)却盘栐谑謨灾袥]有詳細的介紹,有沒有相關的介紹和時序圖。
FSMC的配置
RWTiming.FSMC_AddressSetupTime = 0x01;
? ? RWTiming.FSMC_AddressHoldTime = 0x00;
? ? RWTiming.FSMC_DataSetupTime = 0x01;
? ? RWTiming.FSMC_BusTurnAroundDuration = 0x00;
? ? RWTiming.FSMC_CLKDivision = 0x00;
? ? RWTiming.FSMC_DataLatency = 0x00;
? ? RWTiming.FSMC_AccessMode = FSMC_AccessMode_A;
? ? FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;
? ? FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Enable;
? ? FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
? ? FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
? ? FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode =FSMC_BurstAccessMode_Disable;
? ? FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
? ? FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait=FSMC_AsynchronousWait_Enable;
? ? FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
? ? FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
? ? FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
? ? FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
? ? FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Enable;
? ? FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
? ? FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &RWTiming;
? ? FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &RWTiming;
? ? FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
? ? FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
讀寫的程序
*(vu16*)(FSMC_SRAM_BASE + 0x2) = 0xAA55;
? ? *(vu16*)(FSMC_SRAM_BASE + 0x4) = 0x55AA;
? ? rd16_1 = *(vu16 *)(FSMC_SRAM_BASE + 0x2);
? ? rd16_2 = *(vu16 *)(FSMC_SRAM_BASE + 0x4);
? ? printf("0x%04X\n", rd16_1);
? ? printf("0x%04X\n", rd16_2);
? ? volatile uint16_t *pdat = (volatile uint16_t *)FSMC_SRAM_BASE;
? ? for (int i = 0; i < 1024; i++) {
? ? ? ? *pdat = i;
? ? ? ? pdat += 2;
? ? }
? ? pdat = (volatile uint16_t *)FSMC_SRAM_BASE;
? ? for (int i = 0; i < 1024; i++) {
? ? ? ? rx_buf[i] = *pdat;
? ? ? ? pdat += 2;
? ? }
? ? print_buffer(rx_buf, 1024);