cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 with FMC and HX8347-controlled LCD

Nor Sch
Associate III
Posted on June 24, 2016 at 16:28

Hi there, I have some troubles with initializing my LCD with a HX8347-Controller. I have my Environment and all Settings generated with the actual Cube. I use FreeRTOS on a STM32F4 The LCD is with FMC on BANK1, NOR/.../LCD 2 connected and configered. I added also the additional Reset-Pin. The Background-LED is turned on, so that I should see everything. The Clocking is active.

Because of wish to later use emWin, the Configs (Templates) for STemWin are used. Mostly all of the simple Stuff is taken from the Templates and addapted. The CRC for emWin is also active. in the GUIConf.c I changed

#define GUI_NUMBYTES XSIZE_PHYS * YSIZE_PHYS * 2

in LCDConf.h I added

#define XSIZE_PHYS 240 // To be adapted to x-screen size
#define YSIZE_PHYS 320 // To be adapted to y-screen size

In GUIConf.h I reduced to 1 Layer and removed Support for Touch+Mouse. And now the real Thing, which should be also there in a similar Way without emWin: in the LCDConf_FlexColor.c I have (shortened) following things:


typedef
struct
{

__IO uint16_t REG;

__IO uint16_t RAM;

}LCD_CONTROLLER_TypeDef;


#define FMC_BANK1_BASE ((uint32_t)(0x60000000 | 0x04000000)) // BANK1_BASE | Offset for NOR / PSRAM 2 (64MB Offset)

#define FMC_BANK1 ((LCD_CONTROLLER_TypeDef *) FMC_BANK1_BASE)


typedef
enum
{

eLCD_DISPLAY_MODE_CONTROL = 0x01U,

eLCD_COLUMN_ADDRESS_START_2 = 0x02U,

eLCD_COLUMN_ADDRESS_START_1 = 0x03U,

...

eLCD_TEST_1 = 0x96U,

} TE_LcdRegister;


static
void
LcdWriteReg(U16 Reg) {

FMC_BANK1->REG = Reg; 
// write Data to [D0:D7]

}


static
void
LcdWriteData(U16 Data) {

FMC_BANK1->RAM = Data; 
// write Data to [D0:D15]

}


static
void
LcdWriteRegAndData(U16 Reg, U16 Data){

LcdWriteReg(Reg);

LcdWriteData(Data);

}


static
void
LcdReadDataMultiple(U16* pData, 
int
NumItems) {

for
(uint32_t ui=0; ui<NumItems; ui++) {

*pData = FMC_BANK1->RAM; 
// read Data from [D0:D15]

}

}


void
LCD_X_Config(
void
) {

...

pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0);

...

GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66712, GUIDRV_FLEXCOLOR_M16C0B16); 
// HX8347 with 16bpp, no cache, 16 bit bus

}


int
LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, 
void
* pData) {

...

switch
(Cmd) {

case
LCD_X_INITCONTROLLER:

LCD_PowerOn();

...

}


static
void
LCD_PowerOn(
void
){

// Init is done on Base of File ''COM24H2N57XLC_CPU_Interface_Oct2010_CA10pdf'' site 20

HAL_GPIO_WritePin(TFT2_RESETB_GPIO_Port, TFT2_RESETB_Pin, GPIO_PIN_SET);

osDelay(1);

HAL_GPIO_WritePin(TFT2_RESETB_GPIO_Port, TFT2_RESETB_Pin, GPIO_PIN_RESET);

osDelay(1); 
// 10µs would be enough, but don't have µs-Delay

HAL_GPIO_WritePin(TFT2_RESETB_GPIO_Port, TFT2_RESETB_Pin, GPIO_PIN_SET);

osDelay(120);

// Test1 setting

LcdWriteRegAndData(eLCD_TEST_1, 0x01);

// OSC Control setting

LcdWriteRegAndData(eLCD_OSC_CONTROL_1, 0x87);

osDelay(10);

...

}

So everything is pretty similar to different Examples I found. With Debuging I go trough all Functions as expected. But at the End there is nothing visible on my Display. Anyone with Ideas or Tipps? #stm32f3-stm32f4-emwin-fmc-hx8347
1 ACCEPTED SOLUTION

Accepted Solutions
Nor Sch
Associate III
Posted on October 11, 2016 at 10:47

My Post is already some Months old, but I found the Problem + Solution and want to add it here. As Address-Line the A1 was used and this needs a shift in the Data-Struct:

   typedef struct {

__IO uint16_t REG;

__IO uint16_t dummy;

__IO uint16_t RAM;

}LCD_CONTROLLER_TypeDef;   With A0 the Dummy is not needed, with A2 or higher, the Dummy must be greater ...

So it's solved.

View solution in original post

1 REPLY 1
Nor Sch
Associate III
Posted on October 11, 2016 at 10:47

My Post is already some Months old, but I found the Problem + Solution and want to add it here. As Address-Line the A1 was used and this needs a shift in the Data-Struct:

   typedef struct {

__IO uint16_t REG;

__IO uint16_t dummy;

__IO uint16_t RAM;

}LCD_CONTROLLER_TypeDef;   With A0 the Dummy is not needed, with A2 or higher, the Dummy must be greater ...

So it's solved.