咨詢ch32v307 FSMC使用問題

FSMC異步傳輸?shù)谝淮巫x取的數(shù)據(jù)為0,后續(xù)讀取正常是怎么回事?用邏輯分析儀捕獲到數(shù)據(jù)總線上是有正常數(shù)據(jù)的。

異步傳輸?shù)却盘栐谑謨灾袥]有詳細的介紹,有沒有相關的介紹和時序圖。

1690506201136490.png

1690506201163366.png

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);


您好,測試了一下發(fā)現(xiàn)是正常的,附上測試程序,可以將vu16*類型改成u16*試一下,后續(xù)有問題可以郵箱聯(lián)系:kx@wch.cn

icon_rar.gifFSMC_SRAM.zip

image.png


多謝,改為u16*確實可以了。

關于wait信號的說明有么有呢?



只有登錄才能回復,可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频