nopnop2002 / Arduino-STM32-8bitTFT

8bit parallel TFT Library for Arduino_Core_STM32
Apache License 2.0
15 stars 10 forks source link

Doesn't work on stm32f401ccu6 #8

Closed brightproject closed 1 year ago

brightproject commented 1 year ago

Code in example doesn't work on stm32f401ccu6 v3.0 + display ILI9486 with core from ST

After the code LCD_ID_Reader.ino is executed, i.e. the pins are connected correctly, the ID is readable.

reg(0x00D3) 00 00 94 86.ILI9341, ILI9488

I connected black pill to display as below:

TFT |   | STM32 -- | -- | -- LCD_RD | -- | PB0(*1) LCD_WR | -- | PB1(*1) LCD_RS | -- | PB5(*1) LCD_CS | -- | PB6(*1) LCD_RST | -- | PB7(*1) LCD_D0 | -- | PA0(*2) LCD_D1 | -- | PA1(*2) LCD_D2 | -- | PA2(*2) LCD_D3 | -- | PA3(*2) LCD_D4 | -- | PA4(*2) LCD_D5 | -- | PA5(*2) LCD_D6 | -- | PA6(*2) LCD_D7 | -- | PA7(*2)

And change code in Arduino-STM32-8bitTFT.h

#define TFT_RD         LL_GPIO_PIN_0 // Px0
#define TFT_WR         LL_GPIO_PIN_1 // Px1
#define TFT_RS         LL_GPIO_PIN_5 // Px5
#define TFT_CS         LL_GPIO_PIN_6 // Px6
#define TFT_RST        LL_GPIO_PIN_7 // Px7

White screen. white_stm_8_bit I connected black pill to display as below:

TFT |   | STM32 -- | -- | -- LCD_RD | -- | PB3(*1) LCD_WR | -- | PB4(*1) LCD_RS | -- | PB5(*1) LCD_CS | -- | PB6(*1) LCD_RST | -- | PB7(*1) LCD_D0 | -- | PA0(*2) LCD_D1 | -- | PA1(*2) LCD_D2 | -- | PA2(*2) LCD_D3 | -- | PA3(*2) LCD_D4 | -- | PA4(*2) LCD_D5 | -- | PA5(*2) LCD_D6 | -- | PA6(*2) LCD_D7 | -- | PA7(*2)

And change code in Arduino-STM32-8bitTFT.h

#define TFT_RD         LL_GPIO_PIN_3 // Px3
#define TFT_WR         LL_GPIO_PIN_4 // Px4
#define TFT_RS         LL_GPIO_PIN_5 // Px5
#define TFT_CS         LL_GPIO_PIN_6 // Px6
#define TFT_RST        LL_GPIO_PIN_7 // Px7

Screen white also... Same hardware work good with TFT_eSPI and pins as below:

// common "MCUfriend" shields
#define TFT_CS   PB8  // Chip select control pin
#define TFT_DC   PB7  // Data Command control pin
#define TFT_RST  PB9  // Reset pin

#define TFT_WR   PB6  // Write strobe control pin 
#define TFT_RD   PB0  // Read pin

#define TFT_D0   PA0  // 8 bit parallel bus to TFT
#define TFT_D1   PA1
#define TFT_D2   PA2
#define TFT_D3   PA3
#define TFT_D4   PA4
#define TFT_D5   PA5
#define TFT_D6   PA6
#define TFT_D7   PA7

work_eTFT_sPI I changed in the library TFT_eSPI pins as for the library and everything worked.

#define TFT_RD   PB0  // Read pin
#define TFT_WR   PB1  // Write strobe control pin 
#define TFT_DC   PB5  // RS/CD - Data Command control pin
#define TFT_CS   PB6  // Chip select control pin
#define TFT_RST  PB7  // Reset pin

#define TFT_D0   PA0  // 8 bit parallel bus to TFT
#define TFT_D1   PA1
#define TFT_D2   PA2
#define TFT_D3   PA3
#define TFT_D4   PA4
#define TFT_D5   PA5
#define TFT_D6   PA6
#define TFT_D7   PA7

pins_as_stm32_8bit

When I changed the pins in various options for the library Arduino-STM32-8bitTFT nothing worked and the screen was still white. You write that the library works with ILI9486, but I did not find initialization in the code, for ILI9481 only: case 0x9481: //ILI9481

nopnop2002 commented 1 year ago

how does this look?

https://github.com/nopnop2002/Arduino-STM32-8bitTFT/blob/master/examples/GraphicsTest_240x320_SMT32/GraphicsTest_240x320_SMT32.ino#L35

brightproject commented 1 year ago

Sorry, I temporarily disassembled my display ILI9486 from board black pill. To install it as a replacement P023T009-V2. photo1685977983 Which has an even more exotic driver ILI9342C and this display did not work even with the library TFT_eSPI

how does this look?

What should be? None of your examples work for me. Compilation without errors, but the display is white. I've tried all possible pin connections. You have a different display in the description, probably from adafruit. I have a Chinese display and probably there is a different initialization ILI9486.

nopnop2002 commented 1 year ago

I want to see your serial logging.

  ID = tft.readID();
  Serial.print("Device ID: 0x"); Serial.println(ID, HEX);
  tft.begin(ID);
brightproject commented 1 year ago

I want to see your serial logging.

reg(0x00D3) 00 00 94 86.ILI9341, ILI9488

All pins connected correctly, I think about wrong initialisation ILI9486. Bodmer in his library have 5 or 6 different init for original display and chineeses.

nopnop2002 commented 1 year ago

reg(0x00D3) 00 00 94 86.ILI9341, ILI9488

No I want to see this output when you execute my example.

ID = tft.readID();
Serial.print("Device ID: 0x"); Serial.println(ID, HEX);
brightproject commented 1 year ago

want to see this output when you execute my example. Command pins connected as below:

#define TFT_RD         LL_GPIO_PIN_0 // Px0
#define TFT_WR         LL_GPIO_PIN_1 // Px1
#define TFT_RS         LL_GPIO_PIN_5 // Px5
#define TFT_CS         LL_GPIO_PIN_6 // Px6
#define TFT_RST        LL_GPIO_PIN_7 // Px7

Results of GraphicsTest_240x320_SMT32.ino

Arduino-STM32-8bitTFT
readReg16(0)=0x0
readReg32(A1)=0x3093
readReg40(BF)=0x9393
readReg32(D4)=0x9393
readReg40(EF)=0x1060
readReg32(FE)=0x0
readReg32(04)=0x548066
readReg32(D3)=0x9486
Device ID: 0x9486
Width: 240
Height: 320
Benchmark                Time (microseconds)
Screen fill              1209193
Text                     86326
Lines                    535166
Horiz/Vert Lines         106660
Rectangles (outline)     73945
Rectangles (filled)      2585651
Circles (filled)         552096
Circles (outline)        235297
Triangles (outline)      123628
Triangles (filled)       999230
Rounded rects (outline)  126457
Rounded rects (filled)   2629687
Done!

Display still white... photo1685979890

nopnop2002 commented 1 year ago

Device ID: 0x9486

Added this. Try latest.

brightproject commented 1 year ago

Try latest.

Yes, now the code works successfully with the driver ILI9486 and display 320x480 Results of test

Arduino-STM32-8bitTFT
readReg16(0)=0x8686
readReg32(A1)=0x3093
readReg40(BF)=0x9393
readReg32(D4)=0x9393
readReg40(EF)=0x1060
readReg32(FE)=0x0
readReg32(04)=0x548066
readReg32(D3)=0x9486
Device ID: 0x9486
Width: 320
Height: 480
Benchmark                Time (microseconds)
Screen fill              2417511
Text                     69593
Lines                    1358380
Horiz/Vert Lines         198417
Rectangles (outline)     111580
Rectangles (filled)      6066739
Circles (filled)         623537
Circles (outline)        584120
Triangles (outline)      268053
Triangles (filled)       1886754
Rounded rects (outline)  242945
Rounded rects (filled)   5988580
Done!

photo1686259688 (1) I connected the reset to 3.3 volts, and wrote -1 in the code.

#define TFT_RD         LL_GPIO_PIN_0 // PB0
#define TFT_WR         LL_GPIO_PIN_1 // PB1
#define TFT_RS         LL_GPIO_PIN_5 // PB5
#define TFT_CS         LL_GPIO_PIN_6 // PB6
#define TFT_RST        -1 // PB7

Released the pin I needed for the encoder. True with the scroll example - when rotating, not all areas of the screen are cleared before displaying a new image. photo1686259688

Maybe this is due to the fact that I made the reset hardwired? It seemed to me that in the library TFT_eSPI examples work faster. Your library is reassigning the pins for the black pill, perhaps because of this there is a delay in displaying the image on the display?

nopnop2002 commented 1 year ago

Maybe this is due to the fact that I made the reset hardwired?

Maybe.

brightproject commented 1 year ago

Maybe.

I always solder reset on plus power and never had a problem.

nopnop2002 commented 1 year ago

For 320x480 use this.

https://github.com/nopnop2002/Arduino-STM32-8bitTFT/tree/master/examples/GraphicsTest_320x480_SMT32

It need this.

https://github.com/nopnop2002/Arduino-STM32-8bitTFT/blob/master/examples/GraphicsTest_320x480_SMT32/GraphicsTest_320x480_SMT32.ino#LL35C2-L35C54

brightproject commented 1 year ago

For 320x480 use this.

https://github.com/nopnop2002/Arduino-STM32-8bitTFT/tree/master/examples/GraphicsTest_320x480_SMT32

Yes, I'll try it.

brightproject commented 1 year ago

Your library works, but for comparison, the example https://github.com/nopnop2002/Arduino-STM32-8bitTFT/blob/master/examples/TFT_Meters_STM32/TFT_Meters_STM32.ino is noticeably slower than the example from the library https://github.com/Bodmer/TFT_eSPI/blob/master/examples/480%20x%20320/TFT_Meter_4/TFT_Meter_4.ino

I use the same pins for connection in both libraries. Apparently your library otherwise transfers IO registers to pins for the "black pill".

#define TFT_CS   PB6  // Chip select control pin
#define TFT_DC   PB5  // RS/CD - Data Command control pin
#define TFT_RST  -1  // Reset pin

#define TFT_WR   PB1  // Write strobe control pin 
#define TFT_RD   PB0  // Read pin

#define TFT_D0   PA0  // 8 bit parallel bus to TFT
#define TFT_D1   PA1
#define TFT_D2   PA2
#define TFT_D3   PA3
#define TFT_D4   PA4
#define TFT_D5   PA5
#define TFT_D6   PA6
#define TFT_D7   PA7
nopnop2002 commented 1 year ago

Apparently your library otherwise transfers IO registers to pins for the "black pill".

No. I use LL_GPIO library.

Bodmer's library supports STM32F1/F2/F4/F7.

My library supports almost all STM32, including G-series, L-series, H-series, U-series, W-series. STM32F0/F1/F2/F3/F4/F7/G0/G4/H5/H7/L0/L1/L4/L5/U5/WB/WL. H5 and H7 are extremely powerful. H7 boards are available for $20.

brightproject commented 1 year ago

How can I increase the display speed on a display with a parallel 8-bit connection from the stm32f401 chip?

nopnop2002 commented 1 year ago

If you incorporate the same code as Bodmer, it will be faster, but it will be dedicated to F401.

It's not difficult, so please try it.

https://github.com/Bodmer/TFT_eSPI/blob/master/Processors/TFT_eSPI_STM32.c https://github.com/Bodmer/TFT_eSPI/blob/master/Processors/TFT_eSPI_STM32.h

brightproject commented 1 year ago

It's not difficult, so please try it.

Didn't quite get it - connect Bodmer's code to your examples?

nopnop2002 commented 1 year ago

connect Bodmer's code to your examples?

No

Our library works on all STM32

We do not support specific hardware.

We don't put code that depends on specific hardware.

This is Open source project.

You can add features according to your taste.