Multiple SPI Devices?


With a Dash, I’m using an Adafruit TFT display with touchscreen and SD card. I was able to get the ILI9341 library working for the display after some hacking. However, when I access the SPI touch controller, it works, but artifacts begin to appear on the display. This seems like it might be an issue with SPI CS management (leaving the display communication active while accessing the touch controller). I noticed in the Dash SPI library there was a comment about a problem with CS and the DSPI peripheral. Anyway, this is vexing me. Any thoughts about what might be going on? :slight_smile:


Are you controlling the CS lines directly? Or pushing control through the SPI library? Have you monitored the CS lines with a scope or logic analyzer to see if there are correlations between the artifacts and the CS lines being toggled at the wrong time?


Thanks for your reply. I’m not controlling CS in my code, but it looks like the display and touchscreen libraries are controlling it. I notice SPI.cpp for the Dash seems to control CS in begintransaction()/endtransaction(), whereas the Arduino version doesn’t. That might be part of the issue (both SPI and libraries controlling). I haven’t investigated CS signals directly. My DASH-hacked libraries work on the Arduino with no display artifacts.


Actually, it ended up having something to do with the CS pin I was using (I got it originally from the OLED example). I switched from L07 to L11 and there’s no problem (should have tried this first, I guess). Is there anything different about L07 that might explain this?


Hrm, not that I know of. Looking at the pinout:

It seems like the pins are very similar in function.

Is it possible you damaged pin 7 at some point? Or if you were able to switch it, I assume you’re wiring using a breadboard? Is it possible the connection wasn’t solid?


I just tested the L07 pin using an LED and a simple Blink sketch. That worked as expected, so I don’t think the pin is damaged. All connections have been removed and replaced on the breadboard and L07 still didn’t work properly with the display. Just moving the wire to L11 worked. So, I’m flummoxed. But at least there’s a solution for now.


@bobg Sorry, I don’t mean to streal the thread, but any chance you’d be willing to share the ILI9341 library mods you did?


No worries. Here are the libraries. They are hacks to use SPI with no warranty, etc. There are three modified example sketches in the Library Examples. Note the pin assignments are idiosyncratic to my application. YMMV

Adafruit ILI9341 Libraries for (318.3 KB)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.