ILI9341

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
ittsjamesss
Posts: 18
Joined: Tue Jan 15, 2019 11:53 am
Been thanked: 2 times
Contact:

ILI9341

Post by ittsjamesss »

Morning,
I have a ILI9341 elegoo 2.8 inch tft lcd shield running on a arduino uno r3 pdip. I have the program running in simulation on flowcode 8 and its compiling to the chip successfully but the display is then not displaying anything. When going into the displays properties on flowcode it doesn't allow me to assign a lot of pins I would expect to such as data lines. Also things in flowcode do not have the same assignments as the pins in the user manual. Do you have the correct property panel settings for pins such as LED, cs etc. All of them please, as I have tried a few and getting frustrated.
Presuming i have tried the correct ones, is there another reason why the program goes though successfully and does not display anything, such as a setting I am missing?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

Please can you upload or link a datasheet showing the pins on your specific display and I can then help using the specific names for your hardware.

ittsjamesss
Posts: 18
Joined: Tue Jan 15, 2019 11:53 am
Been thanked: 2 times
Contact:

Re: ILI9341

Post by ittsjamesss »

Hi,

Please refer to data tables 1.3 and 1.3.2.

https://class.ece.uw.edu/474/peckol/doc ... .03.22.pdf

If you need anything else please let me know.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

It looks like you need to use the ILI9341 IM0-IM3 pins to set the interface mode and these don't appear to be brought out on the connection header so it may not be possible to drive your display using the serial interface we currently support.

If you have SMD options on the back of the display then it might be possible. However the serial interface pins don't appear to be on the connector either.

I'm currently investigating a parallel component to allow for the 8-bit and 16-bit parallel 8080 connection modes. I'll see if I can get it bumped up the list so you can drive the display. What would be really helpful is if there is a library or example code specific to your display and it's pins as that would give me a good starting point for creating the parallel 8080 type display component.

ittsjamesss
Posts: 18
Joined: Tue Jan 15, 2019 11:53 am
Been thanked: 2 times
Contact:

Re: ILI9341

Post by ittsjamesss »

Do you have a email so I can send you the library for it

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

I've sent you a PM.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

Thanks for the files.

I've had a go for you at adding the 8-bit and 16-bit comms modes and pushed the updated component to the update system. I've added the modes to the "GLCD (ILI9341)" component and you can set the comms mode using the Connection Type component property.

Let me know how you get on.

ittsjamesss
Posts: 18
Joined: Tue Jan 15, 2019 11:53 am
Been thanked: 2 times
Contact:

Re: ILI9341

Post by ittsjamesss »

thankyou, will see if that's fixed the problem now. Another problem that's occurred is when i go into display to select a LCD it's only giving me 4 graphical displays to choose from

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

It's probably worth doing a full database update as we've been cleaning up and reordering the component menus a bit.

Simply change "Files in use" to "Full Database" in the update dialogue and it should get the latest of everything.

ittsjamesss
Posts: 18
Joined: Tue Jan 15, 2019 11:53 am
Been thanked: 2 times
Contact:

Re: ILI9341

Post by ittsjamesss »

All sorted thankyou

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

Hello

we are trying to use the 8bit mode on our display but without success.

The strange things are as follows.

The CS pin is always low and the timing of WR is just 100KHZ.

The display does not show any image, but the backlight led turns on and off at the beginning and at the end of the cycle.

The display is always driven by an ili9341 however I am attaching the datasheet of the model we are using.

We are trying on a demo board with pic32mx440f256h but we also tried with another pic32mc470f512h without success

Benj i sent you a pm containing the libraries and a demo code directly from the display manufacturer hoping it could be useful
Attachments
ER-TFTM024-3_Datasheet.pdf
(1.03 MiB) Downloaded 218 times
test_2.fcfx
(9.65 KiB) Downloaded 229 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

I confirmed the 8-bit mode was working well with hardware yesterday. Have you got the jumpers setup correctly to put the display into 8-bit mode.

See section 4.3 of the datasheet you posted.

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

Hello

yes I followed table 4.3 and I removed the resistors and joined the jumpers as photos

I used this display with the spi mode and it works correctly.

I connected the pins as follows
LCD PIN MCU PIN

3(DB0) RE0
4(DB1) RE1
5(DB2) RE2
6(DB3) RE3
7 (DB4) RE4
8 (DB5) RE5
9 (DB6) RE6
10(DB7) RE7
21(RST) RD11
23(CS) RF1
24(D/C) RG9
25(WR) RC14
26(RD) RC13
29(BKL) RD8

is it normal that the chip select pin is always low as in the document I attached?

The reading was also made with the display completely disconnected, but with the same result.
Attachments
ILI9341.jpg
ILI9341.jpg (111.15 KiB) Viewed 8839 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,
is it normal that the chip select pin is always low as in the document I attached?
I've had a look and currently the CS is configured low by the initialise and then remains there to optimise the code. This makes more sense for SPI but when you're using a lot of parallel pins it maybe makes sense to allow the option of it being properly toggled when communicating to the display.

I'll see if I can get this added for you.

Can you post your program just to see if that helps at all? As I say the 8-bit mode was working well for me. Also are you using the latest version of the component as there was some changes done and posted late in the day on Wednesday.

Looks like a nice board, the FAT component can probably be used to control the micro SD card if you so wish. You then have access to the bitmap drawer FAT library if you need to display images :D Might have a look for one of these for myself.

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

hello benj

this card, is very useful in the prototype phases of projects as in our case.

I did not have time to test the SD card but I can confirm that the SPI mode and 8 bit parallel work.

I have also tested the touch and it works properly too.

As soon as I have a few minutes of time, I will also test the sd port.

However now the display works! It was just a wrong connection! :mrgreen:

I'm comparing the 8-bit interface mode to the spi-hardware.
The speed in loading the same image using the drawer bmp is greater while keeping the same clocks.

Analyzing the speed of the WR pin, it is going to maximum at 500KHz, about 2 uS between a write and the other one, as you can see in the attached figure.

This was achieved with the 80MHz clock speed.

Reading the datasheet the ili9341 chip is able to receive two consecutive writes in a minimum interval of 66nS (about 30 times faster)

Is it possible, even making it settable to increase compatibility, change the writing speed?

This would help us a lot in refreshing images and / or complex screenshots.
Attachments
ili-9341_datasheet.jpg
ili-9341_datasheet.jpg (65.82 KiB) Viewed 8782 times
timing_ili9341.jpg
timing_ili9341.jpg (90.55 KiB) Viewed 8782 times
clock_WR_pin.JPG
clock_WR_pin.JPG (113.12 KiB) Viewed 8782 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

I've now added a new property to the component to allow for the CS pin to be automatically toggled or remain in the enabled mode.

There are no delays in the ILI9341 component when drawing data so the delays are likely coming from elsewhere. Can you run the SPI for the FAT component any faster by lowering the prescaler?

If you attach your project then we can have a look and see if there are any additional optimisations that could be made.

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

hello Benj

I tried the new realease and it works properly. :D

what I wanted to say in the previous message was this

the parallel mode is influenced by the speed at which the ports go from one state to another, which affects the performance of the display.

Maybe I'm getting a bit confused with the clock settings but it seems like the pic32 is not working properly.

I made a single program that set first high and then lower the portB14 to see how fast it is in doing this operation

the cycle employs 1.2uS which is a very high time.

To make an instruction, pic use 4 clock cycles, but this value does not return with the result.

As said before maybe I'm doing a bit of confusion with the clock.

I'm testing everything on a PIC32-PINGUINO-MICRO demo_board with pic32mx440f256H.

TEST_2 for display

TEST_2_BIS for port
Attachments
test_2_BIS (1).fcfx
(6.87 KiB) Downloaded 111 times
PIC32.jpg
PIC32.jpg (118.72 KiB) Viewed 8728 times
test_2.fcfx
(13.64 KiB) Downloaded 127 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

Hello

I tried to run the same port program directly from MPLAB X IDE.

In a first test the port speed was similar to that of flowcode.
Investigating a bit about microchip forums it is advisable to include the SYSTEMConfigurePerformance instruction in your program to optimize the performance of the pic.

Recompiling again I received an increase of the speed up to 8MHz it completes the entire cycle in just 125ns. (it is not yet the correct value but I am on track)

Is it possible to integrate this thing into flowocde?

In the first image with the active instruction (8MHZ)

In the second image with the commented instruction (1.12MHz)

In the zip file the program for MPLAB
Attachments
2.JPG
2.JPG (80.53 KiB) Viewed 8705 times
1.JPG
1.JPG (101.38 KiB) Viewed 8705 times
test_port.zip
(91.81 KiB) Downloaded 126 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

You should simply be able to pop this code into a C icon in Flowcode.
#define GetSystemClock() 80000000
// initialize the device
SYSTEMConfigPerformance(GetSystemClock());
SYSTEM_Initialize();
Very strange this speeds up the I/O though, the PIC32 devices are a bit bizarre!

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

Hello Benj

I tried to put the code into the flowchart without succes. :cry:

The compiler returns me this errors
//
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe -mprocessor=32MX470F512H -O1 -o "Y:\~1\Mikroe\test_2_TRIS.c"
\AppData\Local\Temp\ccncA10r.o: In function `main':
test_2_TRIS.c:(.text+0x4cc): undefined reference to `SYSTEMConfigPerformance'
test_2_TRIS.c:(.text+0x4d4): undefined reference to `SYSTEM_Initialize'
collect2.exe: error: ld returned 255 exit status

C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe reported error code 255
//

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ILI9341

Post by Benj »

Hello,

Sorry you will also need to add this to the supplementary code window available via the Project Options.

Code: Select all

#include "mcc.h"
#include "mcc.c"
#include "system.h"
And then find the mcc.h, mcc.c and system.h files from the MPLAB setup and copy them to your project folder.

Hopefully this should solve the compilation errors.

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: ILI9341

Post by Alkaline »

Hi everyone

In these days I have studied the question of the call SYSTEMConfigPerformcance a little better.
From what I understand it seems that the pic32 once configured voluntarily leave some options disabled. It will be the task of the programmer to set them appropriately.
These parameters can be configured by consulting the following application note

http://ww1.microchip.com/downloads/en/d ... yguide.pdf

In order to use these functions it is necessary to download the plib that are no longer part of the normal toolchain from version 1.40 of the microchip compiler.
The libraries must be downloaded to the following address
https://www.microchip.com/SWLibraryWeb/ ... %20Library
Once you download them they will have to be installed in the direcotry of the flowocde compiler

At this point it will be possible to include the libraries using supplementmaentry code and then directly in the main the code

I am testing the code using the flowcode components and this does not seem to cause any problems.

In the example attached here, the speed of the GLCD component ili9341 with an 8bit interface connection has increased drastically.
The same 40Kbit bitmap image is loaded in just 1 second against about 6 seconds if SYSTEMConfigPerformcance is commented.

I now ask the Matrix Team, if you can study the situation on the pic32 and introduce this directly from the config so that the user has a good optimization anyway. This allows better exploitation of the speed of the pic32!
Attachments
test_systemconfig.fcfx
(15.59 KiB) Downloaded 133 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: ILI9341

Post by QMESAR »

Alkaline wrote: In order to use these functions it is necessary to download the plib that are no longer part of the normal toolchain from version 1.40 of the microchip compiler.
Yes it is because the plib is legacy -the plib (libraries) is now part of the Harmony Code creation framework ,we need to make sure that what gets added to Flowcode will not affect us when using code gerenated by Harmoney in FC C code blocks
just my 2 cents

Post Reply