Sharing SPI bus between TFT_eSPI and other SPI devices - Pi Pico & Arduino IDE #2112
Replies: 3 comments 5 replies
-
I need to run some tests thus need to copy your setup to ensure the validity of the test: Which board package are you using? (Mbed or Philhower's) |
Beta Was this translation helpful? Give feedback.
-
I ran the following code and it is working as expected, SPI data 0xAA is sent to the screen (note brown colour - 0xAAAA) in this case for test purposes. This is achieved by keeping the TFT CS permanently low with the tft.startWrite function. Note that the SPI rate to the screen is also correctly changed as expected to 1MHz in this case. These results show that I have not used the same hardware/software configuration as you have, hence the questions above.
So tell me more about your configuration. |
Beta Was this translation helpful? Give feedback.
-
Many thanks for your replies.
I am using the Mbed package, version 3.3.0. I have been able to use both SPI ports 0 and 1 with the screen only, by changing the defines in Setup23_TTGO_TM.h. I am even able to specify the pins to use for SCLK, MOSI and MISO in this header file and it still works fine. To answer your last question above, I believe it is the standard SPI peripheral that I am trying to use, since I don't have #define RP2040_PIO_SPI in my setup.
I can confirm that your sketch on my side works fine until it reaches the line, whereafter the system crashes with the blinking LED symptom described in my initial question: However, if I add the following line just before the above line, everything seems to work perfectly: Why would this be? Is the above line (or the equivalent thereof) not called in TFT_eSPI::init( ... ) (in TFT_eSPI.cpp) when the following line executes? Another question if I may: By using the following defines in Setup23_TTGO_TM.h (note the changes made to MISO, MOSI, SCLK and CS:
I notice that if I perform a SPI loopback test (by connecting MOSI and MISO directly and printing the result of SPI.transfer(...) to the serial monitor), no data is read from pin GP4, as per the #define. The actual MISO pin used by the Pi Pico is GP16 (I figured this out by probing all the possible SPI0RX pins). If I connect MOSI (on GP19) to MISO (on GP16, instead of GP4), the loopback test is successful. Why is the active MISO changed from what is defined in Setup23_TTGO_TM.h? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone
Firstly, after recently starting to use the TFT_eSPI library with an ST7789 display, I must express my sincere thanks to @Bodmer for this amazing library! I have great appreciation for the work that went into this to make it as easy to use as possible.
I have the following scenario for which I would like to please ask for assistance:
The display I am using is this one with a Raspberry Pi Pico, using the TFT_eSPI library and the Arduino IDE, without the touch functionality. Using the display on its own works perfectly. However, I would like to send/read data to/from an additional SPI device using the same SPI bus as the screen.
After searching through all 17 pages of discussions in this repository, the only discussion that hints towards something that I would like to do is #1569, which doesn't really help me.
I am aware of the SPI pins defines (and for other pins used by the display) in the Setup23_TTGO_TM.h file, but I am not sure how that translates to setting up the SPI bus.
Here follows a very simple (and incomplete) sketch in which I am attempting to send data on the SPI bus, while probing the bus with an oscilloscope to see if I can see the data being sent:
Needless to say, the above just leaves me with the Pi Pico's built-in LED doing its 4-slow-4-fast flashing, indicating what seems to be the firmware that has crashed.
How can I use the same SPI bus to communicate with an additional SPI device, while using the TFT_eSPI library? A simple example that illustrates this would be of great appreciation.
Thank you very much in advance.
Beta Was this translation helpful? Give feedback.
All reactions