[SOLVED] SMT32F103C + ILI9486 TFT not working!

Working libraries, libraries being ported and related hardware
ericosowski
Posts: 7
Joined: Fri Oct 26, 2018 12:39 pm

[SOLVED] SMT32F103C + ILI9486 TFT not working!

Post by ericosowski » Sun Oct 28, 2018 4:41 pm

Hello guys,
I'm new with STM32 and I'm in trouble with a TFT 3.5" UNO SHIELD as show at the attached image, like another topics, the tft works fine with arduino + MCUFRIEND_kbv library, but with SMT32 blue pill doesn't work.
I read a couple of topics but none was solution for my case!
Also, I already made the test LCD_ID_Reader using the follow pins

Code: Select all

#define LCD_RST PB9
#define LCD_CS PB8
#define LCD_RS PB7
#define LCD_WR PB6
#define LCD_RD PB5
#define LCD_D0 PA0
#define LCD_D1 PA1
#define LCD_D2 PA2
#define LCD_D3 PA3
#define LCD_D4 PA4
#define LCD_D5 PA5
#define LCD_D6 PA6
#define LCD_D7 PA7
and the result was:

Code: Select all

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 54 80 66	Manufacturer ID
reg(0x0009) 00 00 61 00 00	Status Register
reg(0x000A) 00 08	Get Power Mode
reg(0x000C) 00 66	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 93 30 93 30	RD_DDB SSD1963
reg(0x00B0) 00 00	RGB Interface Signal Control
reg(0x00B4) 00 00	Inversion Control
reg(0x00B6) 00 02 02 3B 3B	Display Control
reg(0x00B7) 00 06	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	ILI9481, HX8357-B
reg(0x00C0) 00 0E 0E 0E 0E 0E 0E 0E 0E	Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA
reg(0x00CC) 00 04	Panel Control
reg(0x00D0) 00 00 00	Power Control
reg(0x00D2) 00 00 00 00 00	NVM Read
reg(0x00D3) 00 00 94 86	ILI9341, ILI9488
reg(0x00D4) 00 00 00 00	Novatek ID
reg(0x00DA) 00 54	RDID1
reg(0x00DB) 00 80	RDID2
reg(0x00DC) 00 66	RDID3
reg(0x00E0) 00 00 17 36 07 17 07 1F 17 17 03 17 07 17 17 07	GAMMA-P
reg(0x00E1) 00 07 13 17 0C 17 08 17 17 17 07 17 07 2D 17 01	GAMMA-N
reg(0x00EF) 00 80 00 10 60 40	ILI9327
reg(0x00F2) 00 18 A3 12 02 B2 12 FF 10 00 00 00	Adjust Control 2
reg(0x00F6) 00 54 80 66	Interface Control
I'ts ILI9486 and should works with MCUFRIEND_kbv, right?.
I don't know what I'm doing wrong, I suppose that the wiring is correct, but maybe I'm doing something wrong with testing code available at exemples, if someone could share a code for me to test if has some config that I missing!
Attachments
tft 3.5 arduino shield.jpg
tft 3.5 arduino shield.jpg (35.68 KiB) Viewed 933 times

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: SMT32F103C + ILI9486 TFT not working!

Post by stevestrong » Sun Oct 28, 2018 9:03 pm

@eric,
as reply to your introductory post you have been given a link.
Read carefully that link and please post some more information like:

which core?
which library have you tried?
Example code?
What exactly means "not working"?

Search the posts where David Prentice was involved, you should find a "special" made by him, you just have to adapt to your pinning for the solution.

ericosowski
Posts: 7
Joined: Fri Oct 26, 2018 12:39 pm

Re: SMT32F103C + ILI9486 TFT not working!

Post by ericosowski » Sun Oct 28, 2018 10:57 pm

Believe me, I read almost all topics about tft and David Prentice tips, but I didn't get to go any further with my lcd tft for arduino.
I'm trying to use the MCUFRIEND_kbv and Adafruit_TFTLCD_8bit_STM32 with no sucess.

When I sayed "not working" is because the tft only shows white screen even tryng to use the exemple UTFT_Demo_480x320 from MCUFRIEND_kbv, but the wiring is correct because it's reading the screen id when using the exemple LCD_ID_readreg from MCUFRIEND_kbvm wich is ILI9486.

Using arduino uno it works with MCUFRIEND_kbv library, but when I try with SMT32F103C8t6 is just white screen.
The example code is the same examples from MCVFRIEND_kbv library.

I don't have much experience with libraries, I felt that could be more explanations about the library, by comments in code for programers beginners start to make changes for yourself. When you depare with someone else code it's hard to realize what the code does!
A tutorial about MCUFRIEND_kbv or Adafruit_TFTLCD_8bit_STM32 is welcome too!

User avatar
mrburnette
Posts: 3001
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: SMT32F103C + ILI9486 TFT not working!

Post by mrburnette » Mon Oct 29, 2018 2:55 am

Have you read all pertinent posts:
https://www.google.com/search?&q=mcufri ... 2duino.com

These Arduino shields are 5 Volt, so David's post here is of note,

In the register listing in your post, I cannot find the string "9486" ... I do not have a compatible display, so I have never run the utility - meaning I do not know what the output should be for "compatible" devices.

Ray

flyboy74
Posts: 231
Joined: Wed Jun 13, 2018 11:02 am

Re: SMT32F103C + ILI9486 TFT not working!

Post by flyboy74 » Mon Oct 29, 2018 3:27 am

Not sure how much help this is going to be but here is some of my experiences with these parallel screens.

I have been using these screens on STM32F407 but it will be similar with the STM32103. I first got them to work by writing my own bit bang library but then I got the hardware peripheral FSMC to drive the screens. Once setup the FSMC is easier.

The screens them selves run of 3v but they have circuits on the PCB so they can be run from 5v as they r designed for Ardunio. What I did was remove the 3.3v LDO and short out Vin and Vout pads where the LDO used to be this then just connect 3.3v to everything instead of 5v.

Here is the project I am working on today with a ili9341 in 16 bit parallel using the ADC to read the touch see https://www.youtube.com/watch?v=STBH8Vw ... e=youtu.be

All my code just uses the macro's in header supplied from ST "stm32f4xx.h". I can make my code available if you want it but it is likely to need some mods to run a STM32F103

edit I have just looked closer at the blue pill specs and it doesn't have a hardware FSCM peripheral so it has to be bit banged in software

flyboy74
Posts: 231
Joined: Wed Jun 13, 2018 11:02 am

Re: SMT32F103C + ILI9486 TFT not working!

Post by flyboy74 » Mon Oct 29, 2018 3:47 am

If you want to sit down and create your own bit-bang code to drive your screen it isn't hard.

The screen will use a 8088 protocol. It works like this, u pull the CS pin low to talk to the screen(same as SPI) then you set the data pins to the data you want to sedn then you pulse the WR pin to get the screen to input the data you have set on the data lines. There is RS (sometimes called DC) pin that chooses whether the data is a command or data to be written to RAM.

To set the data 8 pins at once that are all on the same port and next to each other can be done by just writing the value to the ODR register for that port.

Here is the thread where I was working on a software bit bang viewtopic.php?f=3&t=3967&p=48025&hilit= ... 325#p48025

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: SMT32F103C + ILI9486 TFT not working!

Post by david.prentice » Mon Oct 29, 2018 7:47 am

You have done everything correctly in your Original Post.

I will post the appropriate SPECIAL for you after I have taken my dog for his walk.

You don't have to worry about coding anything yourself or level conversion. Just connect LCD_xxx signals to the Bluepill port pins and connect 3.3V, 5V, GND pins to the corresponding Bluepill power pins.

David.

Life is easier if you just use the "official hardware mod" Bluepill wiring e.g.

Code: Select all

#define LCD_RST PB9
#define LCD_CS PB8
#define LCD_RS PB7
#define LCD_WR PB6
#define LCD_RD PB0
From utility/mcufriend_shield.h

Code: Select all

//#define RD_PIN  5
#define RD_PIN  0  //hardware mod to Adapter.  Allows use of PB5 for SD Card
If you want to use PB5 just edit shield.h
It is not really worth involving SPECIALs

ericosowski
Posts: 7
Joined: Fri Oct 26, 2018 12:39 pm

Re: SMT32F103C + ILI9486 TFT not working!

Post by ericosowski » Tue Oct 30, 2018 3:04 am

flyboy74 wrote:
Mon Oct 29, 2018 3:47 am
If you want to sit down and create your own bit-bang code to drive your screen it isn't hard.

The screen will use a 8088 protocol. It works like this, u pull the CS pin low to talk to the screen(same as SPI) then you set the data pins to the data you want to sedn then you pulse the WR pin to get the screen to input the data you have set on the data lines. There is RS (sometimes called DC) pin that chooses whether the data is a command or data to be written to RAM.

To set the data 8 pins at once that are all on the same port and next to each other can be done by just writing the value to the ODR register for that port.

Here is the thread where I was working on a software bit bang viewtopic.php?f=3&t=3967&p=48025&hilit= ... 325#p48025
Thank you flyboy, I intend to go deeper into this subject, I have a 16bit parallel lcl tft 3.5" that I want to make it work, but not now! so your knowledge will be helpfull, but for now I'm needing a quickly solution for this 8bits parallel tft screen.
If you think I can learn something with your code Ill be glad with you share it!

Thank you for your reply and kindness to help!

ericosowski
Posts: 7
Joined: Fri Oct 26, 2018 12:39 pm

Re: SMT32F103C + ILI9486 TFT not working!

Post by ericosowski » Tue Oct 30, 2018 4:07 am

david.prentice wrote:
Mon Oct 29, 2018 7:47 am
You have done everything correctly in your Original Post.

I will post the appropriate SPECIAL for you after I have taken my dog for his walk.

You don't have to worry about coding anything yourself or level conversion. Just connect LCD_xxx signals to the Bluepill port pins and connect 3.3V, 5V, GND pins to the corresponding Bluepill power pins.

David.

Life is easier if you just use the "official hardware mod" Bluepill wiring e.g.

Code: Select all

#define LCD_RST PB9
#define LCD_CS PB8
#define LCD_RS PB7
#define LCD_WR PB6
#define LCD_RD PB0
From utility/mcufriend_shield.h

Code: Select all

//#define RD_PIN  5
#define RD_PIN  0  //hardware mod to Adapter.  Allows use of PB5 for SD Card
If you want to use PB5 just edit shield.h
It is not really worth involving SPECIALs
Hi David!
I've tried to use MCUFRIEND_kbv with those pins wiring config it just do nothing, only white screen.
I used A0~A7 for D0~D7 data pins, is that right? I tried in inverse order too, but no success.
What am I doing wrong with the code below? Using A0~A7 for D0~D7 data pins

Code: Select all

#include 
MCUFRIEND_kbv tft;
#define LCD_RST PB9
#define LCD_CS PB8
#define LCD_RS PB7
#define LCD_WR PB6
#define LCD_RD PB5
#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
void setup() {
   Serial.begin(9600);
    uint32_t when = millis();
    if (!Serial) delay(2000);          
    Serial.println("Serial took " + String((millis() - when)) + "ms to start");   
    uint16_t ID = tft.readID(); //
    Serial.print("ID = 0x");
    Serial.println(ID, HEX);    
    tft.begin(0x9486); 
}
void loop() {
   tft.fillScreen(BLACK);
   delay(1000);
    tft.fillScreen(RED);
   delay(1000);
    tft.fillScreen(GREEN);
   delay(1000);
    tft.fillScreen(BLUE);
   delay(1000);
    tft.fillScreen(BLACK);
   delay(1000);
}
Must I change something in utility folder?
What is the default wiring?
How could I get it working with the wiring below?

Code: Select all

LCD_D0 – PA0
LCD_D1 – PA1
LCD_D2 – PA2
LCD_D3 – PA3
LCD_D4 – PA4
LCD_D5 – PA5
LCD_D6 – PA6
LCD_D7 – PA7
LCD_RST – PB9
LCD_CS – PB8
LCD_RS – PB7
LCD_WR – PB6
LCD_RD – PB5
If you write some example of sketch and how to change the library it will help alot! I think that wiring could be easier to be done if it was defined at header of the code, Am I wrong?

Thank you David!

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: SMT32F103C + ILI9486 TFT not working!

Post by david.prentice » Tue Oct 30, 2018 6:55 am

Wire LCD_RD pin to PB0 on the BluePill
Edit the LCD_RD define for PB0 in LCD_ID_readreg sketch.

Run the sketch. You should see reg(0xd3) as xx 94 86 xx to confirm that your wires are all ok.

Then run any library examples. They should all work.

If you have altered anything, it is probably wise to start again.
i.e. leave IDE. Delete library directory. Start IDE. Re-install via the Library Manager.

David.

If you really want to use PB5 (it stops you using the microSD) edit the shield.h file
This means deleting the two slashes on the PB5 line and inserting two slashes on the PB0 line.

Post Reply