ST7735_t3 with 128x96 display on ST7735s

Status
Not open for further replies.

lrtjosh

Active member
Hi,

I've been trying to use my Teensy 4.1 and the ST7735_t3 library on an SPI display that is built on the ST7735s, with a screen that has 128x96 pixels.

I've tried customising the initialiser to write _screenWidth = 128, _screenHeight = 96, _width = 128, _height = 96, and I've checked that all of the setup/initialisation commands issued to the display match those supplied in the manufacturer's example (which uses a very slow bit-banging SPI approach).

I can fill the display with a solid colour successfully and everything looks ok there, but if I do something that runs over multiple lines, like placing some text on the screen using the Adafruit_GFX library, it all looks badly skewed as though it's still outputting the wrong number of pixels per row over SPI.

Just curious, does anyone know if it's possible to use a custom screen size like this, or am I needing to do some more dramatic mods to the ST7735_t3 library in order to achieve this? I'm getting a little lost when I look through the functions that do the final output of pixels to the display, so just looking for any quick tips or a sense of how easy this is to achieve!

Cheers in advance, much appreciated.
 
Again hard to say. It all depends on how the thing is wired.

In most cases our initialization stuff was based off of the Adafruit initialization. Adafruit does have one based of the ST7735s which they use in their Mini INITR_MINI160x80

But the question would be is to what all has to be used in the init stuff in for their mini:
We have an init for: INITR_MINI160x80_ST7735S

Which would be the starting point to figure out what needs to be changed.
Example it uses the init outputs like:
Code:
  Rcmd2minist7735s[] = {
    3,                        //  2 commands in list:
    ST7735_CASET  , 4      ,  //  1: Column addr set, 4 args, no delay:
      0x00, 0x00+26,             //     XSTART = 0
      0x00, 0x7F+26,             //     XEND = 127
    ST7735_RASET  , 4      ,  //  2: Row addr set, 4 args, no delay:
      0x00, 0x00+1,             //     XSTART = 0
      0x00, 0x4F+1,           //     XEND = 79
    ST7735_INVON,  0},			// these displays need colors inversed
Which is wrong for your display as their is offsets going on plus min/max values for Row and COL.

These would need to be experimented with to find what works for your display.
 
It's by a UK manufacturer called Midas Displays, who sell via Farnell. The physical package it comes in is particularly useful for my purpose, which is why I went down that path, despite starting quite successfully with the Adafruit 1.14'' running on ST7789. The documentation is mostly just the ST7735s data sheet.

I've started writing my own library to do the basic subset of features that I need, and it's going well and running fast. I really just need full-screen colour fills, partial screen rectangles, and single lines of text. I think that's the best approach for my particular use case, as I can learn the concepts as I go and optimise a few things such as writing to multiple displays at the same time on the same SPI buss if they're showing the same content, which they often (but not always) are. The init time is also substantially quicker because I can init them all together with the same SPI/DC/Reset commands, rather than having separate C++ objects for each display which run their own individual delay() steps etc. I've just got a simple buffer array in memory for each display, which are manipulated by a set of simple C functions before being transferred over SPI at the desired time, and I'm happy with that. I've determined that there is no practical performance win with using DMA in my particular situation, although that does work well from the multi-display experiments I've run on my Teensy 4.1 up to this point and is a very very cool piece of engineering.

I definitely have only got this far because I've been able to learn from your excellent code in the ST7735-t3 library, so thanks for that and for all of your help. I'll leave it there for now!
 
Just a curtesy follow-up to anyone interested... I'm probably late to the party but discovered the LVGL library yesterday and in half a day was able to get it running on Teensy 4.1 with 3 displays attached to the same SPI buss, lightning fast and doing everything I need. What an impressive library, and with great documentation too. It did not require any customisation to run on Teensy, except providing one function to pipe the library's outgoing pixels to the ST7735s displays, which is something I had effectively just written the day before anyway. LVGL seems like a great solution, and is able to do nice animations etc simultaneous on 3 SPI displays at a great frame rate. I've set it to 30ms between frames but I suspect it can go lower without much trouble. Obviously that depends on the complexity of what you're rendering etc, but for my purposes I won't be pushing it that hard so it's a great win. No need for the Adafruit_GFX or eTFT libraries, although it can connect to an eTFT based display easily using the included examples.

Just writing that down here in case it's useful for someone else in future! I heart Teensy @ 600mHz :)
 
Status
Not open for further replies.
Back
Top