STM32F103C8 & TFT (ili9325)

Working libraries, libraries being ported and related hardware
golpesar132
Posts: 23
Joined: Mon Jul 10, 2017 1:42 pm

Re: STM32F103C8 & TFT (ili9325)

Post by golpesar132 » Mon Jul 10, 2017 10:31 pm

I check it all. All wires and pins are Ok. What can be problem now?? It replies same...
Just one thing has value...

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

Re: STM32F103C8 & TFT (ili9325)

Post by stevestrong » Tue Jul 11, 2017 8:48 am

Can you post a link to the LCD, where did you buy from?
Pay attention to the power supplies, Arduino boards use 5V, the STM boards are mostly using 3.3V.
Can you post a picture of your hardware setup, including the wires?

golpesar132
Posts: 23
Joined: Mon Jul 10, 2017 1:42 pm

Re: STM32F103C8 & TFT (ili9325)

Post by golpesar132 » Tue Jul 11, 2017 10:30 am

I bought it from this link:
http://shop.aftabrayaneh.com/LCD_Monito ... AFTAB.html

this is my hardware :
Image
Image

I uploaded the code on arduino uno and I got this:

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) 93 25	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 00 00 00	RD_DDB SSD1963
reg(0x00B0) 00 00	RGB Interface Signal Control
reg(0x00B4) 00 00	Inversion Control
reg(0x00B6) 00 00 00 00 00	Display Control
reg(0x00B7) 00 00	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	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 00 00	NVM Read
reg(0x00D3) 00 00 00 00	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) 12 31 12 31 12 31	ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00	Adjust Control 2
reg(0x00F6) 00 00 00 00	Interface Control

VadimEL
Posts: 66
Joined: Sat Aug 13, 2016 1:28 pm

Re: STM32F103C8 & TFT (ili9325)

Post by VadimEL » Tue Jul 11, 2017 11:57 am

David. :mrgreen: :mrgreen: :mrgreen:
I am happy, i found error in your code =)

Image
Image

After change this
#define WR_STROBE { WR_ACTIVE; WR_IDLE; }
to
#define WR_STROBE { WR_ACTIVE; delay_us(1); WR_IDLE; } //PWLW=TWRL=50ns
72Mhz with tft - work well. :mrgreen: :mrgreen: :mrgreen: :mrgreen:

Image

==========================
now it's STM32 and touch screen panel issue. Then i use iwalpola lib touch work....

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

Re: STM32F103C8 & TFT (ili9325)

Post by stevestrong » Tue Jul 11, 2017 1:20 pm

golpesar132 wrote:
Tue Jul 11, 2017 10:30 am
I bought it from this link:
http://shop.aftabrayaneh.com/LCD_Monito ... AFTAB.html
I think you forgot to shortcut the R4 which is connected between STM32 and the BOOT1 jumper.
This resistor is 100Kohm so that the PB2 output will not work unless you solder a bridge over this resistor (shortcut).
Please check.

Btw, as initial test, you could enable slow toggling of the control pins by enabling this line (change to "#if 1"): https://github.com/stevstrong/Adafruit_ ... TM32.h#L75
If this works then you can go with the high speed version, with "#if 0".

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

Re: STM32F103C8 & TFT (ili9325)

Post by david.prentice » Tue Jul 11, 2017 3:25 pm

VadimEL wrote:
Tue Jul 11, 2017 11:57 am
David. :mrgreen: :mrgreen: :mrgreen:
I am happy, i found error in your code =)

Image
Image

After change this
#define WR_STROBE { WR_ACTIVE; WR_IDLE; }
to
#define WR_STROBE { WR_ACTIVE; delay_us(1); WR_IDLE; } //PWLW=TWRL=50ns
72Mhz with tft - work well. :mrgreen: :mrgreen: :mrgreen: :mrgreen:

Image

==========================
now it's STM32 and touch screen panel issue. Then i use iwalpola lib touch work....
@Vadim,

You are sampling at 2MHz. Your Saleae can only distinguish 500ns. Even then, it is always safer to sample several times in a pulse.
The whole Write Cycle must be longer than 50ns. You would need to sample at 100MHz or so.
The STM32F103 is not very fast at GPIO driving. The STM32F4xx and even STM32L4xx are much faster.

I have never attempted to use a Saleae on a parallel interface. It is not fast enough.
However, I do use the Saleae on an SPI interface. I just have to slow the SCK down to 8MHz and 24MHz sampling is ok.

I have run STM32F103 on IteadMaple, Nucleo-F103, and two BluePills. One of the BluePills has its data bus on PA0-PA7. And the Write Cycle is as short as the STM32F103 can possibly make it.

If you need to slow things down, you edit the appropriate driver in mcufriend_shield.h or mcufriend_special.h e.g.

Code: Select all

#if defined(__STM32F1__) || defined(STM32F103xB)
#define WRITE_DELAY { WR_ACTIVE; WR_ACTIVE; }     //add sufficient macros.
#define READ_DELAY  { RD_ACTIVE; }            //likewise.   read is always much slower
Incidentally, I have a ST7789V which is considerably slower than the datasheet suggests.
Ah-ha. You have an ILI9325. I will see how that goes on my BluePill.

David.

VadimEL
Posts: 66
Joined: Sat Aug 13, 2016 1:28 pm

Re: STM32F103C8 & TFT (ili9325)

Post by VadimEL » Tue Jul 11, 2017 3:50 pm

I use delay(25) between command+data in init_table16 to understand what is the problem.

Code: Select all

static void init_table16(const void *table, int16_t size)
{
    uint16_t *p = (uint16_t *) table;
	
	//в цикле пробегаем весь массив ILI9325_regValues[,]  и отправляем поочереди то комманду то данные
    while (size > 0) 
	{
        uint16_t cmd = pgm_read_word(p++);//считать комманду
        uint16_t d = pgm_read_word(p++);//считать данные
        
		//если ожидание
		if (cmd == TFTLCD_DELAY)
		    {
            delay(d);
			}
        else 
		{
			//delay(1);
            CS_ACTIVE; // #define CS_ACTIVE  PIN_LOW(CS_PORT, CS_PIN)         LCD_CS на 0
			//delay(1);
            WriteCmd(cmd);  //#define WriteCmd(x)  { CD_COMMAND;  write16(x); } //   #define CD_COMMAND PIN_LOW(CD_PORT, CD_PIN) == LCD_RS на 0
			
			//delay(1);
			
            WriteData(d);  // #define WriteData(x) { CD_DATA; write16(x); }         #define CD_DATA    PIN_HIGH(CD_PORT, CD_PIN) == LCD_RS на 1
			//delay(1);
            CS_IDLE; //CS_IDLE; //1 #define CS_IDLE    PIN_HIGH(CS_PORT, CS_PIN)   ==  LCD_CS на 1
			//delay(1);
			
			//пауза между (коммандами+данными), чтоб было видно для наглядности
			delay(25);
        }
        size -= 2 * sizeof(int16_t);
    }
}
the is no wr_strobe in 72Mhz CPU. #define WR_STROBE { WR_ACTIVE; delay_us(1); WR_IDLE; } fix the problem, and dispay work.
--------------------------------
How to make touch screen work ? any suggestions? did your lib do not support touch at all on STM32 ? or some shields support?

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

Re: STM32F103C8 & TFT (ili9325)

Post by david.prentice » Tue Jul 11, 2017 4:24 pm

My ILI9325 works fine on MY_BLUEPILL. The Adafruit Tests take 2.24 seconds @ 72MHz
My ILI9325 works fine on BLUEPILL. The Adafruit Tests take 1.39 seconds @ 72MHz
I can do the same Tests in 0.85 seconds on an overclocked Xmega. (the Xmega has got excellent PORT writes)

You appear to have introduced the delays in the tft.begin() call.

The three critical timing areas
1. drawing circles. tft.drawPixel()
2. drawing horiz and vert lines. tft.fillRect()
3. Software Scroll. tft.readGRAM()

David.

golpesar132
Posts: 23
Joined: Mon Jul 10, 2017 1:42 pm

Re: STM32F103C8 & TFT (ili9325)

Post by golpesar132 » Tue Jul 11, 2017 4:27 pm

stevestrong wrote:
Tue Jul 11, 2017 1:20 pm
golpesar132 wrote:
Tue Jul 11, 2017 10:30 am
I bought it from this link:
http://shop.aftabrayaneh.com/LCD_Monito ... AFTAB.html
I think you forgot to shortcut the R4 which is connected between STM32 and the BOOT1 jumper.
This resistor is 100Kohm so that the PB2 output will not work unless you solder a bridge over this resistor (shortcut).
Please check.

Btw, as initial test, you could enable slow toggling of the control pins by enabling this line (change to "#if 1"): https://github.com/stevstrong/Adafruit_ ... TM32.h#L75
If this works then you can go with the high speed version, with "#if 0".
I was unsoldered the R4 and made it short circuit.
I changed that line but it dind'nt work again. my STM32 board can has problem??

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

Re: STM32F103C8 & TFT (ili9325)

Post by stevestrong » Tue Jul 11, 2017 5:54 pm

I would start to test each pin, whether it toggles or not.
Use a LED and connect it to each data and control pin, one after the other.
Make a short test program to toggle these pins.

Post Reply