Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:46 22 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Forget the ILI9488, The ST7796S is the new kid in town

     Page 1 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 12:24pm 07 May 2025
Copy link to clipboard 
Print this post

Have a look

The moire patterns are artifacts of the camera/screen combination

This panel will be fully supported in V6.00.02RC23. It can work with the existing ILI9488 driver but anything involving reading the VRAM doesn't work.

OPTION LCDPANEL ST7796S,orientation, DCpin, RESETpin, CSpin [,backlightpin] [,INVERT]

It runs in RGB565 both on read and write so updates only take 2/3rds of the time of the ILI9488 and reads are much faster as the data rate doesn't need to be throttled like on the ILI9488 (and the ILI9341)
The screen is 4" and nice and bright and it doesn't need any sort of H/W hack like the ILI9488 to work with touch and the SDcard.

Implementation was reasonably easy except for one gotcha on switching from reading the on-board VRAM to writing it (as used in BLIT and transparent text). To do this I had include a delay until the next HSYNC otherwise the write was simply ignored.

The display supports the new H/W scrolling in portrait mode.
Edited 2025-05-07 22:26 by matherp
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 220
Posted: 12:57pm 07 May 2025
Copy link to clipboard 
Print this post

Peter,
as far as I've seen therer are some variants on Aliexpress available that can be configured in 4 modes:
SPI3, SPI4 wire, parallel 8 bit and 16 bit.

Does it make sense/is it feasable, from your point of view, to also support the parallel modes? This would make a very powerful and flexible display for almost all purposes.

Tnx for your work on MMBasic,
Gerald
                                                                 
73 de OE1HGA, Gerald
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2409
Posted: 03:01pm 07 May 2025
Copy link to clipboard 
Print this post

thanks Peter, checking prices now. using the ILI9488 (and the ILI9341) and diode resistor for reading sd card they are ok
ST7796S not cheap... what is now?
Edited 2025-05-08 01:47 by stanleyella
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 359
Posted: 03:38pm 07 May 2025
Copy link to clipboard 
Print this post

  matherp said  
The display supports the new H/W scrolling in portrait mode.


sounds amazing. Does it reach the ssd1963 in terms of responsiveness and scrolling e.g. in editor?
Edited 2025-05-08 01:38 by dddns
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 03:44pm 07 May 2025
Copy link to clipboard 
Print this post

  Quote   Does it reach the ssd1963 in terms of responsiveness and scrolling e.g. in editor?

Pretty much but only in portrait mode i.e 320x480. All of these smaller displays are organised that way.
 
Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 376
Posted: 06:35pm 07 May 2025
Copy link to clipboard 
Print this post

I see that the ST7796 displays are available with either resistive touch or capacitive touch using the FT6336 touch controller for a few $ more.  

My experience has been that in general the capacitive touch screens are usually more stable without the calibration offsets and drift that the resistive screens seem to have, although I have no direct experience with the FT6336 screens.

On the other hand, the resistive touch controllers are more "mature" in terms of MMBasic use.

Anyone have any thoughts or experience to share before I order a few panels?
Edited 2025-05-08 04:36 by Sasquatch
-Carl
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 06:43pm 07 May 2025
Copy link to clipboard 
Print this post

Resistive touch seems to me to be more accurate. i.e. you can use a fine pointer whereas capacitive you need a finger or finger equivalent which tends to be chunky
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2409
Posted: 08:18pm 07 May 2025
Copy link to clipboard 
Print this post

  matherp said  Resistive touch seems to me to be more accurate. i.e. you can use a fine pointer whereas capacitive you need a finger or finger equivalent which tends to be chunky

I got the impression capacitive touch better, like phone screens but as said resistive ili works fine, thanks, I think stick with ili.
tbo I like parking monitor with hdmi, vga, composite video £14 if they can make a 8" monitor why not just the screen?
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 359
Posted: 05:19pm 08 May 2025
Copy link to clipboard 
Print this post

   said   Does it reach the ssd1963 in terms of responsiveness and scrolling e.g. in editor?

   said   Pretty much but only in portrait mode i.e 320x480



A bit of a downside with portrait. The ssds seems to get dumped now and the IlI9488 was upgraded..IPS is coming but I think the controller chips will stay

Many thanks for implementing, when I started with PicoMite this was not supported so I bought an ILI9341 but I would like to change it now to st7796 :)
Edited 2025-05-09 03:25 by dddns
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 05:32pm 08 May 2025
Copy link to clipboard 
Print this post

SSD is still my favourite and now we have the RP2350B it becomes more practical. The only trouble is that the panels tend to be expensive, looking on buydisplay.com, the cheapest one they have is the 4.3" 480x272 at USD31 with a touch chip
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 359
Posted: 05:40pm 08 May 2025
Copy link to clipboard 
Print this post

I just saw 7" for 26€, that why I've said

on aliexpress. I'm not allowing cookies but they do tricks. I'm not sure but I've seen them go down now over weeks
Edited 2025-05-09 03:44 by dddns
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 983
Posted: 01:14pm 17 May 2025
Copy link to clipboard 
Print this post

Peter,
I have an ST7796S and have sort of got it going on the Armmite F4.

I had to set the delay to switch back to Write mode to 5ms to get it to work.
i.e.
//#define ST7796Schangetowrite  1600
#define ST7796Schangetowrite  5000

Also BLIT READ and BLIT WRITE need a extra read in ReadBufferSPI before they work and the colour of WRITE copy is not quite correct.

On a Picomite I had to recompile with the same changes to use any read operations.

As a first step can you confirm this program behaves as expected on your ST7796S display.
i.e. Transparent text,BLIT, BLIT READ/WRITE

I will try and read out the ID of the display to see if yours is the same.


Print "st7796S Test"
CLS RGB(GREEN)
Box 100,100,40,40,,RGB(RED),RGB(RED)
Print Hex$(Pixel(1,1))
Blit READ 1,100,100,40,40
Blit WRITE 1,150,100,40,40
Blit 100,100,200,100,40,40
Print Hex$(Pixel(121,125))
Print Hex$(Pixel(171,125))
Print Hex$(Pixel(221,125))
Text 300,150,"HELLO"
Text 300,100,"HELLO",,,,RGB(RED),-1
Timer =0
Box 0,0,10,10,1,RGB(red),RGB(red)
Box 10,10,10,10,1,RGB(BLUE),RGB(BLUE)
Print "WRITE TIME: ",Timer
Timer =0
Blit 0,0,200,200,20,20
Print "BLIT TIME: ", Timer
Timer =0
'CLS
Print " CLS TIME: ",Timer


Latest F4 Latest H7 FotS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 04:19pm 17 May 2025
Copy link to clipboard 
Print this post

The program worked perfectly for me. I did tune the wait down to the absolute minimum possible so it may need to be a bit more generous to cater for all controllers/wiring.
What PicoMite version are you testing? Let me know and I'll post a more "relaxed" version
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 983
Posted: 12:04am 18 May 2025
Copy link to clipboard 
Print this post

Standard Picomite 2040
Latest F4 Latest H7 FotS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10088
Posted: 08:08am 18 May 2025
Copy link to clipboard 
Print this post

Try this


PicoMite.zip

If you can work out why the delay is needed at all it would be good
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 359
Posted: 10:18am 18 May 2025
Copy link to clipboard 
Print this post

Does the ST7796U work as well? IPS
And the same for 9143V?  320x240  and 480x320

I trust these as my delivery of tinker parts took only 1 week.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 983
Posted: 11:08am 18 May 2025
Copy link to clipboard 
Print this post

Hi Peter,
No luck with that one.
I can get it to work reliably with the following changes
The delay set to 4500
and doing a wait at the end of ReadBufferSPI.



#define ST7796Schangetowrite  4500

void ReadBufferSPI(int x1, int y1, int x2, int y2, unsigned char* p) {
.
.
.
.
if(Option.DISPLAY_TYPE==ST7796S){
int n=(x2- x1+1) * (y2- y1+1)*3;
while(N){
h=p[N-2];
l=p[N-1];
N-=2;
p[n-1]=h & 0xF8;
p[n-2]=((h & 0x7)<<5) | ((l & 0xE0)>>3);
p[n-3]=(l & 0x1F)<<3;
n-=3;
}
uSec(ST7796Schangetowrite);
ST7796Swritestate=true;

} else {



This is my test program result.


The first column is the source.
Next column is result of BLIT READ / BLIT WRITE
Next column is result of a BLIT.
Next is TEXT and Transparent Text
Triangle and LINE AA I think call ReadBufferSPI as well.

Various subtle things occur when it not right.
e.g. BLIT and BLIT READ/WRITE can give incorrect colours.

It seems to be correct with the two changes above.

Maybe its worth printing out the chip ID and see if its different from yours.

The test code is below.





Print "st7796S Test"
CLS RGB(RED)
Print Hex$(Pixel(1,1)),"RED F80000"
Print Hex$(Pixel(171,125))
CLS RGB(GREEN)
Print Hex$(Pixel(1,1)),"GREEN FC00"
Print Hex$(Pixel(171,125))
CLS RGB(BLUE)
Print "------------"
Print Hex$(Pixel(1,1)),"BLUE F8"
Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1)),"BLUE F8"
Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1)),"BLUE F8"
Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1))
Print "----------------"
CLS RGB(GREEN)
'CLS RGB(RED)
Box 0,98,320,50,,RGB(BLUE),RGB(BLUE)
Box 0,48,320,50,,RGB(yellow),RGB(yellow)
Box 0,50,40,40,,RGB(RED),RGB(RED)
Print Hex$(Pixel(1,1))':Pause 5
'Text 150,50," TRANSP ",,2,,RGB(RED)
'Pause 10
Blit READ 1,0,50,40,40
Blit WRITE 1,50,50
Print Hex$(Pixel(1,1))
Blit 0,50,100,50,40,40

Box 0,100,40,40,,RGB(RED),RGB(RED)
'Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1))
Blit CLOSE 1
Blit READ 1,0,100,40,40
Blit WRITE 1,50,100
'Print Hex$(Pixel(1,1))
Print Hex$(Pixel(1,1))
Blit 0,100,100,100,40,40
'Print Hex$(Pixel(121,125))
'Print Hex$(Pixel(171,125))
Print Hex$(Pixel(221,125))
Text 150,70," NORMAL ",,2
Text 150,50," TRANSP ",,2,,RGB(RED),-1
Text 150,120," NORMAL ",,2
Text 150,100," TRANSP ",,2,,RGB(RED),-1
Timer =0
Box 0,0,20,20,1,RGB(red),RGB(red)
Box 20,20,20,20,1,RGB(BLUE),RGB(BLUE)
Print "WRITE TIME: ",Timer
Timer =0
Print Hex$(Pixel(1,1))
Blit 0,0,100,0,40,40
Print Hex$(Pixel(1,1))
Blit close 1
Blit Read 1,0,0,40,40
Blit Write 1,50,0
Print "BLIT TIME: ", Timer
Timer =0
'CLS
Print " CLS TIME: ",Timer
Triangle 30,180,125,190,90,220,RGB(RED),RGB(RED)
Line AA  150,180,220,230,5,RGB(BLUE)




Latest F4 Latest H7 FotS
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 461
Posted: 05:31pm 18 May 2025
Copy link to clipboard 
Print this post

OK, my ST7796S display has arrived. Which pins are best to use with the Pico? Do you have any recommendations, Peter?

OPTION LCDPANEL ST7796S,orientation, DCpin, RESETpin, CSpin [,backlightpin] [,INVERT]

I don't have a pin header soldered into J4 yet, but I need to do so for SD card use, don't I?

Otherwise, could you just provide me with your option list? I'll try to make sense of it.
Thanks in advance.

Matthias
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 983
Posted: 04:04am 19 May 2025
Copy link to clipboard 
Print this post

  matherp said  
If you can work out why the delay is needed at all it would be good

Hi Peter,
I think I have stumbled on the solution for not requiring the delay.
On the Armmite I have it working with #define ST7796Schangetowrite  1
i.e. 1 uSec. I have not pulled out all the code for the delay but I suspect its not need at all.
P.S. All delay code removed and its still good!
    also removed from Picomite RC23 and recompiled. All good.

The fix is to bypass D1 in series with CS on the board as covered in the post below.
I added jumper J1 (for 3.3v) as well at the same time so not 100% sure which fixed it, but suspect its the D1 bypass.


Extract from post.....
Some ST7796 (and ILI9486) displays have a diode inline with the TFT chip select. This is a board design error as there is nothing the other side of the diode to pull the TFT chip select high. If there are other devices on the SPI bus, such as a touch controller then this diode is likely to cause problems.


It would affect how long before CS wanders to the high state, so we needed a delay to ensure CS went high after the read, before it was pulled low again on a write.


Link to solution


Edited 2025-05-19 14:41 by disco4now

Footnote added 2025-05-19 15:55 by disco4now
From the datasheet

8.4.2.2 Read Sequence
The read mode of the interface means that the micro controller reads register value from the driver. To achieve read function, the micro controller first has to send a command (read ID or register command) and then the following byte is transmitted in the opposite direction. After that CSX is required to go to high before a
new command is send
......


Latest F4 Latest H7 FotS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2449
Posted: 05:05am 19 May 2025
Copy link to clipboard 
Print this post

One arrived this afternoon. Another data point.
> option list
PicoMite MMBasic RP2040 Edition V6.00.02RC23
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION SYSTEM I2C GP8,GP9
OPTION COLOURCODE ON
OPTION CONTINUATION LINES ON
OPTION CPUSPEED (KHz) 378000
OPTION DISPLAY 55, 155
OPTION LCDPANEL ST7796S, PORTRAIT,GP15,GP14,GP13,GP7
OPTION TOUCH GP12,GP11
GUI CALIBRATE 1, 154, 3980, 863, -1279
OPTION SDCARD GP17
OPTION RTC AUTO ENABLE
> gui test lcdpanel
> gui test touch
> RUN
ST7796S Test by disco4now 19-05-2025
F80000  RED F80000
F80000
1CC0    GREEN FC00
1CC0
------------
F80000  BLUE F8
F80000
F80000
F80000  BLUE F8
F80000
F80000
F80000  BLUE F8
F80000
F80000
----------------
F80000
1CC0
1CC0
F80000
1CC0
WRITE TIME:      0.684
1CC0
F80000
BLIT TIME:       16.948
CLS TIME:       0.104
>
Using Peter's last .uf2
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025