ST7735 at high rate?

Posted on
  • Hello, i'm back from a long circuitpython session...

    I'm playing with a small 128x128 SPI TFT display with a short generative prog

    const s = require("Storage");
    const largeur = 32;
    function ecrit() {
      console.log("écrit");
      g.clear();
      var start = getTime();
      for (let y = 0; y<128; y+=largeur) {
        for (let x = 0; x<128; x+=largeur) {
          if (Math.random()>0.5) {
            g.setColor(1);
            g.fillRect(x,y,x+largeur,y+largeur);
          } 
        }
      }
      print("dessine:",getTime()-start);
      g.flip(); //<--- Send to the display
      print("affiche:",getTime()-start);
    }
    
    var g;
    function onInit() {
      var colorPalette = new Uint16Array([0xFFF, 0]);
      // init spi
      var spi = new SPI();
      spi.setup({mosi:B15 /* sda */, sck:B13 /* scl */});
      g =require("ST7735").connect({
        palette:colorPalette,
        spi:spi,
        dc:A7,
        cs:B10,
        rst:B1,
        padx:2,
        pady:3
        // height : 160 // optional, default=128
        }, setInterval(ecrit, 500)
      );
      console.log("## mém. used: " + Math.round(process.memory().usage / process.memory().total * 100) + "% ##");
      s.getFree();
    }
    

    But the display take 0.65sec to screen the picture drawn in .02s
    Is there a way to send faster to the display?
    and avoid image scanning?

    regards

  • i tried with an hardware spi, but I don't save much time. 1 tenth of a second

    SPI2.setup({mosi:B15 /* sda */, sck:B13 /* scl */, baud:integer=1000000,});
      g =require("ST7735").connect({
        palette:colorPalette,
        spi:SPI2,
        dc:A7,
        cs:B10,
        rst:B1,
        padx:2,
        pady:3
        // height : 160 // optional, default=128
        }, ecrit
      );
    
  •   var spi = new SPI();
      spi.setup({mosi:B15 /* sda */, sck:B13 /* scl */});
    

    You could use hardware SPI and set higher speed?

    Also you could try to enable JIT compiler in the flip() method
    https://www.espruino.com/modules/ST7735.­js
    but that may not help that much.

    Also there is the relatively generic lcd_spi driver
    https://github.com/espruino/Espruino/blo­b/master/libs/graphics/lcd_spilcd.c
    that could maybe work with ST7735

  • baud:integer=1000000

    why so low (1Mbit)? these displays can do much more, 16 or even 32Mbit could work (not sure what is the limit of your board)

  • thank you.
    i do not investigate which baud i could use.
    I've tried with 32Mbits and a delay of 50ms between each frame. It works but i take 0.4s (30 percent better) but 2.5 frame/sec.
    and with an ugly scanning refresh.

  • The ST7735 module does use an offscreen buffer. Some modules for driving screens (like https://www.espruino.com/ST7789) offer a mode where they render direct to the screen, so you could try copy/pasting the code to do that instead.

    Sending direct causes more flicker but if you're not overwriting much of the screen it could be faster.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ST7735 at high rate?

Posted by Avatar for Mrbbp @Mrbbp

Actions