SPI wiring and programming for MCUFRIEND ILI9341

Yes our old friend MCU lol

I've got a bunch of these shields for the UNO - looks mostly like the one below
and I got them all to work in 8 bit mode just fine.

Since that mode uses almost all of the pins on the UNO I would really like to use SPI - just spent a few hours tracking down every post on the subject and no joy.

Has anyone successfully wired this version up as SPI and got it to run an example ?

I've tried a dozen different wiring versions and libraries and can't seem to get it to go.

I used the SPI libraries from this youtube and this link - but the shield that guy is using is different than the generic one and I cant figure the wiring out. The code compiles just fine and the serial debug is showing the code is running on the UNO, just get a white screen on the TFT. And there is NOTHING wrong hardware wise on these, I have three of them UNOs and TFTs and when wired up in 8bit they all work just fine.

I even tried just breaking out EVERY pin from the shield and using that same wiring for the SPI code but still just a white screen.

Be very nice if we can figure out how to do this as the UNO is mostly useless as anything other than a display in 8bit mode - SPI only uses 5 pins supposedly, so that would make the UNO a lot more useful and still be able to use the display.

Any help appreciated.

Here is the youtube and the code link :

post 191 on this thread has the software

http://forum.arduino.cc/index.php?topic=181679.180

TFT driver: 0x9341 or 0x9325

For arduino MEGA:

For arduino UNO:

PD: TFT 2.4" on MEGA

You have taken a shield apart. You have seen how it is a bare 3.3V display module that is soldered to the red mcufriend pcb. The red pcb contains the level shifter chips and the shield pins.

Most controller chips are capable of different interface modes: 16 / 8 bit parallel, 3-wire SPI, 4-wire SPI, ... that are selected by the IMn pins.

Very few of the bare modules make all the IMn pins available. Often they just let you swap between 8 and 16 bit parallel. If your module contains all the IM signals, you could rewire the shield with a lot of effort.

Otherwise, just accept that the UNO shields are very cheap and convenient to use with a Uno. You only have A5 as a spare pin if you are using the microSD. The SMD clones have A6, A7 available.

Any rewiring of a SMD shield is very difficult and fiddly. If you want to use SPI for the TFT, buy an SPI bare module. Then make your own shield with 3.3V level shifters.

David.

david_prentice:
You have taken a shield apart. You have seen how it is a bare 3.3V display module that is soldered to the red mcufriend pcb. The red pcb contains the level shifter chips and the shield pins.

Most controller chips are capable of different interface modes: 16 / 8 bit parallel, 3-wire SPI, 4-wire SPI, ... that are selected by the IMn pins.

Very few of the bare modules make all the IMn pins available. Often they just let you swap between 8 and 16 bit parallel. If your module contains all the IM signals, you could rewire the shield with a lot of effort.

Otherwise, just accept that the UNO shields are very cheap and convenient to use with a Uno. You only have A5 as a spare pin if you are using the microSD. The SMD clones have A6, A7 available.

Any rewiring of a SMD shield is very difficult and fiddly. If you want to use SPI for the TFT, buy an SPI bare module. Then make your own shield with 3.3V level shifters.

David.

very nice and simple answer.

Thanks David

Or use a 3.3V processor such as Arduino Pro Mini 3.3V/8Mhz, or buy a 3.3/5V selectable BUONO UNO R3. This will allow eliminating the TTL level converter.

I disagree with the above. First off, for SPI you don't need fancy level shifters. Just a few resistors will do. Second is the software, the driver to drive this LCD in SPI mode is already available. So no programming to do.

All that one needs to do, is to find the controller, it's pinout, set it to SPI, connect 4 wires and ditch the PCB alltogether. Exactly what I'm going to try to do now, as I want to connect 2 of these screens as well.. and using SPI you can connect them using only 5 ports/wires.

Added reason to do this.. I don't have an uno.. and these screens are near impossible to get to work on the Nano, Pro or Due that I do have.

I'll post here if I am succesfull.. or if I fail miserably.

"First off, for SPI you don't need fancy level shifters. Just a few resistors will do."
That's ok for slow SPI; if you're sending at 4 MHz/8MHz than active electronics is better.

Could you elaborate on that? how would an active level shifter perform better?

In any case, these screens are also sold with SPI enable jumpers, and on youtube there are video's of these working on SPI. So it works. With resistors.

However, this might just be the shortest experiment ever.. I can't seem to find the controller. The LCD is glued to the PCB using 'sticky glue', you can easily pry it off. Then there's a 'ribbon cable' from the LCD to the PCB. On this cable some SMD resitors and stuff, no controller. Took the LCD itself apart, which is quite easy to do, but to no avail.

If i can't find the dang chip, can also not set pins on it. It wouldn't surprise me if the ribbon cable already includes the neccesary pins (in which case you could ditch the PCB alltogether), but I haven't found the specs for it yet. For those who want to know, its:

DJN
15-12376-11563

If anyone can find a datasheet for that...

Active level shifters provide better edges for the device receiving them.
I believe fat16lib posted test results with SD cards showing compromised performance with just resistors on high speed cards.
I use buffers in my designs. cd74HC4050 for 5V to 3.3V, and 74HC125 type gate for MISO coming back, enabled with chip select for the device. Prevents clamp diodes on the device's MISO pin from dragging down the line to 3.3V when 5V devices are active - like a programmer, or some other 5V SPI device.

I do believe you when you say shifters have better edges, however, that means the shifter has better edges than the arduino itself does, as resistors do not change edges. Besides that, these screens function just fine using SPI with resistors, so it's kindoff a moot point.

I'm pretty sure the LCD unit flat cable has all the needed pins, and it's not pitched that fine, easier solderable than tiny pitched SMD stuff. However, I can't find the pinout for that ribbon cable. The manufacturer does not have it on it's site (anymore?):

http://en.djnlcd.com/

I have a cheap shield from Banggood, and I wondered the same thing. I was able to run ribbon cables between the UNO and the shield that freed up three pins: A5, 0 and 1. But I need six pins (better nine) for my current application. I think the best solution is to buy a SPI screen, but I will have to wait for it to arrive :stuck_out_tongue: