rt-thread系统和fsmc冲突?

2019-07-14 15:26发布

不知道各位有使用过rt-thread系统么,我在调试时出现怪问题!使用STM32F429开发板(官方的那个)
不带操作系统时,移植emWin+tft屏(FSMC),运行正常(emWin的demo程序都是正常);
移植rt-thread系统进来,发现程序一直跑飞,最后发现在配置FSMC函数上,将此函数屏蔽,rt-thread系统能正常,否则程序就跑飞!!很是郁闷!!
FSMC配置如下:
static void LCD_FMCConfig(void)
{
        FMC_NORSRAMInitTypeDef  init;
        FMC_NORSRAMTimingInitTypeDef  timingWrite;
        FMC_NORSRAMTimingInitTypeDef  timingRead;

                /* ʹÄÜFMCʱÖÓ */
        RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FMC, ENABLE);

        /*-- FMC Configuration ------------------------------------------------------*/
        /*----------------------- SRAM Bank 4 ----------------------------------------*/
        /* FMC_Bank1_NORSRAM4 configuration */
        timingWrite.FMC_AddressSetupTime = 4; //5;
        timingWrite.FMC_AddressHoldTime = 0;
        timingWrite.FMC_DataSetupTime = 5; //6;
        timingWrite.FMC_BusTurnAroundDuration = 1;
        timingWrite.FMC_CLKDivision = 0;
        timingWrite.FMC_DataLatency = 0;
        timingWrite.FMC_AccessMode = FMC_AccessMode_A;

        timingRead.FMC_AddressSetupTime =4;// 5;
        timingRead.FMC_AddressHoldTime = 0;
        timingRead.FMC_DataSetupTime =5;// 6;
        timingRead.FMC_BusTurnAroundDuration = 1;
        timingRead.FMC_CLKDivision = 0;
        timingRead.FMC_DataLatency = 0;
        timingRead.FMC_AccessMode = FMC_AccessMode_A;

        init.FMC_Bank = FMC_Bank1_NORSRAM4;
        init.FMC_DataAddressMux = FMC_DataAddressMux_Disable;
        init.FMC_MemoryType = FMC_MemoryType_SRAM;
        init.FMC_MemoryDataWidth = FMC_NORSRAM_MemoryDataWidth_16b;
        init.FMC_BurstAccessMode = FMC_BurstAccessMode_Disable;
        init.FMC_AsynchronousWait = FMC_AsynchronousWait_Disable;        
        init.FMC_WaitSignalPolarity = FMC_WaitSignalPolarity_Low;
        init.FMC_WrapMode = FMC_WrapMode_Disable;
        init.FMC_WaitSignalActive = FMC_WaitSignalActive_BeforeWaitState;
        init.FMC_WriteOperation = FMC_WriteOperation_Enable;
        init.FMC_WaitSignal = FMC_WaitSignal_Disable;
        init.FMC_ExtendedMode = FMC_ExtendedMode_Enable;
        init.FMC_WriteBurst = FMC_WriteBurst_Disable;

        init.FMC_ReadWriteTimingStruct = &timingRead;
        init.FMC_WriteTimingStruct = &timingWrite;

        FMC_NORSRAMInit(&init);

        /* - BANK 1 (of NOR/SRAM Bank 1~4) is enabled */
        FMC_NORSRAMCmd(FMC_Bank1_NORSRAM4, ENABLE);
}
理论上裸机使用此配置正确,没道理加了rt-thread就不行了,所以很郁闷!!
怀疑是否rt-thread初始化的外设和FSMC相冲突了,但屏蔽了rt-thread初始化配置的唯一外设-----串口(当然系统时钟不能屏蔽),也给屏蔽了,问题还是在!!所以彻底郁闷了
期盼大神给我指点指点!!谢谢!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
7条回答
60user91
2019-07-15 10:24
dingyang598 发表于 2018-12-6 12:33
参数都有问题了,进入函数后不会引起错误吗

STM32的库函数确实会对参数进行检查,比如FMC_NORSRAMInit函数,会对FMC_AddressHoldTime 做检查,因为配置LCD时这个参数没有用到,说以配置为0,但是FMC_NORSRAMInit内部断言assert_param检查范围应是1~15,我并没开启断言检查,所以根据断言函数执行会成((void)0),在裸机时没有问题,不知道为什么加了rt-thread系统后程序会跑飞,大神你知道不?

一周热门 更多>