2016-10-06 12:38 AM
Hello Folks,
I am working on stm32f407vg EVM, I have interfaced MIDAS LCD using SPI. The LCD has ST7735s controller. Now I am able to make manual patterns of check box, circle and screen colour randomly but I need GUI to be implemented so I have chosen STemWin library , the library is ''STemWin522_CM4_IAR''. I read the user & reference guide of stemwin and found that I can go with ''GUIDRV_FlexColor'' drivers. I have done configurations in LCDconf.c (I have attached here). In GUIconf.c my configurations are as per below. &sharpdefine GUI_NUMBYTES (1024) * 15 // // Define the average block size // &sharpdefine GUI_BLOCKSIZE 0x128 I have initialised LCD controller before GUI_INIT(), I have also added ''RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE);'' But unfortunately after returning from ''LCD_X_DisplayDriver()'' function I am getting Hard fault so I need to understand why I am getting hard-fault and is there any issue in my configurations ? Please let me know if I can provide you more details. Any Help on this issue would be great appreciable. Thanks & Regards, Rutvij ---------------------------------------------------------------------- File : LCDConf.c Purpose : Display driver configuration file ---------------------------------------------------------------------- */ /** &sharpinclude <string.h> /* GUI main init as per StemWin */ &sharpinclude ''GUI.h'' /* As per STemWin 5 doc ST7735 Contoler IC's driver config */ &sharpinclude ''GUIDRV_FlexColor.h'' /* For callback registers of LCD */ &sharpinclude ''MCT0144C6W128128PML_App.h'' /********************************************************************* * * LCD_X_Config *w * Purpose: * Called during the initialization process in order to set up the * display driver configuration. * */ static void LcdWriteReg(U16 Data) { // ... TBD by user SPI_sendCommand(Data); } static void LcdWriteData(U16 Data) { // ... TBD by user SPI_sendData(Data); } static void LcdWriteDataMultiple(U16 * pData, int NumItems) { while (NumItems--) { // ... TBD by user SPI_sendData((uint8_t)*pData++); } } static void LcdReadDataMultiple(U16 * pData, int NumItems) { while (NumItems--) { // ... TBD by user *pData++=SPI_sendData(0x00); } } void LCD_X_Config(void) { GUI_DEVICE *pDevice = NULL; CONFIG_FLEXCOLOR Config = {0}; GUI_PORT_API PortAPI = {0}; /* Set display driver and color conversion */ /* 16 BPP configuration for st7735s */ /* from specificaly LCD side configure LCD to work on the same BPP This can be done by cofiguring LCD internal register go into ''ST7735_COLMOD'' in ''MCT0144C6W128128PML_App.c'' file */ /* for RGB - GUICC_M565 , for BGR - GUICC_565*/ pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0); // LCD_SetSizeEx (0, LCD_WIDTH , LCD_HEIGHT); LCD_SetVSizeEx(0, LCD_WIDTH, LCD_HEIGHT); // // 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_F66709 - for st7735 */ /* GUIDRV_FLEXCOLOR_M16C0B8 16bpp, no cache, 8 bit bus - SPI data bus */ GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B8); } /********************************************************************* * * LCD_X_DisplayDriver * * Purpose: * 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) { /* * Called during the initialization process in order to set up the * display controller and put it into operation. */ case LCD_X_INITCONTROLLER: { return 0; } default: { r = -1; } } return r; } /*************************** End of file ****************************/ #stemwin #stm32f407vg #st77352016-10-06 10:02 AM
Hello,
Refer to this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Problem%20getting%20STemWin%20to%20work%20with%20RA8875-Based%20LCD&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=338]thread and , may help you on this issue.Regards