Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : Pico with ST7920 LCD in SPI mode

Posted: 03:56am
13 Jul 2024
Copy link to clipboard
58kk90
Regular Member

I've been trying to get one of the ST7920 Chinese Ebay 128 x 64 LCD's running with a Pico without any success.
I am running version 5.08.00 and have the display wired in SPI mode following the wiring in an earlier thread on here.

Like this

LCD Reset (pin 17) goes to GP3
LCD RS (pin 4) goes to GP5
LCD RW (data in pin 5) goes to GP7
LCD E (clk pin 6) goes to GP6

Then I have Gnd connected to pins 1,15 and 20 and VCC connected to pins 2 and 19.

First problem I have is when I do

OPTION LCDPANEL ST7920, LANDSCAPE,GP5,GP3

I get an error   'Error : duplicated pin'

I have checked and neither GP5 or GP3 are used for anything else, this happens from the get go after an 'option reset' and with no program uploaded to the pico.

Anyone else tried these type of display's and had them working at all?

Tony.
 
Posted: 07:03am
13 Jul 2024
Copy link to clipboard
Mixtel90
Guru


I think you might need to set it up like this:
SETPIN GP5, DOUT 'the SETPIN commands may not be needed
SETPIN GP3, DOUT
OPTION SYSTEM SPI GP6, GP7, GP8 'this is the hardware SPI port
OPTION LCDPANEL ST7920, LANDSCAPE, GP5, GP3 'any pins can be used for these

You can't use that SPI bus for anything else as this display has a fixed CS that's always enabled. I must admit that I've not used one of these.
 
Posted: 08:44am
13 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Hi Mixtel90
Thank you for the help, I have tried what you suggest,  following an 'option reset' I enter

SETPIN GP5, DOUT
SETPIN GP3, DOUT
OPTION SYSTEM SPI GP6, GP7, GP8


and after entering the last line above I get Error : not valid SPI pins

Tony
 
Posted: 11:05am
13 Jul 2024
Copy link to clipboard
matherp
Guru

I think there may be a bug in the firmware for the ST7920. I can't work on it until later this month. In the meantime I wouldn't waste too much time on it until I have a chance to test/fix
 
Posted: 12:01pm
13 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Thanks Peter, I had wondered if that was the case or if it was something I was doing.
I'll keep an eye on the forum until I see something from you that confirms it one way or another.

Tony
 
Posted: 11:45am
16 Jul 2024
Copy link to clipboard
matherp
Guru

Please try the version just posted on the release candidate thread. You should now be able to configure the display but I can't test any further than that as no access to a display until the end of the month
Edited 2024-07-16 21:46 by matherp
 
Posted: 12:35pm
16 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Thanks Peter, I tried the version which seems to be the latest from the release candidate thread 5.09.00RC5 and I appear to get the same as with 5.08

OPTION SYSTEM SPI GP6,GP7,GP4
OPTION LCDPANEL ST7920, LANDSCAPE,GP5,GP3

The last line gives
Error : duplicated pin

I'll have a search to see if I can find a later version in the thread, but scanning quickly on my phone, that was the only one I could see.

Tony
 
Posted: 12:37pm
16 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Cancel the last, I have found the one you meant when you said 'just posted'.
I'll give this version a try later this afternoon.

Tony.
 
Posted: 06:12pm
16 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Peter,
I tried the 2024-07-16_212924 version, I no longer get the Error : duplictaed pin message, but the display shows garbage unfortunately.

I can see the data, clock and RS pins toggling nicely on the scope though now which RS was not doing on the previous version.

Tony.
 
Posted: 01:47pm
25 Jul 2024
Copy link to clipboard
matherp
Guru

This version is tested and working. I think the garbage was because I was clocking the SPI bus too fast.


PicoMite.zip

Connections as tested
GND - 1,15,20
5V - 2,19
GP0 - 4 (RS)
GP1 - 17 (RST)
GP6 - 6 (E)
GP7 - 5 (R/W)





 
Posted: 06:17am
26 Jul 2024
Copy link to clipboard
58kk90
Regular Member

Great thanks Peter, i'll try it this morning and report back ....

Tony.
 
Posted: 05:39am
27 Jul 2024
Copy link to clipboard
58kk90
Regular Member

I can confirm that it works perfectly using the Chinese Ebay ST7920 LCD's

Tried both the white backlit version and the yellow backlit version, the yellow was the 3.3v version and the white was the 5v version, both work perfectly with the Pico.

Thanks Peter.

Tony
 
Posted: 09:15am
02 May 2025
Copy link to clipboard
Amnesie
Guru

Hello,

I want to buy this display for a project. Is it possible to draw lines or pixel etc. with the built-in MMBASIC commands?

Greetings
Daniel
 
Posted: 09:21am
02 May 2025
Copy link to clipboard
matherp
Guru

Yes: all standard graphics drawing routines are available (mono only of course)
 
Posted: 09:51am
02 May 2025
Copy link to clipboard
Amnesie
Guru

Peter,

thank you a lot for this info. Those displays have some benefits when it comes to visibility in direct sunlight (the yellow version). This is why I chose this for showing a simple graph. Thanks a lot for implementing those standard graphic drawing routines!

Greetings
Daniel
 


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025