首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >STM32CubeF7 BSP液晶屏尝试

STM32CubeF7 BSP液晶屏尝试
EN

Stack Overflow用户
提问于 2017-07-29 18:05:38
回答 1查看 1.6K关注 0票数 0

我正在尝试使用STM32CubeF7的BSP库在stm32f769i-disco的LED上显示一个字符串。但是,什么也不会发生。代码如下:

代码语言:javascript
复制
#include "stm32f7xx_hal.h"
#include "stm32f769i_discovery.h"
#include "stm32f769i_discovery_lcd.h"
#include "stm32f7xx.h"
#include <stdio.h>

char str[] = "Hello from BSP LCD demo!";

void LCDInit() {
    // Initialize the LCD using the BSP_LCD_Init() function.
    BSP_LCD_Init();

    // Select the LCD layer to be used using the BSP_LCD_SelectLayer() function.
    //BSP_LCD_SelectLayer(0);
    BSP_LCD_LayerDefaultInit(LTDC_DEFAULT_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
    BSP_LCD_SelectLayer(LTDC_DEFAULT_ACTIVE_LAYER);

    // Enable the LCD display using the BSP_LCD_DisplayOn() function.
    BSP_LCD_DisplayOn();

    // Clear the whole LCD using BSP_LCD_Clear() function or only one specified string line using the BSP_LCD_ClearStringLine() function.
    BSP_LCD_Clear(LCD_COLOR_LIGHTGRAY);
    HAL_Delay(1000);

    BSP_LCD_SetBackColor(LCD_COLOR_LIGHTGRAY);
    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);

    // Display a character on the specified line and column using the BSP_LCD_DisplayChar() function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
    BSP_LCD_DisplayStringAt(100, 100, str, CENTER_MODE);
}

int main(void) {
    LCDInit();
    BSP_LED_Init(LED_GREEN);

    while(1) {
        for (int i=0;i<1000000;i++);
        BSP_LED_Toggle(LED_GREEN);
    }

    return 0;
}

如果我删除对LCDInit的调用,我的发光二极管切换,如果我调用LCDInit,什么也没有发生(发光二极管不切换),并且液晶屏保持黑色。有什么想法吗?

我基本上已经尝试遵循stm32f769i_discovery_lcd.c中的说明,但没有成功:

代码语言:javascript
复制
2. Driver description:
---------------------
  + Initialization steps:
     o Initialize the LCD using the BSP_LCD_Init() function.
     o Select the LCD layer to be used using the BSP_LCD_SelectLayer() function.
     o Enable the LCD display using the BSP_LCD_DisplayOn() function.

  + Options
     o Configure and enable the color keying functionality using the
       BSP_LCD_SetColorKeying() function.
     o Modify in the fly the transparency and/or the frame buffer address
       using the following functions:
       - BSP_LCD_SetTransparency()
       - BSP_LCD_SetLayerAddress()

  + Display on LCD
     o Clear the whole LCD using BSP_LCD_Clear() function or only one specified string
       line using the BSP_LCD_ClearStringLine() function.
     o Display a character on the specified line and column using the BSP_LCD_DisplayChar()
       function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
     o Display a string line on the specified position (x,y in pixel) and align mode
       using the BSP_LCD_DisplayStringAtLine() function.
     o Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap)
       on LCD using the available set of functions.

编辑:当使用OpenOCD进行调试时,如果我在BSP_LCD_Init()行设置断点,gdb就会挂起。如果我再次运行调试器,我可以看到程序停留在WWDG_IRQHandler ()。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-31 16:03:50

如果这对任何人都有帮助,我将发布我的问题(关于HAL库):

我没有特别添加任何处理覆盖中断处理程序的代码,结果发现甚至HAL_init()调用都被阻塞了,因为我没有添加以下内容:

代码语言:javascript
复制
void SysTick_Handler(void)
{
     HAL_IncTick();
}

正因为如此,我的HAL_Delay将永远等待。可能最好在开始时使用STM32CubeF7 templates文件夹中提供的模板,这样您就不会犯与我相同的错误。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45387942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档