How to add display with ili9341 controller (SPI+RGB666) Linux on iMX6

HI all,

We made a board with an interface for an LCD with the ili9341 controller using SPI and RGB666.
Hardware wise all should be connected correctly.
I’m now in the progress of getting the display to work on Linux, but I have no clue on how to get the communication between the board and display working via SPI.
I understand I need to create a LCD driver for the ili9341 controller ( I found the source codes for this on the internet). But now I need to know how to get the kernel to work with this driver.

In the drivers\video\mxc\mxc_lcdif.c I added the display in the lcdif_modedb:

/* 240x320 @ 70 Hz , pixel clk @ 6.35MHz */
	"DET24QVF2H-C", 70, 240, 320, 157480,
	 .left_margin = 20,
	 .right_margin = 10,
	 .hsync_len = 10,
	 .upper_margin = 2,
	 .lower_margin = 4,
	 .vsync_len = 2,
	 .sync = 0,
	 .flag = 0,},

In u-boot I editted the vidargs:

vidargs=video=mxcfb0:dev=lcd,"DET24QVF2H-C",if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off fbmem=8M 

This however does not help me with starting the display via the SPI.

Any pointers and examples are very welcome.

Best regards,

Hi Dennis

From the datasheet I guess that ili9341 controller accepts parallel RGB data when configured correctly. Maybe one needs to configure some registers over SPI or maybe the chip is configured at powerup for 18bit RGB.

Assuming that is true you have to configure the right timings, e.g. by doing the changes you describe above.

Did you check with an oszilloscope that you get about the right timings, e.g. the pixelclock is about 6.35MHz, HSync and DE are about 24kHz and VSync is about 70Hz?


Hi Max,
I know I have to do some register settings via SPI. I also have the code for that.
What I don’t know is where I need to add this code in order for the kernel to see it and start it.
I’m convinced that, if I get the kernel to run the SPI code, the display will work.


Hi Dennis

I would start by having a look at spidev, a way using SPI from userspace.
In the directory the said file is in is also a ready made test program which could be the skeleton of your program.

For a final solution you might enable the ecspi driver to U-Boot and configure you chip there to allow early output during kernel boot.


Please note that we do not really support the Yocto BSP Linux kernel 4.1.15 on our Apalis/Colibri iMX6 modules as of yet. Our current embedded Linux BSP V2.6 beta 2 still relies on the Linux kernel 3.14.52 as noted in the release notes.

Hi There,

I am trying to drive the same display with IMX6DL But its not working. I am using Yocto BSP Kernel (4.1.15).
I have done changes as suggested above + SPI changes to device tree.

But it is getting detected as two different FB devices instead of 1.

Please find the updated files in attachment.

Can you please help me with this?link text

Hi Marcel,

Thanks for your reply. I understand that you don’t support Yocto BSP. But if you can provide me a generic guideline for change to use SPI+Parallel RGB interface for using display DET24QVF2H-C with linux kernel, it will really great help.

I have added theses driver as module in dtsi file.

Thanks and Regards
SE,Hi Marcel,