• Hi - are you sure it's the transfer speed, or is it actually updating the graphics itself that takes the time?

    You could make sure you're on version 1v96 or later as I did some stuff to improve graphics speed on that.

    SPI transfer speed itself is still pretty reasonable. The bug you point to was really for ESP8266 because the API they provided for SPI was slow for single bytes - on STM32 especially the SPI is reasonably fast - it'll push out 4Mbps if I recall, so is unlikely to be the issue with your display.

    You can increase the SPI clock rate really easily when you set SPI up, so that's a really easy boost: http://www.espruino.com/Reference#l_SPI_setup

    Default is 100k, but you could push that up to 1M pretty easily or the display may take 4M.

    This is the driver for the display: http://www.espruino.com/modules/SH1106.js

    It does send data in chunks, but IMO it could be faster. You could try adding something like this after initialising the graphics and see if that makes a difference?

    g.flip = function() { 
            var page = 0xB0;
            if (cs) digitalWrite(cs,0);
            var l = (C.OLED_WIDTH * initCmds[4] / 8);
            for (var p=0; p<l; p+=C.OLED_WIDTH) {
                spi.write([page++, 0x02, 0x10],dc);// display is centred in RAM
                spi.write(new Uint8Array(this.buffer,p,C.OLED_WIDTH));
            }
            if (cs) digitalWrite(cs,1);
        };
    
About

Avatar for Gordon @Gordon started