ILI9341 LCD driver, max SPI clock speed? - Page 1
Forum section: electronics / general

author: Chris C
author_rank: Frequent Contributor
timestamp: August 16, 2015, 05:03:26 pm
content: I'm using an ILI9341-based LCD module, and the 4-wire SPI interface to communicate with it. According to the datasheet's spec for this interface, I should be able to write at up to 1s/100ns(twc)=10Mhz, and read at up to 1s/150ns(trc)=6.66Mhz.However, I am successfully writing and reading at 24Mhz! Not just for a simple test case, either. I'm doing complex graphics, mixed reads/writes for alpha blends, both 16-bit and 24-bit pixel writes, and so on - yet haven't seen a single glitch. (Except those caused when I bump my dodgy old breadboard or jumper wires. That I'm using such poor connections, and it's still working at this speed when not physically disturbed, make this even more amazing. The signal integrity must be horrible.)In the past I've tried communicating with other complex SPI devices at speeds past their ratings, just to see what would happen. All started showing issues with modest increases, even when run at max Vdd.Yet I'm reading from this at 360% of its max rated speed!And I know of cases of others doing the same with their ILI9341-based LCD, as well.All of which really makes me question whether I've read the spec and converted from ns to Mhz properly. Did I simply make a stupid mistake? Here's the relevant page from the datasheet:

author: madires
author_rank: Super Contributor
timestamp: August 16, 2015, 05:57:09 pm
content: I'm reading the ILI9341's datasheet right now (going to add support to the Transistortester) and I think your calculations are correct. A quick web search lists some blog postings claiming that a 24, 36 and even 48 MHz SPI clock runs fine.

author: Chris C
author_rank: Frequent Contributor
timestamp: August 16, 2015, 11:53:34 pm
content: Hmm, odd. I wonder why they underrated it so much. Or if individual variation between ICs is incredibly large.Or perhaps that rating applies only at the lowest core voltage. In looking over the initial register setup provided with the module, I noticed what appears to be an option to change that voltage, and that it's being set one step short of max.BTW, if you're talking about the same Transistortester that I think you are, that's an amazing project! And one I will be benefiting from shortly, if my package ever shows up.I'm familiar with most of the ILI9341, having written my own PIC-based driver for the ILI9341 for it. Should you run into any difficulties, I may be able to help, and will certainly be willing to try.

author: DavidMenting
author_rank: Contributor
timestamp: August 17, 2015, 01:55:36 pm
content: I was pleasantly surprised by this fact as well. I'm running 16 of them at the same time at a bit over 30 MHz in this art installation:

author: Chris C
author_rank: Frequent Contributor
timestamp: August 17, 2015, 05:23:15 pm
content: That's a wonderful zoetrope! Thanks for sharing it.

author: bastelWastel
author_rank: Newbie
timestamp: May 13, 2020, 10:20:08 am
content: I ended at SCLK=78.75 (315M/4) these days. Thanks for the Timing Chart posted above. For 2 weeks I was looking for this information despite I have the ILI datasheet! But seemingly I always stopped searching at the signal charts in chapter #7.

author: madires
author_rank: Super Contributor
timestamp: May 13, 2020, 01:07:48 pm
content: Welcome to the display overclockers!

author: soFPG
author_rank: Frequent Contributor
timestamp: May 15, 2020, 01:20:07 pm
content: Which controller does 80MHz SPI? ESP8266?8-Bit parallel would probably be easier in case you don't have an 80MHz SPI capable µC

author: madires
author_rank: Super Contributor
timestamp: May 15, 2020, 01:59:10 pm
content: You should be able to find ARM based MCUs with a sufficient clock rate. I have no idea about the ESP8266 which runs at 80 or 160MHz. A quick search shows that the SPI clock is derived from the system bus which runs at 80MHz and the smallest divider is 1. So it should be able to do 80MHz SPI.

author: Theboel
author_rank: Frequent Contributor
timestamp: May 15, 2020, 02:01:12 pm
content: I use ILI9341 with arduino nano my problem is the graphic look in slow motion/ slow update I really apreciate if someone can help me to solve this problem based from this "OC discussion"

author: TK
author_rank: Super Contributor
timestamp: May 15, 2020, 02:04:04 pm
content: STM32 @ 180MHz can do 45MHz SPI. The Teensy 4.0 runs an NXP cortex-m7 micro @ 600MHz, I have not tested SPI but I estimate it can go over 100MHz.

author: TK
author_rank: Super Contributor
timestamp: May 15, 2020, 02:05:26 pm
content: The spec posted by OP says MIN 100ns, so it is minimum 10MHz. Am I missing something?

author: madires
author_rank: Super Contributor
timestamp: May 15, 2020, 02:16:54 pm
content: Quote from: Theboel on May 15, 2020, 02:01:12 pmMax SPI clock rate for an ATmega328 running at 16MHz is clk/2 = 8MHz when using the hardware SPI. Bit-bang SPI is way to slow.

author: madires
author_rank: Super Contributor
timestamp: May 15, 2020, 02:20:36 pm
content: Quote from: TK on May 15, 2020, 02:05:26 pmYep, that's what the datasheets states. But several people tried higher SPI clock rates and the ILI9341/9342 was still happy. So we wonder what the real maximum is.

author: TK
author_rank: Super Contributor
timestamp: May 15, 2020, 03:27:40 pm
content: There is an interesting discussion on the Teensy forum about running ILI9341 @ 80MHz with a Teensy 4.0 boardhttps://forum.pjrc.com/threads/57652-Teensy-4-SPI-bus-gt-38mhz-possible

author: ajb
author_rank: Super Contributor
timestamp: May 15, 2020, 06:10:29 pm
content: Quote from: TK on May 15, 2020, 02:05:26 pmTime and frequency are inverse of each other, so minimum time determines maximum frequency and vice versa. As frequency goes up, period goes down, so anything above 10MHz will have <100ns period, and therefore violates the minimum time specification.I wonder if this means that the parallel interface can also be run faster than spec. Being able to write 16bits @ >15MHz would be nice.

author: TK
author_rank: Super Contributor
timestamp: May 15, 2020, 06:29:26 pm
content: Quote from: ajb on May 15, 2020, 06:10:29 pmYou are totally right... I had my senior moment...

author: newbrain
author_rank: Super Contributor
timestamp: May 19, 2020, 09:19:02 am
content: Just a single data point, but with a different controller: TheHX8357-D, in a 3.5" Adafruit display.I'm running it with the SPI (from an i.MX RT1021 evaluation board) at 45MHz: three times the maximum write clock frequency in the datasheet.No glitches or crashes.These controller chips seem to take a lot more than they are specified for.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 19, 2020, 09:30:37 am
content: FYI, the ST7735 and RM68050 do seem to run out of poop, near their rated timings.It's been a few years since I was actively developing with them so I don't remember exactly what or how much. My platform only has powers of 2 SPI clock control (prescalers) so I wasn't able to push very close to ratings.Tim

author: MulattoKid
author_rank: Newbie
timestamp: July 01, 2022, 01:12:06 pm
content: @newbrain - I'm curious if you had to do anything special to get the SPI clock to run at 45MHz? If I go above the specified 15.15MHz (66ns as in the spec for DBI Type-C WRX_SLC) the output on the screen is corrupted. I'm driving it from an ESP32-S3, but not sure if that matters...

author: ajb
author_rank: Super Contributor
timestamp: July 01, 2022, 03:43:54 pm
content: Quote from: MulattoKid on July 01, 2022, 01:12:06 pmHow do you have this hooked up? Can you share a photo of the setup or layout if it's on a PCB?How fast you can run SPI depends on connections and wiring as well. If you have flying leads on a breadboard or something you will start seeing signal integrity issues sooner than on a nicely laid out PCB, and those issues will eat into whatever margin you might have for exceeding the data rate spec. Another complication is pin drive strength, I don't know if the ESP32 has a setting for that, but if it's set too high or too low you can also have issues. Insufficient drive strength will round over edges, and excessive drive strength will cause ringing and reflections, especially with non-ideal layout/wiring.

author: newbrain
author_rank: Super Contributor
timestamp: July 01, 2022, 07:44:53 pm
content: Quote from: ajb on July 01, 2022, 03:43:54 pmSignal integrity is overrated.(joking, of course, but read below!)I'm honestly too ashamed to post a picture - it's the perfect example of how not to do these thingsMy setup is just a bunch of 20 cm Dupont wires from the Arduino like connector of an iMX RT1021 evaluation board tothis display.The display board has some mods (to use I2C on the touch screen controller instead of SPI), and I'm never reading back from the display (max SPI clock frequency is lower when reading for that controller, IIRC).Apart from that, nothing special, so the worst possible setup you could imagine, also taking into account that the 1021 lpspi peripheral needed to be overclocked to get to 45 MHz.A friend of mine has a slightly better setup (it's an SDR receiver project we share), he soldered some IDC cable.I need to dismantle the thing to carry it with me when I go back and forth with Italy, so never bothered doing a better job.I raised the SPI frequency until artefacts started appearing, then backed off a bit - that's it.The SW is extremely stable (FreeRTOS+CMSIS DSP based), and we never observed any glitches on the display - it has been left running for days on end - the display is updated every 100 ms with a 426×128 FFT and waterfall (plus as needed for other fields).Funny as it might seem, I'm instead having 100 kHz I2C signal integrity problems (adding the touch screen controller was the straw that broke the camel's back - Audio codec, RTC, Si5351, 24C16 EEPROM - all flying Duponts, too).

author: DavidAlfa
author_rank: Super Contributor
timestamp: July 02, 2022, 02:15:54 pm
content: Yes, you usually can do that, I've ran 75MHz SPI without issues, but works only for for writing, reading you'll get garbage, you'll have to lower the speed.You're playing with tolerances and limits, you might find 10mm longer traces no longer work.Also you might be getting small errors, but not noticiable by human eyes.

author: MulattoKid
author_rank: Newbie
timestamp: July 27, 2022, 06:38:43 am
content: Thanks for the replies (I'm a bit late as I was away on vacation for a few weeks)I'm afraid I can't share pictures, but the ESP32-S3 is on an in-house development PCB, and I have 20cm breadboard jumper wires connected from it to the Adafruit PiTFT 3.5" Touch Screen (HX8357-D controller). I'm only writing to the display, and I'm using the ESP's libraries for setting up the SPI bus etc.QuoteSorry, what peripheral is this?

author: newbrain
author_rank: Super Contributor
timestamp: July 27, 2022, 08:55:47 am
content: Quote from: MulattoKid on July 27, 2022, 06:38:43 amIt's just the name of the NXP iMX RT10xx series SPI peripherals, low power SPI - there is also a different one based on the FlexIO.IIRC, lpspi maximum frequency is 33 MHz, so I'm out of specs on both MCU and display sides.It started just for fun as an experiment, but since it's perfectly stable (as said, on two boards+display), I left it alone and enjoyed the increased speed.Of course, not recommended in any non-hobby application.

author: MulattoKid
author_rank: Newbie
timestamp: July 27, 2022, 09:52:24 am
content: I see. As far as I can tell the maximum SPI frequency the ESP32-S3 can drive is higher than the what the HX8357D is rated for, so I don't think that's an issue for me. Right...this is not a hobby project, but since it seems other people got it running at higher rates I was curious to try, as ~15MHz isn't really high enough to refresh the entire display at a real-time-ish frame rate with 16 bits per pixel.