你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

stm32f373C-EVAL 移植stemwin

[复制链接]
少韶 提问时间:2014-3-12 17:56 /
各位好,向大伙求助一个问题:我在官网下载的STemWin_Library_V1.1.2,然后运行STemWinDemo.eww工程,结果为什么一运行到GUI_init()后就出现黑屏啊? 我用的是stm32f373C-EVAL ,其中官网自带了移植好的程序,两个运行都是这样的问题!(已经确定在不移植时可以正常显示)
收藏 评论6 发布时间:2014-3-12 17:56

举报

6个回答
fengye5340 回答时间:2014-3-12 20:33:04

RE:stm32f373C-EVAL 移植stemwin

你打开了CRC模块的时钟了吗?
少韶 回答时间:2014-3-12 20:45:26

回复:stm32f373C-EVAL 移植stemwin

恩,打开了!而且GUI_init()返回为0,手册上面说是初始化成功。
fengye5340 回答时间:2014-3-13 11:57:50

回复:stm32f373C-EVAL 移植stemwin

回复第 3 楼 于2014-03-12 20:45:26发表:
恩,打开了!而且GUI_init()返回为0,手册上面说是初始化成功。 

/* Activate the use of memory device feature */
  WM_SetCreateFlags(WM_CF_MEMDEV);
这一句也有吧,如果你的屏幕黑屏,说明你的那个驱动文件没有配置好,
你的演示版屏是自带的吧?GUI 驱动函数参考
LCDConf_stm32373c_eval.c
这个文件,里面没有配置好,也容易出现黑屏
少韶 回答时间:2014-3-13 13:02:05

RE:stm32f373C-EVAL 移植stemwin

恩,谢谢你的回复!
评估板上的屏幕是自带的,官网刚好也有对应的例程。出现这样的错误我想也是驱动文件没配置好。WM_SetCreateFlags(WM_CF_MEMDEV);这条指令加和不加效果是一样的,也就是可能是LCDConf_stm32373c_eval.c和GUIConf_stm32373c_eval.c这两个文件官方没有配置好。
/* 这是LCDConf_stm32373c_eval.c */
#include "GUI.h"
#include "GUIDRV_FlexColor.h"
#include "global_includes.h"

//
// Physical display size
//
#define XSIZE_PHYS  240
#define YSIZE_PHYS  320
/*********************************************************************
*
*       Configuration checking
*
**********************************************************************
*/
#ifndef   VXSIZE_PHYS
  #define VXSIZE_PHYS XSIZE_PHYS
#endif
#ifndef   VYSIZE_PHYS
  #define VYSIZE_PHYS YSIZE_PHYS
#endif
#ifndef   XSIZE_PHYS
  #error Physical X size of display is not defined!
#endif
#ifndef   YSIZE_PHYS
  #error Physical Y size of display is not defined!
#endif
#ifndef   GUICC_565
  #error Color conversion not defined!
#endif
#ifndef   GUIDRV_FLEXCOLOR
  #error No display driver defined!
#endif
/*********************************************************************
*
*       Defines, sfrs 这个也不清楚为什么这样配置
*
**********************************************************************
*/
#define START_BYTE         0x70
#define SET_INDEX          0x00
#define READ_STATUS        0x01
#define LCD_WRITE_REG      0x02
#define LCD_READ_REG       0x03
/*********************************************************************
*
*       Local functions
*
**********************************************************************
*/
/********************************************************************
*
*       LcdWriteReg
*
* Function description:
*   Sets display register
*/
static void LcdWriteReg(U16 Data) {
  LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
  LCD_WriteRegIndex (Data);
  LCD_nCS_StartByte(START_BYTE | LCD_WRITE_REG);
}
/********************************************************************
*
*       LcdWriteData
*
* Function description:
*   Writes a value to a display register
*/
static void LcdWriteData(U16 Data) {
  LCD_WriteRAM(Data);
  LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
}
/********************************************************************
*
*       LcdWriteDataMultiple
*
* Function description:
*   Writes multiple values to a display register.
*/
static void LcdWriteDataMultiple(U16 * pData, int NumItems) {
  
  while (NumItems--) {
    LCD_WriteRAM (*pData++);
  }
  
}
/********************************************************************
*
*       LcdReadDataMultiple
*
* Function description:
*   Reads multiple values from a display register.
*/
static void LcdReadDataMultiple(U16 * pData, int NumItems) {
  
  LCD_CtrlLinesWrite(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, Bit_SET);
  while (NumItems--) {
    *pData++ = LCD_ReadReg(R34);
  }
}
/*********************************************************************
*
*       Public functions
*
**********************************************************************
*/
/*********************************************************************
*
*       LCD_X_Config
*
* Function description:
*   Called during the initialization process in order to set up the
*   display driver configuration.
*
*/
void LCD_X_Config(void) {
  GUI_DEVICE * pDevice;
  CONFIG_FLEXCOLOR Config = {0};
  GUI_PORT_API PortAPI = {0};
  //
  // Set display driver and color conversion
  //
  pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0);
  //
  // Display driver configuration, required for Lin-driver
  //
  LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
  LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
  //
  // Orientation
  //
  Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_Y;
  GUIDRV_FlexColor_Config(pDevice, &Config);
  //
  // Set controller and operation mode
  //
  PortAPI.pfWrite16_A0  = LcdWriteReg;
  PortAPI.pfWrite16_A1  = LcdWriteData;
  PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
  PortAPI.pfReadM16_A1  = LcdReadDataMultiple;
  GUIDRV_FlexColor_SetFunc(pDevice, &amportAPI, GUIDRV_FLEXCOLOR_F66708, GUIDRV_FLEXCOLOR_M16C0B16);
}
/*********************************************************************
*
*       LCD_X_DisplayDriver
*
* Function description:
*   This function is called by the display driver for several purposes.
*   To support the according task the routine needs to be adapted to
*   the display controller. Please note that the commands marked with
*   'optional' are not cogently required and should only be adapted if
*   the display controller supports these features.
*
* Parameter:
*   LayerIndex - Index of layer to be configured
*   Cmd        - Please refer to the details in the switch statement below
*   pData      - Pointer to a LCD_X_DATA structure
*
* Return Value:
*   < -1 - Error
*     -1 - Command not handled
*      0 - Ok
*/
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
  int r;
  (void) LayerIndex;
  (void) pData;
  
  switch (Cmd) {
  case LCD_X_INITCONTROLLER: {
    STM32373C_LCD_Init();
    return 0;
  }
  default:
    r = -1;
  }
  return r;
}
这里是不是哪里还要改呢,“这原本是官网的”,运行GUI_init()后屏幕左边有一条窄的雪花状的矩形,右边是宽的黑屏。
fengye5340 回答时间:2014-3-13 13:29:55

RE:stm32f373C-EVAL 移植stemwin

你的屏幕能正常驱动吗?看到你描述的问题,是屏幕的扫描方向和坐标定位的问题。
Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_Y;
这里的参数,
GUI_SWAP_XY  
GUI_MIRROR_Y
GUI_MIRROR_X  
是控制显示方向的, 你调整一下这3个参数,
GUI_SWAP_XY | GUI_MIRROR_Y 这样的组合是屏幕旋转90°可能让你的屏现在不正确了
少韶 回答时间:2014-3-19 11:11:12

RE:stm32f373C-EVAL 移植stemwin

这几天有事去了,按照楼上的方法,我发现官方的驱动文件没写好!基本上没什么问题了,谢谢了!

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版