I need help to hook up a ST7789 SPI display to nRF52832 (Adafruit Feather). The design did already run on Pro-Micro and D1-mini, NodeMCU. I just did edit the pins to be TFT_RST pin 2 (P0.02) and TFT_DC pin 31 (P0.31). I think the default for MOSI is P0.13 and for SCK is P0.12. But so far no content on display. Did I miss a special nRF configuration which was not needed on the other boards?
Is it possible to configure MOSI and SCK to other pins?
Can anyone share a sketch that works with ST7789 SPI display?
Thanks!
I use with D1: #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7789.h> // Hardware-specific library for ST7789 #include <SPI.h> // Arduino SPI library
// ST7789 TFT module connections #define TFT_CS D2 // define chip select pin - not used so far #define TFT_DC D8 // define data/command pin #define TFT_RST D0 // define reset pin, or set to -1 and connect to Arduino RESET pin
// Initialize Adafruit ST7789 TFT library
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
void setup() {
...
// if the display has CS pin try with SPI_MODE0
tft.init(240, 240, SPI_MODE2); // Init ST7789 display 240x240 pixel
// if the screen is flipped, remove this command
tft.setRotation(2);
}
I would guess that Adafruit libraries should work on Adafruit boards.
Post a link to the actual display that you have bought. e.g. Ebay sale page.
It is always wise to start with the bit-bashed constructor. You can attach your wires to the most convenient pins.
e.g. wire adjacent display signals to adjacent pins on Feather. much easier to wire correctly.
When you have verified the Software SPI constructor, re-wire with SDA, SCK on the Hardware SPI MOSI, SCK pins. Use the Hardware SPI constructor.
I hope (for your sake) that Adafruit look after their nRF52832
Because the 64MHz Nano_33BLE board works with ST7789 but at 1/4 speed of a 16MHz Uno.
That is very strange, I added the SPI Clk output (P0.13) and set this port to HIGH level. And now I can see it working.
const int oclk = 13;
...
pinMode(oclk, OUTPUT); digitalWrite(oclk, HIGH);
It means that nRF52832 goes in a Tri-State mode on the SPI clock Pin (P0.12) between data packets. I would expect, that a SPI clock pin is an output of the master CPU and not goes tristate. I will ask Nordic about it....
The SPI clock of the esp8266 is much higher (about 27MHz) than nRF52832 (8MHz) but the packet speed is double on nRF52832. (18us versus 33us)
ARM Cortex M4F (with HW floating point acceleration) running at 64MHz
It might have an 8MHz crystal but it will have a PLL to generate the 64MHz.
The SPI transaction will set the SCK frequency to the highest available frequency e.g. if you ask for 27MHz you probably get 16MHz on a 64MHz system. You get 8MHz on a 16MHz Uno.
Just try the Adafruit library example with Software SPI constructor.