cancel
Showing results for 
Search instead for 
Did you mean: 

Port Stm32F4-Discovery(SSD2119) STEmwin driver to stm32cube

totti001
Associate II
Posted on March 04, 2014 at 14:55

Hello everybody+

I try to port my old stemwin driver for ssd2119 to the new stm32cube version. My bug is at LCD conf file: My version like this:

#define LCD_BASE_Addr ((U32)(0x60000000|0x00000000))
#define LCD_BASE_Data ((U32)(0x60000000|0x00100000))
#define LCD_CMD (*(U16 *)(LCD_BASE_Addr))
#define LCD_Data (*(U16 *)(LCD_BASE_Data))
/********************************************************************
*
* LcdWriteReg
*
* Function description:
* Sets display register
*/
static void LcdWriteReg(U16 Data) {
LCD_CMD = Data;
}
/********************************************************************
*
* LcdWriteData
*
* Function description:
* Writes a value to a display register
*/
static void LcdWriteData(U16 Data) {
LCD_Data = Data;
}
/********************************************************************
*
* LcdWriteDataMultiple
*
* Function description:
* Writes multiple values to a display register.
*/
static void LcdWriteDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
LCD_Data = *pData++;
}
}
/********************************************************************
*
* LcdReadDataMultiple
*
* Function description:
* Reads multiple values from a display register.
*/
static void LcdReadDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
*pData++ = LCD_Data;
}
}

I try this version but not working:

typedef struct
{
__IO uint16_t LCD_REG;
__IO uint16_t LCD_RAM;
} LCD_TypeDef;
#define LCD_BASE ((uint32_t)(0x60000000 | 0x00000000))
#define LCD ((LCD_TypeDef *) LCD_BASE)
/********************************************************************
*
* LcdWriteReg
*
* Function description:
* Sets display register
*/
static void LcdWriteReg(U16 Data) {
LCD_BASE->LCD_REG = Data;
}
/********************************************************************
*
* LcdWriteData
*
* Function description:
* Writes a value to a display register
*/
static void LcdWriteData(U16 Data) {
LCD_BASE->LCD_RAM = Data;
}
/********************************************************************
*
* LcdWriteDataMultiple
*
* Function description:
* Writes multiple values to a display register.
*/
static void LcdWriteDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
LCD_BASE->LCD_RAM= *pData++;
}
}
/********************************************************************
*
* LcdReadDataMultiple
*
* Function description:
* Reads multiple values from a display register.
*/
static void LcdReadDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
*pData++ =LCD_BASE->LCD_RAM;
}
}

I try this at Base address: (0x60000000|0x00100000) but not working. What is the problem? Thanks #stm32-stemwin-discovery-ssd2119
3 REPLIES 3
Posted on March 04, 2014 at 15:53

What is the problem?

The FSMC/FMC not correctly, or similarly, configured?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
totti001
Associate II
Posted on March 04, 2014 at 17:00

I change only this lines at the code. I think the problem is the address pin selection. So the working version use address 0x60000000 for select register and use 0x60100000 address to set data. But I dont know how can I do this with the struct.

Posted on March 04, 2014 at 17:37

You'd presumably have to put ~1MB of padding into the structure to get the address separation you're attempting to achieve.

typedef struct
{
__IO uint16_t LCD_REG; // @ 0x000000
__IO uint16_t LCD_JUNK[0x7FFFF];
__IO uint16_t LCD_RAM; // @ 0x100000
} LCD_TypeDef;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..