cancel
Showing results for 
Search instead for 
Did you mean: 

Using STemWin with STM32F4Discovery and SSD1289 display

angeletti
Associate II
Posted on January 06, 2015 at 01:52

Hi guys, I need again a big help from you. I'm trying to use the STemWin software with STM32F4Discovery, without success for the moment. I followed these steps:

  1. Get examples for STM324x eval board
  2. Modify the driver to work with SSD1289

The display module is connected through FSMC and my driver for SSD1289 works perfectly but when adapted for STemWin, the program stucks at the function GUI_Init().

This is the SSD1289 code adapted:

/*********************************************************************
* Portions COPYRIGHT 2014 STMicroelectronics *
* Portions SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2013 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.22 - Graphical user interface for embedded applications **
All Intellectual Property rights in the Software belongs to SEGGER.
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with the following terms:
The software has been licensed to STMicroelectronics International
N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
troller products commercialized by Licensee only, sublicensed and dis_
tributed under the terms and conditions of the End User License Agree_
ment supplied by STMicroelectronics International N.V.
Full source code is available at: www.segger.com
We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : LCDConf.c
Purpose : Display controller configuration (single layer)
---------------------------END-OF-HEADER------------------------------
*/
/**
******************************************************************************
* @file LCDConf_stm3240g_eval.c
* @author MCD Application Team
* @version V1.1.2
* @date 28-January-2014
* @brief Driver for STM3240G-EVAL board LCD
******************************************************************************
* @attention
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the ''License'');
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an ''AS IS'' BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
#include ''GUI.h''
#include ''GUIDRV_FlexColor.h''
#include ''global_includes.h''
/*********************************************************************
*
* Layer configuration (to be modified)
*
**********************************************************************
*/
//
// 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
*
**********************************************************************
*/
//
// COG interface register addr.
//
#define LCD_BASE ((uint32_t)(0x60000000 ))
#define LCD_REG_ADDRESS (*((volatile unsigned short *) 0x60000000))//(*(volatile U16*)LCD_BASE)
#define LCD_DATA_ADDRESS (*((volatile unsigned short *) 0x60020000))//(*(volatile U16*)(LCD_BASE + 0x00020000))
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/********************************************************************
*
* LcdWriteReg
*
* Function description:
* Sets display register
*/
static
void
LcdWriteReg(U16 Data) {
LCD_REG_ADDRESS = Data;
}
/********************************************************************
*
* LcdWriteData
*
* Function description:
* Writes a value to a display register
*/
static
void
LcdWriteData(U16 Data) {
LCD_DATA_ADDRESS = Data;
}
/********************************************************************
*
* LcdWriteDataMultiple
*
* Function description:
* Writes multiple values to a display register.
*/
static
void
LcdWriteDataMultiple(U16 * pData, 
int
NumItems) {
while
(NumItems--) {
LCD_DATA_ADDRESS = *pData++;
}
}
/********************************************************************
*
* LcdReadDataMultiple
*
* Function description:
* Reads multiple values from a display register.
*/
static
void
LcdReadDataMultiple(U16 * pData, 
int
NumItems) {
while
(NumItems--) {
*pData++ = LCD_DATA_ADDRESS;
}
}
/*********************************************************************
*
* 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, &PortAPI, GUIDRV_FLEXCOLOR_F66702, 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: {
/* Already Done */
//SSD1289_Init();
return
0;
}
default
:
r = -1;
}
return
r;
}
/*************************** End of file ****************************/

Any ideas? #ssd1289 #stm32f4 #stemwin
1 REPLY 1
Posted on January 15, 2015 at 11:57

Hi,

The SSD1289 LCD is supported by STemWin since 5.18 version. You have just need to configure the LCDConf file (by adding the basic write/read operation) and call the right controller in LCD_X_Config (for SSDD1289: GUIDRV_FLEXCOLOR_F66702)

Keep us informed about your finding.

Regards,

Heisenberg.