View previous topic :: View next topic |
Author |
Message |
andro
Joined: 12 Mar 2007 Posts: 94 Location: Ljubljana
|
Posted: Tue Aug 13, 2013 8:06 am Post subject: TFT with ILI9341 controller |
|
|
Hi!
I've just got a nice 240x320 2.8''TFT with ILI9341 controller. I tried to connect it on a SPI, using Display3000 'library', but no cuccess.
Does anyone has some hints about this controller?
ThanX!
Andrej
(BASCOM-AVR version : 2.0.7.6 ) |
|
Back to top |
|
|
bibibo
Joined: 30 Nov 2009 Posts: 168
|
Posted: Fri Aug 30, 2013 6:06 pm Post subject: |
|
|
Hi andro,
are you done ?
I ordered the same TFT LCD. |
|
Back to top |
|
|
Hkipnik
Joined: 03 May 2010 Posts: 20
|
Posted: Sat Aug 31, 2013 9:17 am Post subject: |
|
|
I work on it, but it will take some time |
|
Back to top |
|
|
Hkipnik
Joined: 03 May 2010 Posts: 20
|
Posted: Sun Sep 15, 2013 3:39 pm Post subject: |
|
|
Hello
here the Code for the Display ILI9341 SPI. |
|
Back to top |
|
|
Dibor
Joined: 04 Dec 2004 Posts: 137 Location: ISRAEL
|
Posted: Tue Oct 22, 2013 5:58 am Post subject: |
|
|
Hello.
Thank you for sharing code!!
GOOD work.
Somebody tried this code with software SPI ?
I use Atmega32 and software SPI and have problem with SPI speed.
Call Lcd_clear(black) takes 10 seconds.
I do not find any info about SPI clock in software mode.
Best Regards. |
|
Back to top |
|
|
Mrshilov
Joined: 24 Jan 2009 Posts: 314 Location: Russia
|
Posted: Tue Oct 22, 2013 11:15 am Post subject: |
|
|
Loop with Dword works too slow. This code will work faster:
Code: | '*******************************************************************************
' Clear Display
'*******************************************************************************
Sub Lcd_clear(byval Color As Word)
Local Hb As Byte , Lb As Byte , H As Byte , V As Byte
Hb = High(color)
Lb = Low(color)
#if Lcd_mode = 1
Call Lcd_set_window(0 , 0 , 239 , 319)
#else
Call Lcd_set_window(0 , 0 , 319 , 239)
#endif
Lcd_cs = 0
Lcd_dc = 1
For V = 1 To 240 '76800
For H = 1 To 160
Spiout Hb , 1
Spiout Lb , 1
Spiout Hb , 1
Spiout Lb , 1
Next H
Next V
Lcd_cs = 1
End Sub |
ILI9341 works up to 10MHz clock. Software mode SPI works very slow, why not use hardware in Atmega32?
Last edited by Mrshilov on Tue Oct 22, 2013 1:56 pm; edited 1 time in total |
|
Back to top |
|
|
Dibor
Joined: 04 Dec 2004 Posts: 137 Location: ISRAEL
|
Posted: Tue Oct 22, 2013 11:40 am Post subject: |
|
|
Thanks for answer.
I trying to update my old project with 1.8" TFT from Display3000.
All pin/ports is used and I do not want cut and re-solder traces.
I'll try my code on STK500 board with hard SPI, and if I'll not find another way I'll make changes in the PCB.
Now is software SPI works extremal SLOW, I think under 1MHz.
Regards. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Oct 22, 2013 11:50 am Post subject: |
|
|
just make sure you specify the MODE parameter. Then also specify the speed and setup delays but use a value of 0.
this will create fast spi without delays. but... it remains a software loop where 8 bits must be shifted. thus it is a delay already. Hardware would be best for this. _________________ Mark |
|
Back to top |
|
|
Dibor
Joined: 04 Dec 2004 Posts: 137 Location: ISRAEL
|
Posted: Tue Oct 22, 2013 12:40 pm Post subject: |
|
|
Hi Mark.
I tried without Mode option and with Mode=1 option without "Setup" and "Speed" options - result is same.
I'll try today evening with "Setup" and "Speed" options and values 0
Now in Config SPI i use only Dout and Clock pin settings, SS=none .(Only two pins available)
My question : If I"ll use hardware SPI all 4 pins will be affected ?
Regards. |
|
Back to top |
|
|
Dibor
Joined: 04 Dec 2004 Posts: 137 Location: ISRAEL
|
Posted: Tue Oct 22, 2013 5:12 pm Post subject: |
|
|
Hello.
$crystal = 6000000
Config Spi = Soft , Dout = Portc.3 , Ss = None , Clock = Portc.2 , Mode = 1 , Setup = 0 , Speed = 0
Clock freq. on Portc.2 - 400KHz !!!! too low
Compiled with version 2.0.7.7 |
|
Back to top |
|
|
Mrshilov
Joined: 24 Jan 2009 Posts: 314 Location: Russia
|
Posted: Tue Oct 22, 2013 5:24 pm Post subject: |
|
|
Try crystal 18...24MHz. |
|
Back to top |
|
|
Dibor
Joined: 04 Dec 2004 Posts: 137 Location: ISRAEL
|
Posted: Tue Oct 22, 2013 5:54 pm Post subject: |
|
|
Hi.
Mega32 is max 16MHz.
So SPI clock now 1.066MHz , 15 times lower from clock!
Regards. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Oct 22, 2013 9:09 pm Post subject: |
|
|
Indeed you need to use the highest clock speed possible.
By the options you use, the speed is now optimal (no inserted waits). But still the bits need to be shifted out in a loop which reduces the speed.
the only other thing :
instead of multiple calls you could do with less calls that transfer more bytes.
ie:
for x=1 to 100
spiout b,1
next
you can best do :
spiout b(1), 100 'send 100 bytes
i would have a look at HW SPI instead. _________________ Mark |
|
Back to top |
|
|
Andrei
Joined: 30 Apr 2004 Posts: 24 Location: Ekaterinsburg,Russia
|
Posted: Thu Oct 31, 2013 12:10 pm Post subject: |
|
|
I use BASCOM & KOMPANION grafic controller from http:\\www.schemov.com with 7'' 480x800 TFT for color grafic interface.It works good with SW & HW SPI, but it's not video. Video needs ARM Cortex M4 & SSD1963 & BASCOM-ARM, I think... |
|
Back to top |
|
|
andro
Joined: 12 Mar 2007 Posts: 94 Location: Ljubljana
|
Posted: Tue Nov 05, 2013 2:21 pm Post subject: |
|
|
He everyone!
It has been a while since I logged-in the last time...
In the meen time I also managed to bring to life my ILI9341 TFT with Xmega32a4.
Here a bit of code: (write command, data, 16it data)
Code: | Sub Write_cmd(byval Cmd As Byte)
Reset Cs
Reset Rs
Print #10 , Cmd , 1
Set Cs
End Sub
Sub Write_cmd_data(byval Cmdp As Byte)
Reset Cs
Set Rs
Print #10 , Cmdp , 1
Set Cs
End Sub
Sub Write_data_16(byval Data16 As Word)
Ar1(1) = High(data16)
Ar1(2) = Low(data16)
Reset Cs
Set Rs
Print #10 , Ar1(1) , 2
Set Cs
End Sub |
SPI config:
Code: | 'CONFIG SPI MASTER on Port c
Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk2 , Data_order = Msb , Ss = None
Open "SPIC" For Binary As #10 |
I keept SPI as fast as possible, and it works fine. Well, it's still slow but fast enough to use it in real applications.
BR
Andrej |
|
Back to top |
|
|
|