打印
[STM32F1]

stm32 fsmc 配置好后,端口无任何输出变化,求解答

[复制链接]
1332|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
eva5232314|  楼主 | 2015-3-25 09:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
使用的是stm32f103z,想用它驱动lcd的,lcd是8位数据宽度,主代码:
/* main function ------------------------------------------------------------------*/
int main(void)
{       
        RCC_Configuration();
       
        //ENABLE PERIPH CLOCK
                RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB
        | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE
        | RCC_APB2Periph_AFIO, ENABLE);
        //
        RCC_APB2PeriphClockCmd(RCC_AHBPeriph_FSMC,ENABLE);
       
        //CONFIG PERIPH FUNCTION
        GPIO_Configuration();
        FSMC_cfg();


        GPIO_ResetBits(GPIOD, GPIO_Pin_7);
        while(1)
        {
                wait();
                *(vu8 *)(0x60000000)=0x00;
                GPIO_SetBits(GPIOB, GPIO_Pin_5);
                wait();

                *(vu8 *)(0x60000000)=0xff;
                GPIO_ResetBits(GPIOB, GPIO_Pin_5);


        }
}

//FSMC 配置是这样的,用的是bank1 block1:
void FSMC_cfg(void)
{

                FSMC_NORSRAMInitTypeDef  FSMC_NORSRAMInitStructure;
                FSMC_NORSRAMTimingInitTypeDef  FSMC_NORSRAMTimingInitStructure;


         /*-- FSMC Configuration ----------------------------------------------------*/
                FSMC_NORSRAMTimingInitStructure.FSMC_AddressSetupTime = 1;     
                FSMC_NORSRAMTimingInitStructure.FSMC_AddressHoldTime = 2;  
                FSMC_NORSRAMTimingInitStructure.FSMC_DataSetupTime = 2;     
                FSMC_NORSRAMTimingInitStructure.FSMC_BusTurnAroundDuration = 1;  
                FSMC_NORSRAMTimingInitStructure.FSMC_CLKDivision = 0x00;     
                FSMC_NORSRAMTimingInitStructure.FSMC_DataLatency = 0x02;     
                FSMC_NORSRAMTimingInitStructure.FSMC_AccessMode = FSMC_AccessMode_B;   

                FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1;   

                FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;

                FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR;   

                FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b;  

                FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_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_AsynchronousWait = FSMC_AsynchronousWait_Disable;  
         
                FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;   

                FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;  

                FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;
                                                                         
                FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);//

                /* Enable FSMC Bank1_NOR Bank */
                FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);//
}

//这样配置后 NE口 NWE口 DB0-7无任何输出变化
沙发
zh113214| | 2015-3-25 09:53 | 只看该作者
帮顶!!!

使用特权

评论回复
板凳
周董| | 2015-3-25 10:13 | 只看该作者
需要把这一项里面相关的参数改为自己实际的定义

使用特权

评论回复
地板
搞IT的| | 2015-3-25 10:13 | 只看该作者
不是很明白。。

使用特权

评论回复
5
mmuuss586| | 2015-3-25 12:25 | 只看该作者
FSMC.rar (3.21 MB)
发些资料给你参考下;

使用特权

评论回复
6
mmuuss586| | 2015-3-25 12:26 | 只看该作者
FSMC.rar (126.36 KB)
这是官方的;

使用特权

评论回复
7
ilikerome| | 2015-3-26 07:15 | 只看该作者
是不是没有启动、使能呀。。。

使用特权

评论回复
8
lei129210| | 2015-3-26 11:12 | 只看该作者
GPIO配置应该有问题。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝