How to use SPI1 pins on RP2040 Zero board?

Hi, I play with TFT display (1.9" IPS display, resolution 170x320, driver ST7789) connected to RP2040 Zero board using SPI (RP2040 Zero pinout). I use 'Raspberry Pi Pico/RP2040' by E. Philhower and 'Adafruit ST7735 and ST7789 library' by Adafruit.

I run 'graphicstest_st7789' from examples on Arduino IDE and everything works perfect on hardware SPI0 pins. I just added these few lines in the sketch in setup section to assign pins I use for SPI.

  SPI.setRX(0);  // (RP2040 ZERO pin 0, 4,  8, 12)
  SPI.setCS(1);  // (RP2040 ZERO pin 1, 5,  9, 13, 17)
  SPI.setSCK(2); // (RP2040 ZERO pin 2, 6, 10, 14, 18)
  SPI.setTX(3);  // (RP2040 ZERO pin 3, 7, 11, 15, 19)
  SPI.begin();

I also change pin no. in #define TFT_CS 9 to match CS pin above.

I tried different combinations of SPI pins and display works as long as I use hardware SPI0 pins only (not interested in software SPI, I tested and it's too slow).

I am unable to use hardware SPI1 pins from RP2040 Zero board. Is there an easy way to use these pins instead of SPI0 or there is an issue with 'Adafruit_ST7789.h' library limiting usage to SPI0 pins only? I don't see any MOSI and SCK pins declarations for the display in the sketch.

Thank you, Amy

What is this?
I know about a Raspberry Pi zero board, It is like cut down Raspberry Pi.

I know about a PR2040 board, which is one with a 2040 processor.

But I have never come across a RP2040 Zero board.

Thanks for that. It is a clone, so good luck with that.

Have you tried asking on the technical support on the Waveshare Wiki?

Found here: GxEPD2_Example.ino:

#else // package https://github.com/earlephilhower/arduino-pico
// SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx);
// uncomment next line for use with my proto board.
//SPIClassRP2040 SPIn(spi0, 4, 5, 2, 3); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
// uncomment next line for use with Waveshare Pico-ePaper-2.9 or Waveshare PhotoPainter module
SPIClassRP2040 SPIn(spi1, 12, 13, 10, 11); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short

The SPIClassRP2040 constructor of the earlephilhower package takes the spi channel as parameter. You can't reassign spi1 pins to the spi0 HW channel.
The Adafruit library seems to use the spi0 HW SPI channel.

I found solution for my problem. After analyzing Adafruit_ST7789.h I found that I can add SPI parameter to' tft' object. I tested all SPI0 and SPI1 pins of RP2040 Zero and display works on hardware SPI1 now.

Here are changes I made in 'graphicstest_st7789.ino' sketch to run TFT display on SPI1 pins.

#define TFT_CS 13   // changed CS pin to what I use for SPI0 or SPI1 below (RP2040 ZERO pin 1, 5, 9, 13, 17)

Adafruit_ST7789 tft = Adafruit_ST7789(&SPI1, TFT_CS, TFT_DC, TFT_RST);   // I added reference to SPI1, not needed to use SPI0

I also added these lines to setup to initialize SPI0 and SPI1 on pins I need

void setup(void) {
  SPI.setRX(0);  // (RP2040 ZERO pin 0, 4)
  SPI.setCS(1);  // (RP2040 ZERO pin 1, 5, 17)
  SPI.setSCK(2); // (RP2040 ZERO pin 2, 6, 18)
  SPI.setTX(3);  // (RP2040 ZERO pin 3, 7, 19)
  SPI.begin();

  SPI1.setRX(12);  // (RP2040 ZERO pin 8, 12)
  SPI1.setCS(13);  // (RP2040 ZERO pin 9, 13)
  SPI1.setSCK(14); // (RP2040 ZERO pin 10, 14)
  SPI1.setTX(15);  // (RP2040 ZERO pin 11, 15)
  SPI1.begin();
}

Just in case someone needs info about pin assignment and here SPI0 and SPI1.

I hope that can help others with similar issues with SPI1.

Amy