Slow operation of ST7796s SPI

Hi, I bought a st9976s SPI 480x320 screen http://www.lcdwiki.com/4.0inch_SPI_Module_ST7796, on arduino nano the screen worked noticeably slowly (you can see the flickering of the number when updating). I thought that atmega328 was slow, I bought STM32F411CEU6, which is noticeably productive in terms of characteristics. I programmed it with this library GitHub - prenticedavid/Adafruit_ST7796S_kbv: Adafruit-style library for ST7796S SPI displays, but did not notice the difference in the display speed.

  1. Is it such a slow display / SPI?
  2. Not optimized librarian?
  3. Atmega328 and STM32F411 not suitable and slow?
  4. I have not tried to flash it with my native library and my compiler for STM32. I'm waiting for the programmer.
  5. How can I change 16bit to 8bit?

If you are familiar with Adafruit_ILI9341 library for SPI displays it is only an "ST7796S equivalent". It was very simple to write. It inherits the same Adafruit base classes as all the other Adafruit TFT libraries.

So if Adafruit_ILI9341 program works at a particular speed the ST7796S version should draw the same. e.g. a 240x320 image.

Obviously a bigger screen has more pixels. So a bigger image will take longer.

Your mega328P requires level shifters. SPI is a bit crap on AVRs.
The STM32F411 has better SPI. Can run faster.

What constructor have you used ?
There will be a massive difference between Hardware SPI and bit-banging in software.

Oh, if you want to see impressive ST7796S performance on the F411 try Bodmer's TFT_eSPI library examples.

David.

Is such a blinking when withdrawing is the norm?
Write 123 in small print, erase and rewrite.

In theory Hardware SPI, but not sure. Perhaps the library is not designed for f411, since it specifies a different processor format.

Go on. There is a standard graphicstest example sketch.

All that you have to do is say whether you have altered it.

If you have, simply copy-paste your altered lines e.g.

// These are 'flexible' lines that can be changed
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

and which constructor you used

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ST7796S_kbv tft = Adafruit_ST7796S_kbv(TFT_CS, TFT_DC, TFT_RST);

David.

PB - stm32

// These are 'flexible' lines that can be changed
//#define TFT_CS 10
//#define TFT_DC 9
//#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

#define TFT_CS PB3
#define TFT_DC PB10
#define TFT_RST PB12

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ST7796S_kbv tft = Adafruit_ST7796S_kbv(TFT_CS, TFT_DC, TFT_RST);

I first ran the Adafruit_ILI9341 example on ILI9341 display with your defines:

ILI9341 Test!
Display Power Mode: 0x94
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x80
Self Diagnostic: 0xC0
Benchmark                Time (microseconds)
Screen fill              1791755
Text                     103552
Lines                    944274
Horiz/Vert Lines         149591
Rectangles (outline)     95107
Rectangles (filled)      3724780
Circles (filled)         445436
Circles (outline)        416209
Triangles (outline)      214600
Triangles (filled)       1221702
Rounded rects (outline)  190323
Rounded rects (filled)   3711429
Done!

This is with the Adafruit_ST7796S_kbv example:

ST7796S_kbv Test!
Display Power Mode: 0xCE
MADCTL Mode: 0x24
Pixel Format: 0x2A
Image Format: 0x0
Self Diagnostic: 0xE0
Benchmark                Time (microseconds)
Text                     601966
Lines                    1884834
Rectangles (outline)     163407
Circles (outline)        825709
Triangles (outline)      381301
Triangles (filled)       2803056
Rounded rects (outline)  252761
Rounded rects (filled)   5817140
Done!

Note that the registers are not being read correctly.

This is from Bodmer's TFT_graphicstest_one_lib:

TFT_eSPI library test!
Benchmark                Time (microseconds)
Screen fill              566656
Text                     46541
Lines                    572667
Horiz/Vert Lines         54846
Rectangles (outline)     31995
Rectangles (filled)      1370921
Circles (filled)         271810
Circles (outline)        206229
Triangles (outline)      116962
Triangles (filled)       563804
Rounded rects (outline)  88140
Rounded rects (filled)   1444575
Done!

This is my Read_User_Setup output:

TFT_eSPI ver = 2.3.66
Processor    = STM32
Transactions = Yes
Interface    = SPI
Display driver = 7796
Display width  = 320
Display height = 480

MOSI    = GPIO -57-57
MISO    = GPIO -58-58
SCK     = GPIO -59-59

>>>>> Note: STM32 pin references above D15 may not reflect board markings <<<<<
TFT_CS   = D19
TFT_DC   = D26
TFT_RST  = D27

Font GLCD   loaded
Font 2      loaded
Font 4      loaded
Font 6      loaded
Font 7      loaded
Font 8      loaded
Smooth font enabled

Display SPI frequency = 27.00

Yes, I think that it would be a good idea to "decode" the pins and SPI interface into something human-readable.

David.

ST7796S_kbv Test!
Display Power Mode: 0xCE
MADCTL Mode: 0x24
Pixel Format: 0x2A
Image Format: 0x0
Self Diagnostic: 0xE0
Benchmark Time (microseconds)
Text 601831
Lines 1884840
Rectangles (outline) 163408
Circles (outline) 825769
Triangles (outline) 381304
Triangles (filled) 2802503
Rounded rects (outline) 252695
Rounded rects (filled) 5817005
Done!

Yes, you get the same speed as I did.

Bear in mind that Adafruit does not want to support STM32.
So they cripple the SPI. (except for RogerClark)
But no one in their right mind would run the RogerClark Core.

Adafruit cripple Teensy4.0 and 4.1 too. Look at the SPI_DEFAULT_FREQ conditional defines.

Did you try Bodmer's TFT_eSPI ?

David.

I haven't tried TFT_ESPI yet. We need to figure out how to configure it. I flashed stm32 using GitHub - prenticedavid/Adafruit_ST7796S_kbv: Adafruit-style library for ST7796S SPI displays. 100,000 microseconds to fill text and 700,000 microseconds to wipe the screen. Or if you overwrite the same set of characters, then 100,000 microseconds. That is, it will take 200,000 microseconds to erase and write the text. These blinks are quite noticeable.

Bodmer's TFT_eSPI

TFT_eSPI library test!
Benchmark Time (microseconds)
Screen fill 483570
Text 46323
Lines 568886
Horiz/Vert Lines 48273
Rectangles (outline) 28452
Rectangles (filled) 1170283
Circles (filled) 258687
Circles (outline) 206782
Triangles (outline) 116314
Triangles (filled) 503370
Rounded rects (outline) 85290
Rounded rects (filled) 1244161
Done!

#define STM32
#define ST7796_DRIVER
#define TFT_SPI_PORT 1 // SPI port 1 maximum clock rate is 55MHz
#define TFT_MOSI PA7
#define TFT_MISO PA6
#define TFT_SCLK PA5
#define TFT_CS   PB3
#define TFT_DC   PB10
#define TFT_RST  PB12
#define SPI_FREQUENCY  55000000

I'm unsure, but it seems to work at 27MHz and not 55MHz. The speed is better, but you can still see the number blinking.

Can you give an example of how you can keep, say, the time on the screen so that it refreshes, but no flickers are visible?

Run all of Bodmer's examples.

If the screen blinks or is not fast enough quote each example by name.

David.

I think I found the cause of the problem.
previously i used: tft.fillRect, tft.fillScreen (TFT_BLACK), tft.setTextColor (TFT_WHITE)
But it seems more correct to use tft.setTextColor (TFT_WHITE, TFT_BLACK), that is, not a transparent background and then tft.fillRect, tft.fillScreen (TFT_BLACK) is not needed.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.