cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 Discovery fsmc lcd problem

Dawid Brzakala
Associate II
Posted on September 05, 2017 at 20:33

I am trying to use fsmc to control my lcd display, but I can't init lcd from my code. I configured fsmc as lcd interface memory type in CubeMx, but there is something wrong with reading registers value, when I'm trying to read register R00h, I'm getting value 0, when reading R01h, it returns 1 etc.

This is problem with my lcd, or there is something wrong with my code?

#stm32f4-discovery #fsmc
2 REPLIES 2
Posted on September 06, 2017 at 19:55

Hello!

1. in your main function you use HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, 1); 

NE1 pin is controlled automaticaly from FSMC. no need to set it manualy.

2. you use this function

static __inline uint16_t ReadReg(uint8_t Reg)

{

    volatile uint16_t dummy;

    SSD1289_REG = Reg;

    dummy = SSD1289_RAM;

    return (SSD1289_RAM);

}

you read the ram twice. . The first time by put the address ...and the second time ...What is the address? 

Don't forget that you use 16 bit wide bus . Not 8

modify it to

static __inline uint16_t ReadReg(uint8_t Reg)

{

    SSD1289_REG = Reg;

    return (SSD1289_RAM);

}

3 . Timing.DataSetupTime = 255;

No need to be too high. Near 25 is Ok

Try first to read the ID of ssd1289 by reading the address 0x0000 just to check if your code is functional.

Check also the Reset pin of your LCD.(I don't see if is  somewhere connected)

Regards

VF

Dawid Brzakala
Associate II
Posted on September 06, 2017 at 23:13

Hi,

thank you for reply

1. you are right, I put it only for debug and I forget to remove this

2. I put this read to dummy, because I saw this in examples

3. I just left default value. I intended to adjust this when LCD will start working

Reset pin is pulled up to 3V

I modified RedReg as you said, but reading address 0x0000 still returns 0.

This is common that with unconnected/not working LCD reading address 0x0000 returns 0, 0x0001 returns 1, and so on?

In case my LCD is broken(I ordered this one from China) I ordered another one, I hope it will arrive till friday.

Thanks for your help

Regards

Dawid