General area when it fits no where else

Moderator: Mmiscool

User avatar
By Ecoli-557
#53599 OK Guys, I posted my SPI port exander which works well. I am now trying to also use the ILI9341 TFT screen with it.
spi.setup(1000000) 'clk on gpio14(d5) mosi on gpio13(d7)
SPI port expander CS = 4.

TFT setup tft.setup(15, 4, 2) which puts CS on GPIO15 w/10k pull-down to GND, D/C on GPIO4, Landscape mode.
Regulare SPI clock, MOSI, MISO on their respective ports.
Problem is, with code working with SPI port expander, all I do is add the one line tft.setup(15, 4, 2), it crashes my SPI port expander.
I even tried remarkling the SPI setup statement, putting the tft.setup statement 1st, and it doesn't work.
Neither the display OR the port expander seems to work on the same bus as they should.

Anyone sucessfully gotten 2 devices working on the ESP8266? One of them being the ILI9341?? Is there another SPI TFT display that works???

Need help!!
User avatar
By Ecoli-557
#53600 Forgot to add;
MCP23S17 needs:
Mode 0
MSB 1st
Data valid on clock leading edge
Clock low when inactive
Have no idea what the display needs, can't seem to see it in the library......
User avatar
By Ecoli-557
#53617 Couldn't see much that I understood in the library. I did find what was happening...... The 23S17 chip select is being toggled for some reason!
I do not set/reset the chip select unless I am directing a write to the 23S17 port expander.

Logic analyzer shots below for illustration. I will try switching the chip select to another pin.....
Chip select for the 23S17 is the 4th trace (orange) and the chip select for the TFT is the 8th trace (violet).

Anyone tried doing this??
You do not have the required permissions to view the files attached to this post.
User avatar
By picstart
#53657 There may be issues with the TFT library.
The CS control for the TFT is often embedded in the TFT library code. Now selecting a specific CS with the 23S17 port expander requires multiple instructions so these instructions would need to replace the single CS asserts in the TFT library code.
The TFT shares the SPI bus and only asserts control via CS when data transfers are made to the TFT.
If hardware SPI is used the first SPI channel is used by flash program storage so the second channel must be used.