GLCD ILI9341 Very slow

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

Moderator: Benj

Post Reply
berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

GLCD ILI9341 Very slow

Post by berubec »

Flowcode V6.1 with DSPIC33256MC502 at 70mips/140mhz.
SPI Master component:
1*AS5048A AMS 14-bit Rotary Position Sensor 16 bit Data SPI
1*DAC121C101 16 bit Data SPI
1*ADC121S101 16 bit DataSPI
ILI9341 GLCD component:
1*Adafruit PRODUCT ID: 1651
--ILI9341 Adafruit 2.8" GLCD SPI
All works fine but refresh speed very slow. (100ms-300ms for only 3digit)
How speed up communication for component ILI9341 GLCD?

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

I have had a look through the component code and managed to clean up the functions a bit which should hopefully speed up the operation.
gLCD_ILI9341.fcpx
(7.08 KiB) Downloaded 397 times
The file needs to be placed here before restarting Flowcode "C:\Program Files (x86)\Flowcode 6\components".

Let me know how you get on.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

No difference. What is the clock speed for this GLcd component? How should change? ILI9341=10mhz SPI. I run at the higher speed possible for the IC. I want display motor angle that run at 4 rpm 4*360/60= 24 refresh/sec minimun but not possible at this moment with only 3 digit. I also want display current and voltage of the motor= 8 more digit to refresh.
// 70Mips = 140Mhz = 7.37Mhz*M/N2/N1
PLLFBD=74; // 74 M=76
CLKDIVbits.PLLPOST=0; // N2=2
CLKDIVbits.PLLPRE=0; // N1=2

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

The display is bit banged and there are no delays as far as I can see so I'm just trying to get the code as optimised as possible. Therefore the display should be running very fast with your high speed device.

Regarding your clock speed have you set the clock speed in the project options to 140000000. Once you've done this try a 1 second flasher test on the hardware to see if the device is actually running at 70MIPs.

http://www.flowcode.co.uk/wiki/index.php ... ED_flasher

Let me know how you get on.

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: GLCD ILI9341 Very slow

Post by Benj »

I use this code for the dsPIC ECIO and upcoming programmer board using an 8MHz crystal. It sets up the main osc to 70MIPs and then sets the USB prescaler.

Code: Select all

	// Setup configuration
	PLLFBD = 58;    			// M=60         

    CLKDIVbits.PLLPOST = 0;         // N1=2
    CLKDIVbits.PLLPRE = 0;          // N2=2
    OSCTUN = 0;                     // Tune FRC oscillator, if FRC is used

    // Disable Watch Dog Timer
    RCONbits.SWDTEN = 0;

    // Clock switching to incorporate PLL
    __builtin_write_OSCCONH(0x03);  // Initiate Clock Switch to Primary

    // Oscillator with PLL (NOSC=0b011)
    __builtin_write_OSCCONL(0x01);  // Start clock switching
    while(OSCCONbits.COSC != 0b011);

    // Wait for Clock switch to occur	
    // Wait for PLL to lock
    while(OSCCONbits.LOCK != 1)
    { };
    
	//USB h/w initialization.
    ACLKCON3 = 0x24C1;   
    ACLKDIV3 = 0x7;
    
    ACLKCON3bits.ENAPLL = 1;
    while(ACLKCON3bits.APLLCK != 1); 
Note that this code is in the ECIO bootloader so you don't actually need it in your project if using the ECIO device.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

1 second flasher test is OK. I don't use crystal, just internal
Primary Oscillator disabled
Both clock switching and fail-safe clock monitor are disabled
Oscillator is fast RC oscillator with divide-by-N with PLL module (FRCPLL

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

Can you post your program so far so we can have a quick look to see what could be causing the slowdown.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

Just macro "Read Angle" is use
Attachments
Test_Servo_glcd.fcfx
(28.44 KiB) Downloaded 306 times

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

I have make other test with cpu at 140mhz
one led on RB5 that light alternate on-off each cycle.
Print "123" on lcd on each cycle.
Result is 13hz frequency led???
Replace Print "123" on lcd by 50us delay =Good, 10khz cycle led
CPU have good speed but send data very very slow to Glcd

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

Look this http://www.dorkbotpdx.org/blog/paul/dis ... timization
Display is ready to run faster. How adjust prescsale or orther setting to speed up.
I have try with pic16f1938 at 48Mhz and take 1.3sec to write "123"?
What is the SPI ILI9341 clock setting? How adjust? It's possible to share SPI ILI9341 LCD port with other SPI devide (SPI Master)?
It's very rush project.

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

Here is the component source if you want to have a play and see if you can make it any faster.
glcd_ILI9341.fcfx
(77.89 KiB) Downloaded 334 times
There is no pre-scaler we literally are writing to the display as fast as we can toggle I/O.

The bottleneck is likely the fact that each and every pixel write (Plot or BPlot) needs to call the Address_Set function which sets the row and column of the pixel to write to. Now if we could instead open a 6 x 8 window and write the pixels in the correct order then this should hopefully speed things up quite a lot. To my count it would be 88 less clock cycles per pixel which equates to something like 4136 less clock pulses per character which is quite a saving.

If your still stuck then I will have a go at doing this for you.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

Currently use dspic33EP256MC502 at 140Mhz 70ips. It's same?
Go for all. I just want speed to continu my project

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

Right this component should speed things up a bit when printing text as it now opens up a window and writes all the vertical pixels in one operation. Unfortunately the mods to increase the speed will break the transparent text mode so I have currently removed this from the code. There might also be issues with the variable orientation.
gLCD_ILI9341.fcpx
(7.09 KiB) Downloaded 302 times
There is potentially more speed to get out of the code but this would mean re-writing the print function to work horizontally rather than vertically.

Let me know how you get on.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

I currently works to use SPI master for communictation withthe component code. The font is in ReadASCIILUT macro. It's possible to edit this? Also, it's possible to have SPI Master component code to merge with LCD.

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: GLCD ILI9341 Very slow

Post by Benj »

Hello,

Did my new component give you any speed increase? I would imagine that the SPI component would be slower than the current simple bit banging method, not faster but I could be wrong.

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

Great speed is 5X more. My led flash at 61hz compared to 13hz. More speed possible(x2)? :D
It's possible to have fcfx of this component and for SPI Master?
Thanks Thanks and Thanks

berubec
Posts: 18
Joined: Wed Oct 22, 2014 12:32 pm
Been thanked: 6 times

Re: GLCD ILI9341 Very slow

Post by berubec »

My glcd also have xpt2046 touch panel. It's possible to integrate this option in the ili9341 component?

Post Reply