cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Data to TFT/LCD via FMC fails

MGuth.1
Associate III

Hi

I'm struggling with a TFT Display and a Nucleo U575 board. The Display is a 320x240px Display that I want to control with a 16 bit FMC interface.

As the Display doesn't show anything, I connected my Logic analyzer to the Nucleo's FMC Pins.

Result: It seems, that the commands (8-bit) are sent correctly to the TFTs D0:D7 pins. However when I try to send data (e.g. a 16 bit color) to the display it's also just D0:D7 that turn high/low. D8:D15 are always low when data is sent and are always high wen nothing is sent.

I followed this guide by NickNagy on github. He's using a 8-bit interface. However I changed to the 16-bit command for sending data and I can't find the mistake I obviously made.

Can someone help me please? :sleepy_face:

I uploaded the code to my github

Thanks a lot in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
MGuth.1
Associate III

Gooood news!

The screen is running now! It shows different colors and I'm even able to display a jpg image that I converted to a hex-array 😍

As I said above, I can't really tell what made the FMC work.It just worked from one second to the other.

After adjusting the timing settings, everything is displayed correctly on the LCD.

Things to do:

  • optimize the functions to manipulate the screen. e.g. drawing squares, circles, lines, ... in different colors
  • adjust gama settings and so on as the colors shown right now are not really what they should look like
  • add DMA support to decrease processor load

For everyone who's in trouble like I was: feel free to check out the Github repo. I'll continue to work on it until it works properly 🙂

Thanks again @Mecanix​ and @Community member​ for your help!

View solution in original post

16 REPLIES 16
Mecanix
Senior

Any reason why you need to use the FMC for that TFT/ST7789? Versus 16-bits gpio bus...

Mecanix
Senior

Here's a 16b FMC for the same screen which I've once used to test performance. Works great however the gpio bus wins hands down (my 2c). See if you can find clues in there...

Have you set FMC to non-multiplexed 16-bit mode? Have you set properly GPIO for D9-D15? Read out and check/post content of FMC and GPIO registers.

JW

Hi Mecanix

Thanks for sharing your code! I checked it and the only difference in the code that I can see is that you're handling the writedata() and writecommand() functions slightly different to my approach.

I just ported your project to my Nucleo board and I can see a very clean output on my logic analyzer on all 16 data lines. However when wiring up my display I don't get to see anything...

I also used your way of handling the writedata() and writecommand() in my original project but I still get the same output. commands are sent on lines D0:D7 but not with the correct values. Also when sending data with 16 bit length only lines D0:D7 are oscilating high/low. Lines D8:D15 are always low when sending data.

Is the address I used wrong? I'm using 0x6000 0000 for commands - using Bank1 (0x60) NOR/PSRAM 1 (00) with A18 and 16 bits (0000?!)

Thanks for your input!

I can't decide between multiplexed or non-multiplexed mode. I just chose LCD interface, CS = NE1, LCD Register Select = A18 and 16 bits Data width.

All FMC pins (D0-D15 as well as NOE, NE1, NWE,...) are set with:

  • GPIO mode: Alternate Function Push Pull
  • GPIO Pull-up/Pull-down: No pull-up and no pull-down
  • Maximum output speed: Very High

FMC Settings:

  • Memory type: LCD interface
  • Bank: Bank 1 NOR/PSRAM 1
  • Write operation: Enabled
  • Write FIFO: Disabled
  • Extended mode: Disabled
  • Address setup time: 15 HCLK clock cycles
  • Data setup time : 255 HCLK clock cycles
  • Data hold time: 2 HCLK clock cycles
  • Bus turn around: 15 HCLK clock cycles

For the FMC_Reset Pin I chose PE2 with

  • GPIO output level: low
  • GPIO mode: Output Push Pull
  • GPIO Pull-up/Pull-down: No pull-up and no pull-down
  • Maximum output speed: low
//FMC Write addresses (16bits)
//A18
#define ST7789_REG *(__IO uint16_t *)(((uint32_t)0x60000000))
#define ST7789_RAM *(__IO uint16_t *)(((uint32_t)0x60000000) + (1 << (18+1))) 

"...However when wiring up my display I don't get to see anything".

Interesting, let's see that display/hardware. You probably just forgot to set the TFT's interface to 16bits and the thing pulls it down, dunno. For example: one I'm using here requires IM0/1/2 inputs to be LOW for 16-bits. You have the pinout of your display and it's interfacing modes (datasheet) so we can have a look?

0693W00000NqnyLQAR.jpg 

> I can't decide between multiplexed or non-multiplexed mode.

It depends on the actual hardware. Unless you have an address latch (which you probably don't have, otherwise you would have known), you use non-multiplexed mode.

Read out and check/post content of FMC and GPIO registers.

JW

I used your formular for the address so I'm with 0x60000000 for commands and (0x60000000 + (1 << 19)) for data transfer

I'm having the same IM0-IM2 settings as your screen. I'm connecting all 3 ports to GND. Also I'm connecting DB9 and DB0 to GND as well as all other not used pins (such as SPI-pins for example.

I'm wiring DB17:DB10(LCD) to DB15:DB8(STM32) and DB8:DB1(LCD) to DB7:DB1(STM32). That should be correct I think.

I really think that the problem is on the Nucleo/Code side as I'm not getting any valid output for the Data lines when sending the data for each pixel...