STM32
直播中

王树林

8年用户 1751经验值
私信 关注
[问答]

STM32L152驱动段码屏一直卡死在初始化部分怎么解决?

确认过板子的硬件没有问题,能用IO口直接驱动点亮。用芯片内部驱动就会出问题。以下是我的初始化代码:
void LCD_GLASS_Init(void)
{
  LCD_InitTypeDef LCD_InitStructure;


  LCD_GPIOConfig(); /*!< Configure the LCD Glass GPIO pins */

  /*!< Configure the LCD interface -------------------------------------------*/
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD, ENABLE); /*!< Enable LCD APB1 Clock */

  LCD_InitStructure.LCD_Prescaler = LCD_Prescaler_8;
  LCD_InitStructure.LCD_Divider = LCD_Divider_16;
  LCD_InitStructure.LCD_Duty = LCD_Duty_1_8;
  LCD_InitStructure.LCD_Bias = LCD_Bias_1_4;
  LCD_InitStructure.LCD_VoltageSource = LCD_VoltageSource_Internal;
  LCD_Init( LCD_InitStructure);

  //LCD_HighDriveCmd(ENABLE);
  /*!< Configure the Pulse On Duration*/
  LCD_PulseOnDurationConfig(LCD_PulseOnDuration_2);

  /*!< Configure the LCD Contrast (3.51V) */
  LCD_ContrastConfig(LCD_Contrast_Level_4);

  /*!< Wait Until the LCD FCR register is synchronized */
  LCD_WaitForSynchro();

  /*!< Enable LCD peripheral */
  LCD_Cmd(ENABLE);

  /*!< Wait Until the LCD is enabled */
  while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET)
  {
  }
  /*!< Wait Until the LCD Booster is ready */  
  while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET)
  {
  }

}


回帖(1)

杨勇

2024-4-16 10:17:34
检查一下外部的VLCD引脚的上电容。使用内部电压转换器必须有这个电容的。剩下的启动软件检查标志位,至少能通过转换器判断的标志位。另外软件库里有很多例程代码可以试试
举报

更多回帖

发帖
×
20
完善资料,
赚取积分