2014-03-04 05:55 AM
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
2014-03-04 06:53 AM
What is the problem?
The FSMC/FMC not correctly, or similarly, configured?2014-03-04 08:00 AM
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.
2014-03-04 08:37 AM
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;