ILI9341(new)SPI library for Due supporting DMA transfer(Uno, Mega,.. compatible)

I am not sure, how I can determine if I have access to the IM# pins :slight_smile:
I am talking about this display: http://en.startek-lcd.com/IPS024/2015-11-21/22228.chtml
It has multiple interfaces and I use SPI.

I am afraid, that you would say I should go for a ILI9341 display.
It's difficult for me, as I have several requirements. Among others the FPC route is important ...

Thanks for your help!
ph

Woo-hoo. The datasheet shows that IM0-IM3 are on pins 3-6 of the 45-way ribbon cable.

So you can select SPI interface. But unless you are experienced, you will find it difficult to alter the operation of the library as well as the interface driver.

Marek may or may not be interested. It would be a lot of work for just one beneficiary.
From your point of view. If you are using 1000 cheap ILI9325 panels it might be worth your time and effort.
The IPS panels certainly have better viewing angles than regular TFT.

I suspect that you could get a similar price / quality with a modern controller. If you are intending to use 1000s of screens, Chinese agents will get you a good deal.

David.

Thanks for your explanations.
I will not need 1000 pcs in the near future, so probably it's not worth the time. I was hoping that it's only a small adaption in the first place ...

Can you recommend a good Chinese agent?
I am googling the last couple of days and wrote emails to all agents or manufacturer I've found, that nearly meets my requirements. Some did reply some not. But I haven't found a suitable display right up to now.

Currently I am using this display:
https://fanscoo.en.alibaba.com/product/940112893-217020767/Small_2_4_transflective_sunlight_readable_lcd_panel_display_screen_module_with_SPI_RGB_optional.html

That meets all my requirements, but they break with no obvious reason.
I think some cells leak out and black/grey lines are visible.

Thanks for your help,
ph

What is your current controller?
The link does not mention the controller.

I have only used "cheap" TFT screens. They look fine at 90 degrees. Ok for graphics from an angle but photos look appalling.

Incidentally, the ILI9325 does not work as fast as the ILI9341.

David.

The Fanscoo Display has an ILI9341 controller. With that display Markek's lib works perfectly.
But these displays are failing and that's why I am looking for another one.

I didn't find a transflective display with SPI and that FPC route and ILI9341 controller ... :frowning:

Thanks for pointing out, that ILI9341 is faster. I was not aware of that. I used a ILI9325 controller once, but I thought the speed came from the DMA of the Due and Marek's lib.

The ILI9341 seems to work much faster than the datasheet says.

Don't assume that other controllers have such good performance.

David.

@david_prentice,
Hallo David, I've one more question :slight_smile:
I found a few displays using the ST7789V controller instead of the ILI9341.
I found some older posts from you stating [1][2], that both controllers are very similar and just the RGB order is switched.

Would you say, that adapting Marek's lib to support ST7789V controller is doable?
You said, that ILI9341 is faster than others. Do you have a comparison between these two controllers using SPI with DMA?

[1] ST7789 library fusion - Arduino Zero - Arduino Forum
[2] https://www.avrfreaks.net/forum/320x240-controller-differences-st7789s-and-ili9341-solved

ST7789 and ILI9341 are both MIPI controllers. The User commands and behaviour is identical.

Manufacturer registers are different. So the initialisation sequence in tft.begin() will change.

Panels vary. You set RGB, SS, GS, ... to suit the specific panel with the the Manufacturer registers.

I suspect that ST7789 obeys the datasheet spec for SCK speed.
The ILI9341 runs happily @ 27MHz. It will do many commands @ 48MHz. I might compare them one day.

Why do you want to use the Sitronix part?

David.

Thanks for your reply.
If I got you right, then only the init sequence will change with the ST7789 controller, but the remaining part of the library (all the drawing functions) are compatible.

I do not necessarily want to use another controller rather than the ILI9341.
The problem is, that I am currently using a display, that perfectly fits my needs, but has a high failing rate.
I've uploaded a gif showing the damage: ezgif.com-video-to-gif.gif - directupload.net
In the video I switch background from black to white and the same with disabled backlight.

I have to replace the failing display, with a more robust one. That's why I have very tight requirements.

  • Sunlight readability (transflective)
  • SPI
  • ILI9341
  • FPC route
  • 2.4inch

Honestly, I don't find a comparable display from another manufacturer. So, I am looking for a similar display, where I do not have to change PCB layout, software (or at least the drawing functions).

For some reason, the majority of the displays I found or the Chinese agents recommend have the ST7789 controller.
What would be your approach?

Thanks,
ph

Buy sample screens from AliExpress. Try them for yourself.

I would guess that every make will have a similar construction. If punters press too hard, you will break the glass. Full size medium or high density foam backing might be wise.

If you choose a screen with capacitive Touch, people might be more gentle.
Or just accept some breakages. After all, mobile phones get replaced (or repaired).

It should be straightforward to read the ID and select ST7789 or ILI9341 automatically.
Please note that SPI ST7781, ILI9325, HX8347, ... would require some time and effort.

David.

The weird thing is, that I don't know what happened to the damaged display.
There are no signs of mechanical influences. Based on the description of the users, all displays failed while the device was turned off.
There were no shock, fall or any other remarkable incident.

For me it looks like the cells were broken and the liquid leaks.
I hope to find the reason and at least find the fragile displays before using them or prevent failing. This would be the easiest solution with no adaption necessary :slight_smile:

Thanks for your help.
You're really a display expert!

ph

Hallo David,

maybe you could help me again :slight_smile:

I received the new displays with the ST7789V controller a few days ago.
With the help of a test board, I wired it to the Arduino Due. For testing I wired a test board for the old display with ILI9341 controller parallel to it. The old display is still working, so I am pretty sure, that my wiring is correct.

I think I have a software problem, as the new displays does not show anything.
I modified the init sequence of Marek's lib, but still no luck.

Currently I am using this as init sequence.
#define ILI9341_MADCTL 0x36
#define ILI9341_PWCTR1 0xC0
#define ILI9341_PWCTR3 0xC2
#define ILI9341_PWCTR4 0xC3
#define ILI9341_GMCTRP1 0xE0
#define ILI9341_GMCTRN1 0xE1

static const uint8_t init_commands[] PROGMEM = {
2, ILI9341_MADCTL, 0x00, // memory access control
6, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, // porch settings
2, 0xB7, 0x72, // Gate control, VGH,VGL
2, 0xBB, 0x3A, // VCOM
2, ILI9341_PWCTR1, 0x2C, // power control, VRH[5:0]
2, ILI9341_PWCTR3, 0x01, // power control, SAP[2:0];BT[3:0]
2, ILI9341_PWCTR4, 0x14, // VAP
2, ILI9341_PWCTR5, 0x20,
2, 0xC6, 0x0F, // 60hz 0A
3, 0xD0, 0xA4, 0xA1, // AVDD VCL
15, ILI9341_GMCTRP1, 0xD0, 0x07, 0x0D, 0x09, 0x08, 0x25, 0x28, 0x53, 0x39, 0x12, 0x0B, 0x0A, 0x17, 0x34, // set gamma
14, ILI9341_GMCTRN1, 0xD0, 0x07, 0x0D, 0x09, 0x09, 0x25, 0x29, 0x35, 0x39, 0x13, 0x0A, 0x0A, 0x16, 0x34, // set gamma
1, 0x21,
2, 0x3A, 0x05,
5, 0x2A, 0x00, 0x00, 0x00, 0xEF,
5, 0x2B, 0x00, 0x00, 0x01, 0x3F,
1, 0x2C,
0
};

I also tried the init sequence from you mcufriend_kbv library.

But no matter what I am doing, the result is still the same: the display stays black.
I also used the Adafruit library, but again no luck.

Do you have any idea, why it could not work?
I know it's quite hard for you, to make a diagnosis without having the hardware in front of you. But I am quite stuck, maybe you have a few fresh ideas.

Thanks

EDIT:
Attached the data sheet of the display.

KD024QVRMA038 SPEC V1.0.pdf (1.62 MB)

The 45-way ribbon contains lots of signals. You either solder to an adapter pcb or via a ZIF ribbon connector.
The IM0-IM2 lines determine the interface type.

Personally, I would choose the same 4-pin SPI interface as Marek uses for the ILI9341.

Mareks's tables look like : <numargs, cmd, args...
My tables use : cmd, numargs, args...

Do you have a GitHub project?
Do you have a photo of your ribbon connections?

David.

Thanks for your help.

Sorry, for the rare information in my first post.
I am trying to bring the display alive with a custom Arduino Due compatible board.

I noticed the different format between the two libraries.
I tried to convert it by bringing the numargs in the first position and increasing it by 1.

The wiring is quite unclear, that's why I attached the schematics.
I've pushed a small test project to GitHub: GitHub - phhoef/DueST7789Test
I am using VSCode with PlatformIO as IDE, not the Arduino IDE. Hope it's ok for you.

You find a folder called "init code" in the repository. I got this from the manufacturer of the display. It contains example code for the init sequence of the display. I tried to covert these statement into Marek's format, but obviously with no luck.

Thanks,
ph

Your schematic "looks" ok. Have you tested your wiring for shorts, broken tracks, ... ?

I would never trust PlatformIO.

God gave you the Arduino IDE. It works.
Run Marek's examples on a proper SPI ILI9341 on a Due.

Fork Marek's library. Add the ST7789 init code. Then I can see what changes you have made.

David.

I tested the wiring. As far as I can tell, everything works as it should.
In addition, I've wired another test board for the ILI9341 display.
It's like: Arduino -> ST7789 test board -> ILI9341 test board.

The ILI9341 display is working.
So, that's why I think, it's not a problem with the hardware or the wiring but only with the software.

I forked Marek's lib and changed the init code. GitHub - phhoef/ILI9341_due: Arduino Due and AVR (Uno, Mega, Nano, Pro Mini,...) library for interfacing with ILI9341 SPI TFTs
The new init code is based on the instruction I got from the manufacturer. As I mentioned, you find these instructions in the folder "init code" of the other git repo.

I strongly advise using real numbers for the command. Or at least use a ST7789_CMDREG macro.

Your table has:

14, ILI9341_GMCTRN1, 0xD0, 0x07, 0x0D, 0x09, 0x09, 0x25, 0x29, 0x35, 0x39, 0x13, 0x0A, 0x0A, 0x16, 0x34, // set gamma

The numargs field should be 15.

Tables are nice to read and maintain. However you must be meticulous in the sequence. If you get a single numargs wrong, the whole caboodle collapses.

I only have a non-CS ST7789. It needs SPI MODE3. And it does not fit my "adapter protoshield"

David.

I am sorry, I tried different init sequences and obviously things got mixed up.
The num args were correct and I just pushed the wrong version to GitHub. Anyhow, I tested it again but no luck.

Can you explain, what you mean with "numbers for command". Do you recommend using decimal numbers instead of hex?

If the wiring is correct and there is no mistake in the init sequence, what else could fail?

ph

If I feel keen, I will add a 7-pin header to the Due adapter Protoshield. Then I could try my ST7789.

Seriously. You should put real code on Github. Just create different Branches.

The ST7789 has exactly the same User commands as the ILI9341. It is only the Manufacturer commands that are different e.g. init sequence.

Do you have a debugger? I can use Jlink, STlink, Atmel-ice if I want to use SWD or JTAG with the SAM3X chip. To be honest, I have seldom bothered with Due.
It is much more convenient to use Zero or STM32 Nucleo

David.

I found this thread: 2.4 Transflective TouchScreen 240x320 Display ST7789V - Displays - Arduino Forum
That's the same display, but with a touch panel (which I do not need). And at least it worked at the end.

I do not have a debugger right now. Would it help finding the problem? Which one would you recommend?
I have Logic Analyzer (Saleae), but I am not sure if it helps here? I could monitor the MOSI signal to check if it is send. But I am pretty sure, that the connection is working, as I connected the ILI9341 parallel to the ST7789 display (with two test boards).

I am afraid, I have to use the Due.

Could you have a look in the init code from the manufacturer?

I tried the SPI/4SPI and the SPI+RGB/4SPI+16bit init sequences.
It's not totally clear to me, which init sequence is the right one?