Page 1 of 1
GLCD ILI9341 Very slow
Posted: Thu Nov 06, 2014 5:43 pm
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?
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 1:12 pm
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.
The file needs to be placed here before restarting Flowcode "C:\Program Files (x86)\Flowcode 6\components".
Let me know how you get on.
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 3:18 pm
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
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 4:38 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 4:41 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 5:00 pm
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
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 5:07 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 5:42 pm
by berubec
Just macro "Read Angle" is use
Re: GLCD ILI9341 Very slow
Posted: Fri Nov 07, 2014 8:46 pm
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
Re: GLCD ILI9341 Very slow
Posted: Tue Nov 11, 2014 5:50 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Tue Nov 11, 2014 6:30 pm
by Benj
Hello,
Here is the component source if you want to have a play and see if you can make it any faster.
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.
Re: GLCD ILI9341 Very slow
Posted: Tue Nov 11, 2014 6:54 pm
by berubec
Currently use dspic33EP256MC502 at 140Mhz 70ips. It's same?
Go for all. I just want speed to continu my project
Re: GLCD ILI9341 Very slow
Posted: Wed Nov 12, 2014 10:38 am
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.
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.
Re: GLCD ILI9341 Very slow
Posted: Wed Nov 12, 2014 4:13 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Wed Nov 12, 2014 4:26 pm
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.
Re: GLCD ILI9341 Very slow
Posted: Wed Nov 12, 2014 6:58 pm
by berubec
Great speed is 5X more. My led flash at 61hz compared to 13hz. More speed possible(x2)?

It's possible to have fcfx of this component and for SPI Master?
Thanks Thanks and Thanks
Re: GLCD ILI9341 Very slow
Posted: Sun Nov 16, 2014 8:04 pm
by berubec
My glcd also have xpt2046 touch panel. It's possible to integrate this option in the ili9341 component?