打印
[STM32L1]

103VC FSMC HAL可以点亮TFT 标准库死活没反应,用过的请指点

[复制链接]
960|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
tidal|  楼主 | 2016-5-3 12:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
void sLCD_GPIO_Config(void)
{
    GPIO_InitTypeDef GPIO_InitStructure;   
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);       

    /*
        FSMC Data ¹Ü½Å³õʼ»¯ D0~D15
    */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14 | GPIO_Pin_15 | GPIO_Pin_8 |
                                    GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_0 |
                                    GPIO_Pin_1 ;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_Init(GPIOD, &GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 |
                                    GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 |
                                    GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15 ;
    GPIO_Init(GPIOE, &GPIO_InitStructure);

    /*
        CS      RW      RD      RS
    */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_4 | GPIO_Pin_5 |
                                    GPIO_Pin_11;
    GPIO_Init(GPIOD, &GPIO_InitStructure);

    /*
        SSD_TE
    */
    GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_6;
                GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
    GPIO_Init(GPIOD, &GPIO_InitStructure);
               
                GPIO_SetBits(GPIOD, GPIO_Pin_7);   //CS=1
    GPIO_SetBits(GPIOD, GPIO_Pin_14| GPIO_Pin_15 |GPIO_Pin_0 | GPIO_Pin_1|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10);   
    GPIO_SetBits(GPIOE, GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10| GPIO_Pin_11| GPIO_Pin_12| GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15);   
  //GPIO_ResetBits(GPIOE, GPIO_Pin_0);
  //GPIO_ResetBits(GPIOE, GPIO_Pin_1);   //RESET=0
    GPIO_SetBits(GPIOD, GPIO_Pin_4);      //RD=1
    GPIO_SetBits(GPIOD, GPIO_Pin_5);   //WR=1   
               
    /*
        backlight
    */
//    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;                                 //LED0-->PE.2 ¶Ë¿ÚÅäÖÃ
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;                  //ÍÆÍìÊä³ö
//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;                 //IO¿ÚËÙ¶ÈΪ50MHz
//    GPIO_Init(GPIOB, &GPIO_InitStructure);                                           //ÍÆÍìÊä³ö £¬IO¿ÚËÙ¶ÈΪ50MHz
}
void sLCD_FSMC_Config(void)
{           
    FSMC_NORSRAMInitTypeDef  FSMC_NORSRAMInitStructure;
    FSMC_NORSRAMTimingInitTypeDef  FSMC_NORSRAMTimingInitStructure;
       
//    FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;
//    FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;        
//    FSMC_NORSRAMStructInit(&FSMC_NORSRAMInitStructure);

       
    //RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
    FSMC_NORSRAMTimingInitStructure.FSMC_AddressSetupTime = 2;
    FSMC_NORSRAMTimingInitStructure.FSMC_AddressHoldTime = 0;
    FSMC_NORSRAMTimingInitStructure.FSMC_DataSetupTime = 5;
    FSMC_NORSRAMTimingInitStructure.FSMC_BusTurnAroundDuration = 0x00;
    FSMC_NORSRAMTimingInitStructure.FSMC_CLKDivision = 0x00;
    FSMC_NORSRAMTimingInitStructure.FSMC_DataLatency = 0x00;
    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_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_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_AsynchronousWait = FSMC_AsynchronousWait_Disable;
    FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
    FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
    FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;
    FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;       

    FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
    FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
}
沙发
mmuuss586| | 2016-5-3 19:33 | 只看该作者
用示波器看下FSMC的时序,是否满足TFT屏的接口需求

使用特权

评论回复
板凳
wuwenfengmi| | 2020-3-30 23:00 | 只看该作者
我标准库可以实现功能,但hal库就是不行

使用特权

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

本版积分规则

5

主题

15

帖子

0

粉丝