question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ST7789 - maximum height and width?

See original GitHub issue

Type of Raspberry Pi

Raspberry Pi 3 A+

Linux Kernel version

Linux pi3aplus-5 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux

Expected behaviour

Expecting the display to show full screen across all 240x320 pixels on the ST7789 2.0 inch display

Actual behaviour

st7789_240x320_lumalcd_partialscreensize

(Note: In the photo only, colours are slightly over-bright and washed out as I’ve brightened it up to show the hardware and silkscreen more clearly to clarify exactly what sort of device I’m using. The output that is showing correctly, looks correct as per other ST77xx displays)

Only getting the pixels correctly displaying on the top two thirds of the display, with “scrambled data/corruption” showing in the lower third. I have two of these displays, from the same supplier, and both are doing the same, so I think I can rule out the individual display being at “fault”.

I’ve tried adjusting the height and width (swapping 320 and 240 between height and width), also tried rotate which only rotated within the working two-thirds of the screen.

When I run any demo from luma.examples, I note that it shows “240 x 240” for the Dimensions line, despite having an expected output of 240x320 (or 320x240)

python3 colors.py  --conf ../conf/st7789_240x320.conf
Version: luma.lcd 2.9.0 (luma.core 2.3.1)
Display: st7789
Interface: spi
Dimensions: 240 x 240

My st7789_240x320.conf file contains:

--display=st7789
--interface=spi
--spi-bus-speed=48000000
--gpio-reset=24
--gpio-chip-select=8
--gpio-data-command=23
--gpio-backlight=18
--width=240
--height=320
--backlight-active=high

As noted, I’ve tried --width=320 and --height=240 but that hasn’t made any difference to my issue. Also may be worth noting that the content is centring in the middle of the 240x240 size rather than fitting to a 320 sized width or height.

The demos appear to output a Dimensions: 240 x 240 line with the ST7789 no matter what sizes I specify, even far smaller than the actual display’s correct sizes.

I’ve made two other custom .conf files for ST7735 (Open-Smart 160x80) and ST7789 (Open-Smart 240x240) screens this past week (which I plan to submit as PRs once I’ve worked through my other various ST77xx based displays to confirm they are working with luma.lcd), so feel I am correctly using the conf file and settings.

Is there a maximum height and width for ST7789 displays?

Because the luma.example demo files output a 240 x 240 from the demo_opts even though I’m setting a higher resolution, it makes me wonder if there is a hard-cap being set on the maximum resolution of the display by the repo, possibly even a fixed resolution for the ST7789, so I think my overall question is if there is a maximum height and width for the ST7789 display?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
matemaciekcommented, May 2, 2021

I’m definitely for this change, I was polishing already existing pull request and those hard coded dimensions were itching me, but I didn’t have different displays to test other sizes. The more generic code is, the better (-:

@SimUKdev your changes make total sense. As for changes in display(), can you try setting w to 320? Maybe the dimensions are swapped there. I also like the version from st7735 and I wouldn’t be surprised if it would work on st7789.

0reactions
Frederic98commented, Apr 24, 2022

I had the same issue with my display (from waveshare). After looking through the code and ST7789 datasheet, it turns out that the arguments to commands should be sent as data bytes, but the library sends it as command bytes. This causes the display to receive a SWRESET command (software reset), because a resolution of 320px is encoded as 0x01 0x3F.

I solved this in pull request #155 by splitting the command and arguments, and forwarding the argument bytes to self.data()

Read more comments on GitHub >

github_iconTop Results From Across the Web

ST7789VW - rhydoLABZ
Bump Height. 100 um. D. Bump Gap 2 (Vertical). 31 um. Symbol. Item. Size. E. Bump Width. 40 um. F. Bump Gap. 20、32.5、45...
Read more >
Adafruit 1.3" and 1.54" 240x240 Wide ... - Adafruit Industries
1.3" and 1.54" displays have 240x240 16-bit full color pixels and are IPS displays, so ... display = ST7789(display_bus, width=240, height=240, rowstart=80).
Read more >
Interfacing Arduino with ST7789 TFT Display - Simple Projects
This tutorial shows how to interface Arduino with ST7789 TFT. It is an IPS display which uses SPI protocol and has ... Full...
Read more >
ST7789V TFT LCD - ESPHome
On memory-constrained devices, it may be possible to use part of the display area by setting the model to “custom” and specifying a...
Read more >
ST7789 Controllers - - Great Cow BASIC documentation
This section covers GLCD devices that use the ST7789 graphics controller. The ST7789 is a TFT LCD ... A small 8 height pixel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found