TransWikia.com

Driving Nokia TFT LCD with STM32

Electrical Engineering Asked by Ankit on November 28, 2020

How do I increase the refresh rate of a Nokia LCD that I’m driving using the STM32F103 microcontroller?

The LCD is 132*162 and takes a 9-bit instruction/DATA with RGB for each pixel in 565 format. Since SPI on STM32 can’t do 9 bits, I’m using USART (running at maximum 4,000,000 bit/s max as I’m using HSPI) in 9-bits mode to drive the LCD.

This works just fine, but the refresh rate is not that great. Right now it takes me 230 ms approx to write the whole screen.

Doing rough calculations, (132*162*2*9)/4e6 = 97 ms. Mine is higher because of overheads + the fact that I need to mirror each byte before sending as USART does LSB first only.

I am looking for some suggestions as to how can I reduce the refresh rate.

  1. Use DMA? I am not sure how useful it would be in this case as my microcontroller is just driving the LCD. Nothing else.

  2. Buffer the LCD display in RAM and send it out to the LCD in one go. I can’t do as the microcontroller has only 16 KB RAM.

  3. Bit bang GPIO to drive the LCD. I am not sure if this would achieve a rate more that 4 MHz of USART. Plus with this I lose the ability to use DMA in the future if required.

The LCD I’m using is used in the Nokia C100 series and use the controller SPFD54124B.

3 Answers

You are using LCD with serial interface. That has big impact on the speed. You should use LCD with parallel interface if you want to speed up refresh rate significantly.

Answered by Chupacabras on November 28, 2020

The SPFD54124B has a 4-pin, 8 bit SPI interface. Simply use that instead of the 3-pin 9 bit "SPI-alike" interface.

See the datasheet page 118 following.

The four-pin SPI interface uses a

  • "CSX": Chip Select (MCU->display controller)
  • "SCL": Serial Clock (->)
  • "DCX": Data||command (->)
  • "SDA": Data (->)

CSX, SCL, SDA can be handled fully automatically by SPI hardware on your MCU. DCX would need to be a GPIO. That's not a problem. You can just set the GPIO pin to data, stream out your high-rate pixel data, then catch the interrupt when that is done, toggle the DCX pin, send commands, catch the interrupt when it's done, and switch back to data mode.

Really, I'm kind of sad it took you so long to say which controller you use. You could have had an answer much, much quicker.

Answered by Marcus Müller on November 28, 2020

You want something that looks like SPI, so I'd try to make SPI work.

Assuming your LCD (which you might want to specify) doesn't need some specific timing in between words, you should just use the word modes that the STM32F1 has to offer (8 or 16 bits, iirc), and push out 8 words at once – that'd be 72 bits, and that can be broken into 9 SPI transfers.

Answered by Marcus Müller on November 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP