Pin Assignment for Display on RP2040 #3016
-
A description of the problem and the conditions that cause it to occur: My hardware setup is very basic: and, (2) WAVESHARE 1.9" 170x320 LCD SPI Display (driver: ST7789) I have a custom "Setup500_WaveShare_RP2040_Zero_SPI_Display.h.zip" file (attached here) with the relevant parameters for this particular display. The problem:
However, if I assign either of these pins to different pins on the RP2040 Zero in the "user_settings" file, I get a blank screen, for example:
(these are the pins I actually need for my project to work) To clarify, the code itself compiles fine with any pin assignment, however, if the pin assignment for MOSI and SCLK isn't 2 & 3, then the display only shows a blank screen and none of the graphics. After much testing, I can also confirm that the other display pins (DC, CS, RST) can be assigned to any of the RP2040 Zero without an issue (as long as MOSI & SCLK are assigned as above). To rule-out hardware issues, I looked into the RP2040 Zero's schematics and it appears that all GPIO pins are identical in that they are broken-out directly from the RP2040 ic to the Zero's pin header (that is, no pull-up or pull-down resistors or anything else on them that might cause an issue). So, bottom line, with everything else exactly the same (both hardware and software), when pins 2 & 3 are used for MOSI & SCLK respectively, the display works great. However, assigning these functions to any other pin on the RP2040 Zero causes the display to show a blank screen. Given all this, I'm almost certain the issue is somewhere on the library's software side, though I couldn't figure out what it might be. Environment details: Arduino IDE: Ver. 1.8.19 TFT_eSPI Library: Ver. 2.5.0 Help please? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Only certain pins can be used with the built in SPI peripheral. This is a hardware level constraint, see section 2.4.3 of the RP2040 datasheet. An alternative approach based on a PIO SPI implementation is possible, see setup file 61. |
Beta Was this translation helpful? Give feedback.
-
Hi again, |
Beta Was this translation helpful? Give feedback.
Only certain pins can be used with the built in SPI peripheral. This is a hardware level constraint, see section 2.4.3 of the RP2040 datasheet.
So for example MOSI (SPI TX) cannot be allocated to GPIO 0.
An alternative approach based on a PIO SPI implementation is possible, see setup file 61.