Hi,
Working with an ILI9341 based display, with XPT2046 touch controller and SD card all on-board.
I've got the display itself up and running and SD functionality works, although having both work together is where I'm having issues at the moment.
Has anyone already done this and got them running together and could post an example sketch?
Thanks in advance,
Iestyn.
I'll update this post with my progress as I work on it.
1) SD and display functionality works correctly seperately (using ili9341_t3->graphicsTest and SD->cardInfo examples).
2) Nothing works when two sketches are merged. (using if (!card.init(SPI_HALF_SPEED, chipSelect)) as in cardInfo sketch).
3) Using if (!SD.begin(chipSelect)) as in SD->files sketch, works within the graphicsTest sketch, provided I remove the pinMode(10, OUTPUT) line. Graphics and SD access both seem to work fine together.
4) Having a look, the uTouch library should work for the XPT2046, but in this case I'm going to roll my own SPI based library, so I can run everything on the same bus and use transactions.
5) I've written some SPI transactions code to read x and y data from chip upon the IRQ pin going LOW. It seems to provide consistent values, but it seems the XPT2046 stops responding after a certain number of calls to read from it, requiring power to be removed and reapplied to get it running again?
6) Seems like it was a timing issue. I was struggling to determine from the datasheet the sort of SPI frequency I should be aiming for (
http://www.buydisplay.com/download/ic/XPT2046.pdf). Ended up at 1000000 (SPISettings(1000000, MSBFIRST, SPI_MODE0)) and that tentatively, seems to be working fine.
7) Apparently not; it spent a while repeatedly spitting out 0 for the y coordinate, then locked up again.
8) A bit more investigation showed that it wasn't 'locking up', but rather the IRQ line stopped going low. Looking into the control byte, bits 0 and 1 control power down settings, 2 of which settings, disable the IRQ line (leaving it high). Therefore, I suspect that perhaps my connection to the display just isn't quite very solid (using 20cm prototyping wires). If I don't wait for the IRQ line to go low and just continuously poll it for readings, it doesn't fail at all. So I'll put it down to a dodgy connection and put it to the side for now as this is something that should clear up when I put in on PCB. (If not, I'll take a closer look then). Long and short is, I have a set of working code for the XPT2046. Now to bring all three elements together.
9) Display and SD card work together fine, but the touch screen yields some interesting results when brought into the mix. I'm fairly certain however, this is due to bad connections.