I have recently started to try TinyGo (www.tinygo.org : A Go Compiler For Small Places) on the Pico Explorer which is an excellent starter board for exploring the RPI Pico features. I have a Blinky and CPU access details working but found it impossible to raise a smile from the ST7789 display. I used the example from the TinyGo Github (drivers/examples/st7789 at release · tinygo-org/drivers · GitHub ) but I am confused by the pin labelling (e.g. reset, dc, cs, bl,) in the functions. Is there a working example that exists of “Hello World” on the ST7789 using TinyGo on the Pico Explorer? Python examples work so I am sure the ST7789 is OK.
Why TinyGo? It produces very small executables (my initial Blinky used less that 10KB of Flash and less than 3KB of RAM) and has performance comparable to C/C++ with a syntax that anyone using Python can easily learn. I think TinyGo language support would make an excellent addition to the Pimoroni offering.
I think I am on the right track with using SPI0 using pins 16,17,18 and 19 as these are written for use on the back of the Pico Explorer. I used the following function from the TinyGo website to configure SPI0:
but I must also set up the display and for this I have the following where it seems to want machine.pins but which ones I can’t get other than GP17 for CS on the Pico Explorer. (btw … everything after // are just comments in Go.)
I have tried various pins but the Pico Explorer (apart from CS) doesn’t mention any of these on the pin labels and I can find nothin in the various documentation etc.
Take a look at the schematic. This will tell you the correct SPI-pins. You will also see that there is neither a backlight (BL) pin nor a reset pin. But that should be no problem unless your driver insists on these pins.
I think the D/C pin is labeled as MISO in the schematic, which is not correct.
Many thanks. That gives me a clue. I will look at the driver and see what it actually does with the D/C and BL pins . There appear to only 4 racks on the board to the display so I am guessing it only ever uses 16…19 (SPI MISO, LCD CS, SPI SCK,SPI MOSI) and that I can somehow get it to ignore the other pins. This may take me a few days to ge to but I’ll update this post on how I get on.
Yes, and for this display you only need four wires. D/C is data/command, and that tells the display controller if you are sending a command or data. Since the display (in old terms “slave”) does not “talk” to the Pico (in old terms “master”) there is no classical SPI MISO (master in, slave out). That is why I think it is just mislabeled.
The BL (backlight) pin usually is a PWM-pin to control the backlight of the display. It is not strictly necessary. When I wire my displays I usually connect the LEDs of the display to Vcc or use a trim-poti to control brightness.
But I took a quick look at your go-driver and that driver actually expects and uses the backlight and reset pins. So what you can do is try to fool the driver by providing two of the spare pins of the pico which are then “controlled” by the driver but actually do nothing.
Unfortunately I did not find a solution. I retested the Pico Explorer Board in between attempts with MicroPython so I am pretty sure the board functions OK. It must be some unique way that Pico Explorer is set up. I was a bit out of my depth but when looking at the MicroPython set up by Pimoroni they appear to be using some code that uses a PIO on the Pico to help with the I/O on the Pico Explorer display. Perhaps when I have learnt a bit more about Go and using the PIOs on the Pico I can revisit the problem.