Spark Logic

8-bit|16-bit parallell ILI9341

andreas_ferm

Good day everyone, I’m all new to stm32 and have previously only done smaller projects on arduiono boards, mostly using already-finished libraries.

Now I reached a point where my programmings skills lack, so instead of optimizing my code i started to look at maple mini and thought it would be excellent to also add a “nice” GUI to my project.

I ended up ordering a chinese 3.2″ tft+touch+sd card combo, but what i didn’t know or think of beforehand was to check the connectivity needed (i just read here and saw all the included libraries for the aforementioned display controller), but all of them are using SPI. So the display came in the mail and i became aware that it didn’t have any SPI interface, (at least not for the display, only for the touch and sd card)

Are there any working options that is available to use with stm32duino? What would be my best chance of getting this to work? (i was initially thinking about going for a MEGA, but choose the maple mini clone as i was impressed with the various tft demos i’ve seen )

I’ve tried looking through “all” of the internet, but have only found small pointers, and none of the really targeted for stm32duino. (i found one post where someone had posted an utft version with support for stm32, which was based on some teensy port, but it was also done for SPI only, and i couldn’t find any ILI9341 tft ‘drivers’ for parallel communication… well there was one for an ILI9481 but i’m not sure if that can be used in direct replacement.

Anyone has a similar display and has it working with a maple mini?

Thanks!
Andreas

Replies18

stevestrong Sun Oct 29, 2017 8:05 am

Currently my 16 bit display is connected to the black F4 board.
I have to find some time to connect it to BP and find out what is going wrong there.

WacKEDmaN Mon Dec 18, 2017 2:11 pm

Ive been having some trouble getting my TFT LCD uno shield to work with the blue pill, it works fine on uno using mcufriend_kbv lib
it reports as an ILI9431 on the uno, it uses 8 data pins and 4 control lines + RST, but when connecting to the blue pill the screen remains white and serial outputs as it should
i have tried the standard library pinout connection (removed boot1 jumper and attached D2 to the centre pin)
Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
Pin stm32 |PB7|PB6|PB5|PB4|PB3|PB2|PB1|PB0|
Control pins |RD |WR |RS |CS |RST|
Pin stm32 |PA4|PA5|PA6|PA7|PA8|

stevestrong Mon Dec 18, 2017 2:19 pm

If you use my lib, then you have to have all consecutive data pins in order from 0 to 7 (low nibble) or 8 to 15 (high nibble).
I will double check my setup at home in a couple of hours.

WacKEDmaN Mon Dec 18, 2017 2:42 pm

[stevestrong – Mon Dec 18, 2017 2:19 pm] –
If you use my lib, then you have to have all consecutive data pins in order from 0 to 7 (low nibble) or 8 to 15 (high nibble).
I will double check my setup at home in a couple of hours.

thanks steve, i thought that might be the case. i guess i didnt change the lib pinout, as i was only changing the #if 0 // slow write case..

should i be using #define USE_ADAFRUIT_SHIELD_PINOUT 1 ? edit: tried commented and uncommented, same results..

stevestrong Mon Dec 18, 2017 8:42 pm

I just built and uploaded my lib again on my ILI9328 tft and it works.
So now I suggest to test this LCD_ID test example from David to prove that the connections are ok.
And post here the serial monitor output.

WacKEDmaN Mon Dec 18, 2017 9:58 pm

lcd_id changes
#define LCD_RST PA4
#define LCD_CS PA3
#define LCD_RS PA2
#define LCD_WR PA1
#define LCD_RD PA0

#define LCD_D0 PB0
#define LCD_D1 PB1
#define LCD_D2 PB2
#define LCD_D3 PB3
#define LCD_D4 PB4
#define LCD_D5 PB5
#define LCD_D6 PB6
#define LCD_D7 PB7

stevestrong Mon Dec 18, 2017 10:03 pm

Serial is fine, your wiring is wrong.

Or your board has a failure.

Or PB2 does not work, you have to shorten the R4 resistor.

WacKEDmaN Mon Dec 18, 2017 10:18 pm

just redid the wiring and now im getting this response..

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 00 00 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 13 13 13 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 44 Inversion Control
reg(0x00B6) 00 02 82 27 04 Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 06 06 06 06 06 ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 03 03 NVM Read
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 10 10 10 10 10 ILI9327
reg(0x00F2) 00 02 02 02 02 02 02 02 02 02 02 02 Adjust Control 2
reg(0x00F6) 00 01 00 00 Interface Control

stevestrong Mon Dec 18, 2017 10:38 pm

It looks ok for me now, it is 9341.

WacKEDmaN Mon Dec 18, 2017 10:45 pm

ok thats good to know..
ive just downloaded your latest version of the lib
changed #define TFT_RST PB10 to PA4 to match my wiring..
still get white screen only :(

stevestrong Mon Dec 18, 2017 11:25 pm

Which id do get in the serial monitor?

WacKEDmaN Mon Dec 18, 2017 11:51 pm

defaulted the library and my wiring back to original pins..(rst on PB10)
graphicstest serial output: (but still with white screen only)

TFT size is 240x320
Found ILI9341 LCD driver
TFT begin done.
rotation: 0, runtime: 22047
rotation: 1, runtime: 22046
rotation: 2, runtime: 22046
rotation: 3, runtime: 22046

Benchmark Time (microseconds)
Screen fill 65196
Text 22046
Lines 177382
Horiz/Vert Lines 7988
Rectangles (outline) 6260
Rectangles (filled) 151869
Circles (filled) 97002
Circles (outline) 76594
Triangles (outline) 56363
Triangles (filled) 95581
Rounded rects (outline) 28134
Rounded rects (filled) 192794
Done!

stevestrong Tue Dec 19, 2017 8:24 am

The issue is that I don’t have any 8 bit parallel ILI9341 LCD, my one is ili9328 and it works.
But i have an 9341 compatible 16 bit LCD, I will check whether the register init sequence is ok.

WacKEDmaN Tue Dec 19, 2017 10:17 am

understand Steve…i appreciate your efforts!

edit: finally got around to removing and jumpering the R4 resistor thinking it would help…but it hasnt made any difference
im just gonna go buy a SPI TFT LCD..

stevestrong Sat Dec 23, 2017 3:45 pm

I just checked my 16 bit parallel lib on the blue pill with an ILI9341 compatible 320×480 TFT LCD, and it works as expected.
Benchmark Time (microseconds)
Screen fill 54843
Text 23228
Lines 423008
Horiz/Vert Lines 6840
Rectangles (outline) 5712
Rectangles (filled) 134003
Circles (filled) 187443
Circles (outline) 177951
Triangles (outline) 118043
Triangles (filled) 122780
Rounded rects (outline) 53757
Rounded rects (filled) 192710

WacKEDmaN Sat Dec 30, 2017 2:38 am

i tried your suggestions but still cant get anything on the screen..
ive been using the default pinouts, just to get it working, triple checked the wiring, and even continuity tested each pin, but no luck getting anything onscreen…forcing #if 1 does run slower (the serial output) but still no onscreen output :(

its a strange LCD, the only lib i can make it work with on arduino is the MCUFRIEND_kbv library, the adafruit libs dont work as expected..

im just gonna buy a SPI LCD for the bluepill and keep this shield for the uno (its slower on mega than uno!)

edit: got it working on the bluepill with the latest MCUFRIEND lib :)

RikV Mon Oct 29, 2018 8:50 pm

This post does not completely fit in this thread but the outcome is here.
I have Aduino IDE 1.8.5 installed in C:…\arduino. There is a subdir \libraries where I put all my libs. But I also see a \lib dir under Users\..
How are the two related to each other? Which Lib is used by the IDE if two exist during compilation?
So far I made some small projects with ProMini and nano to get the feel of it. No problems installing or using any lib. Recently I started using a BluePil.
Also no problems for the simple examples. But. I am planning a more complicated project using TFT with touch screen. This works on DUE and reports to be ILI9341 although the supplier says it is a UC8230s ?
I will also need SPI and I2C comm, so the IO for the TFT must be chosen with care.
I found the necessary libs for the bluePill but I cannot get the examples (graphictest)compiled?? It cannot find the very basic gpio.h and things like that (compile error on #include <libmaple/gpio.h>. Where are those supposed to be? I have put them in different locations but the problem remains.
I have the “Generic STMF103 series” and Board part number “Blue Pill F103C8” selected.
I believe my IDE configuration for STM32F103C8 is totally wrong. How do I install it correctly?

This is how the compiler thinks about it:
Arduino: 1.8.5 (Windows 8.1), Board:"Generic STM32F103 series, BluePill F103C8, 64k (default), STLink, Enabled with generic Serial, Smallest (-Os default)"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Rik\AppData\Local\Arduino15\packages -hardware C:\Users\Rik\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Rik\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Rik\Documents\Arduino\libraries -fqbn=STM32:stm32:GenF103:pnum=BLUEPILL_F103C8,flash=C8,upload_method=STLinkMethod,xserial=generic,opt=osstd -ide-version=10805 -build-path C:\Users\Rik\AppData\Local\Temp\arduino_build_586420 -warnings=default -build-cache C:\Users\Rik\AppData\Local\Temp\arduino_cache_32617 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.STM32Tools.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.CMSIS.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -verbose D:\Jdown\_Arduino\__Schetsen\graphicstest\graphicstest.ino

Kan boards.txt niet vinden in C:\Users\Rik\Documents\Arduino\hardware\Arduino-STM32F1-corelibs\variants. Is het van voor versie 1.5?
WARNING: Error loading hardware folder C:\Users\Rik\Documents\Arduino\hardware\Arduino-STM32F1-corelibs
Geen geldige hardware-definities gevonden in map Arduino-STM32F1-corelibs.

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Rik\AppData\Local\Arduino15\packages -hardware C:\Users\Rik\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Rik\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Rik\Documents\Arduino\libraries -fqbn=STM32:stm32:GenF103:pnum=BLUEPILL_F103C8,flash=C8,upload_method=STLinkMethod,xserial=generic,opt=osstd -ide-version=10805 -build-path C:\Users\Rik\AppData\Local\Temp\arduino_build_586420 -warnings=default -build-cache C:\Users\Rik\AppData\Local\Temp\arduino_cache_32617 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.CMSIS.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.3.0 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update -prefs=runtime.tools.STM32Tools.path=C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.1.0 -verbose D:\Jdown\_Arduino\__Schetsen\graphicstest\graphicstest.ino
Using board 'GenF103' from platform in folder: C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.3.0
Using core 'arduino' from platform in folder: C:\Users\Rik\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.3.0
cmd /c if not exist "D:\Jdown\_Arduino\__Schetsen\graphicstest/build_opt.h" mkdir "C:\Users\Rik\AppData\Local\Temp\arduino_build_586420\sketch" & type NUL > "C:\Users\Rik\AppData\Local\Temp\arduino_build_586420/sketch/build_opt.h"
Detecting libraries used...

stevestrong Wed Nov 07, 2018 8:40 am

Which core do u use? This lib should work only on libmaple core.

Post a reply