|
用的STM32F407ZET6
移植了STemWin和FreeRTOS,如果都用芯片的内存,提示内存不够。
如图:
所以打算用外扩的SRAM
在GUIConf.c里面改:
#define USESRAM
void GUI_X_Config(void) {
#ifndef USESRAM
//
// 32 bit aligned memory area
//
static U32 aMemory[GUI_NUMBYTES / 4];
//
// Assign memory to emWin
//
GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
#else
// SRAM_Init();
GUI_ALLOC_AssignMemory((void *)Bank1_SRAM3_ADDR,GUI_NUMBYTES);
#endif
//
// Set default font
//
GUI_SetDefaultFont(GUI_FONT_6X8);
}
#include "fsmc_sram.h"里面的 :#define Bank1_SRAM3_ADDR ((u32)(0x68000000))
fsmc_sram.c 的配置:
void FSMC_SRAM_Init(void)
{
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef p;
RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE);
p.FSMC_AddressSetupTime =3; //地址建立时间(ADDSET)为1个HCLK 1/36M=27ns
p.FSMC_AddressHoldTime = 0; //地址保持时间(ADDHLD)模式A未用到
p.FSMC_DataSetupTime = 2; //数据保持时间(DATAST)为3个HCLK 4/72M=55ns(对EM的SRAM芯片)
p.FSMC_BusTurnAroundDuration = 1;
p.FSMC_CLKDivision = 0;
p.FSMC_DataLatency = 0;
p.FSMC_AccessMode = FSMC_AccessMode_A; //模式A
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; // FSMC_MemoryType_PSRAM;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
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_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); //初始化FSMC配置
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); // 使能BANK3
}
SRAM的GPIO都核对过。
这样运行程序时总是在GUI_Init(); 处卡死
有没有遇到过类似的情况啊
有没有解决的思路,或参考呢?
求解答啊
|
|