2
\$\begingroup\$

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.

\$\endgroup\$
7
  • \$\begingroup\$ Use DMA with SPI with 3x8bit RGB and interleave W/R frames when updates are needed \$\endgroup\$ Apr 8, 2017 at 20:33
  • \$\begingroup\$ Or use 18bit with ILI9325 GRAM driver with effortless SPI and no redundant bytes \$\endgroup\$ Apr 8, 2017 at 20:52
  • 1
    \$\begingroup\$ Your question's a bit unclear. Are you using HSPI or UART? You should also specify the LCD controller. \$\endgroup\$ Apr 9, 2017 at 0:38
  • \$\begingroup\$ Assuming it's the ILI9163, you can switch to the 4-wire SPI interface if you have access to the D/CX, IM2 and 4WSPI pins of the controller. \$\endgroup\$ Apr 9, 2017 at 0:49
  • \$\begingroup\$ @TisteAndii I am using usart peripheral in spi mode \$\endgroup\$
    – Ankit
    Apr 9, 2017 at 9:25

3 Answers 3

0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Hmm. I did try something similar to what you suggest where I sort of cache the Lcd writes till a buffer of 72 bits is full and then send it all out once it's full. But I did not notice any significant increase in speed owing to all the shifts I had to do to store 9 bit value in a byte array . also added the controller and Lcd details to the question \$\endgroup\$
    – Ankit
    Apr 9, 2017 at 9:29
0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Good point. It was an oversight on my part to not have specified the controller earlier. That being said, I am aware of the mode you referred to, but unfortunately from all the information I have been able to gather from the net, this particular mode is not enabled on this Lcd (the d/c pin is not accessible) hence one is stuck using the 9 bit mode. Maybe I should add this to the question as well. Thanks! \$\endgroup\$
    – Ankit
    Apr 10, 2017 at 16:54
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.