nopnop2002 / STM32_TFT_8bit

STM32F103 8bit parallel TFT Library for Arduino_STM32
60 stars 17 forks source link

How use on stm32f401ccu6 #13

Closed brightproject closed 1 year ago

brightproject commented 1 year ago

How to use the library with kernel Arduino_Core_STM32 with stm32f401ccu6? I have white dipslay. https://github.com/Bodmer/TFT_eSPI/issues/2682

nopnop2002 commented 1 year ago

for Arduino_Core_STM32

https://github.com/nopnop2002/Arduino-STM32-8bitTFT

77814907-ce167500-70f8-11ea-8952-d6d1c1cc8801

brightproject commented 1 year ago

Can I change the pins as in the originally mcu_friends?

#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

Can you please tell me how to initialize the display with the driver ILIL9342C?

nopnop2002 commented 1 year ago

It supports ili9342.

https://github.com/nopnop2002/STM32_TFT_8bit/blob/master/STM32_TFT_8bit.cpp#L640

i don't know ili9342c

brightproject commented 1 year ago

ili9342 supports it.

How set to ILIL9342? Library do it automatically? I use ili9342c in P023T009-V2 display 2 31_P023T009_cut But I cannot initialize correctly in any way. photo1685696835 (1)

nopnop2002 commented 1 year ago

Library do it automatically?

Yes. The driver is automatically determined here. It will works if you change here.

https://github.com/nopnop2002/STM32_TFT_8bit/blob/master/STM32_TFT_8bit.cpp#L1588

brightproject commented 1 year ago

he driver is automatically determined here. I soldered the display like this:


// 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


Can I change in the library, or do I need to re-solder the pins?
nopnop2002 commented 1 year ago

Can I change in the library, or do I need to re-solder the pins?

You can change to these other PBs.

#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

This library uses the LL GPIO generic driver for controlling data pins. https://github.com/nopnop2002/Arduino-STM32-8bitTFT/blob/master/Arduino-STM32-8bitTFT.cpp#L134

The data pin is controlled using LL_GPIO_WriteOutputPort().

This function can change multiple IOs at once, but only IOs on the same port.

D0 to D7 can be changed by changing the following.

#if 1
#define TFT_DATA       GPIOA
#define TFT_D0         LL_GPIO_PIN_0
#define TFT_D1         LL_GPIO_PIN_1
#define TFT_D2         LL_GPIO_PIN_2
#define TFT_D3         LL_GPIO_PIN_3
#define TFT_D4         LL_GPIO_PIN_4
#define TFT_D5         LL_GPIO_PIN_5
#define TFT_D6         LL_GPIO_PIN_6
#define TFT_D7         LL_GPIO_PIN_7
//Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
//Pin stm32 |PA7|PA6|PA5|PA4|PA3|PA2|PA1|PA0|
#endif

#if 0
#define TFT_DATA       GPIOA
#define TFT_D0         LL_GPIO_PIN_8
#define TFT_D1         LL_GPIO_PIN_9
#define TFT_D2         LL_GPIO_PIN_10
#define TFT_D3         LL_GPIO_PIN_11
#define TFT_D4         LL_GPIO_PIN_12
#define TFT_D5         LL_GPIO_PIN_13
#define TFT_D6         LL_GPIO_PIN_14
#define TFT_D7         LL_GPIO_PIN_15
//Port data |D7  |D6  |D5  |D4  |D3  |D2  |D1 |D0 |
//Pin stm32 |PA15|PA14|PA13|PA12|PA11|PA10|PA9|PA8|
#endif

#if 0
#define TFT_DATA       GPIOB
#define TFT_D0         LL_GPIO_PIN_0
#define TFT_D1         LL_GPIO_PIN_1
#define TFT_D2         LL_GPIO_PIN_2
#define TFT_D3         LL_GPIO_PIN_3
#define TFT_D4         LL_GPIO_PIN_4
#define TFT_D5         LL_GPIO_PIN_5
#define TFT_D6         LL_GPIO_PIN_6
#define TFT_D7         LL_GPIO_PIN_7
//Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
//Pin stm32 |PB7|PB6|PB5|PB4|PB3|PB2|PB1|PB0|
#endif

#if 0
#define TFT_DATA       GPIOB
#define TFT_D0         LL_GPIO_PIN_8
#define TFT_D1         LL_GPIO_PIN_9
#define TFT_D2         LL_GPIO_PIN_10
#define TFT_D3         LL_GPIO_PIN_11
#define TFT_D4         LL_GPIO_PIN_12
#define TFT_D5         LL_GPIO_PIN_13
#define TFT_D6         LL_GPIO_PIN_14
#define TFT_D7         LL_GPIO_PIN_15
//Port data |D7  |D6  |D5  |D4  |D3  |D2  |D1 |D0 |
//Pin stm32 |PB15|PB14|PB13|PB12|PB11|PB10|PB9|PB8|
#endif

#if 0
#define TFT_DATA       GPIOC
#define TFT_D0         LL_GPIO_PIN_0
#define TFT_D1         LL_GPIO_PIN_1
#define TFT_D2         LL_GPIO_PIN_2
#define TFT_D3         LL_GPIO_PIN_3
#define TFT_D4         LL_GPIO_PIN_4
#define TFT_D5         LL_GPIO_PIN_5
#define TFT_D6         LL_GPIO_PIN_6
#define TFT_D7         LL_GPIO_PIN_7
//Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
//Pin stm32 |PC7|PC6|PC5|PC4|PC3|PC2|PC1|PC0|
#endif

#if 0
#define TFT_DATA       GPIOC
#define TFT_D0         LL_GPIO_PIN_8
#define TFT_D1         LL_GPIO_PIN_9
#define TFT_D2         LL_GPIO_PIN_10
#define TFT_D3         LL_GPIO_PIN_11
#define TFT_D4         LL_GPIO_PIN_12
#define TFT_D5         LL_GPIO_PIN_13
#define TFT_D6         LL_GPIO_PIN_14
#define TFT_D7         LL_GPIO_PIN_15
//Port data |D7  |D6  |D5  |D4  |D3  |D2  |D1 |D0 |
//Pin stm32 |PC15|PC14|PC13|PC12|PC11|PC10|PC9|PC8|
#endif

#if 0
#define TFT_DATA       GPIOD
#define TFT_D0         LL_GPIO_PIN_0
#define TFT_D1         LL_GPIO_PIN_1
#define TFT_D2         LL_GPIO_PIN_2
#define TFT_D3         LL_GPIO_PIN_3
#define TFT_D4         LL_GPIO_PIN_4
#define TFT_D5         LL_GPIO_PIN_5
#define TFT_D6         LL_GPIO_PIN_6
#define TFT_D7         LL_GPIO_PIN_7
//Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
//Pin stm32 |PD7|PD6|PD5|PD4|PD3|PD2|PD1|PD0|
#endif

#if 0
#define TFT_DATA       GPIOD
#define TFT_D0         LL_GPIO_PIN_8
#define TFT_D1         LL_GPIO_PIN_9
#define TFT_D2         LL_GPIO_PIN_10
#define TFT_D3         LL_GPIO_PIN_11
#define TFT_D4         LL_GPIO_PIN_12
#define TFT_D5         LL_GPIO_PIN_13
#define TFT_D6         LL_GPIO_PIN_14
#define TFT_D7         LL_GPIO_PIN_15
//Port data |D7  |D6  |D5  |D4  |D3  |D2  |D1 |D0 |
//Pin stm32 |PD15|PD14|PD13|PD12|PD11|PD10|PD9|PD8|
#endif

#if 0
#define TFT_DATA       GPIOE
#define TFT_D0         LL_GPIO_PIN_0
#define TFT_D1         LL_GPIO_PIN_1
#define TFT_D2         LL_GPIO_PIN_2
#define TFT_D3         LL_GPIO_PIN_3
#define TFT_D4         LL_GPIO_PIN_4
#define TFT_D5         LL_GPIO_PIN_5
#define TFT_D6         LL_GPIO_PIN_6
#define TFT_D7         LL_GPIO_PIN_7
//Port data |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 |
//Pin stm32 |PE7|PE6|PE5|PE4|PE3|PE2|PE1|PE0|
#endif

#if 0
#define TFT_DATA       GPIOE
#define TFT_D0         LL_GPIO_PIN_8
#define TFT_D1         LL_GPIO_PIN_9
#define TFT_D2         LL_GPIO_PIN_10
#define TFT_D3         LL_GPIO_PIN_11
#define TFT_D4         LL_GPIO_PIN_12
#define TFT_D5         LL_GPIO_PIN_13
#define TFT_D6         LL_GPIO_PIN_14
#define TFT_D7         LL_GPIO_PIN_15
//Port data |D7  |D6  |D5  |D4  |D3  |D2  |D1 |D0 |
//Pin stm32 |PE15|PE14|PE13|PE12|PE11|PE10|PE9|PE8|
#endif
brightproject commented 1 year ago

Anything else cannot be used. And here are the other pins. https://github.com/nopnop2002/Arduino-STM32-8bitTFT#wirering-for-8bit-parallel-tft For Arduino_Core_STM32 Another code https://github.com/nopnop2002/STM32_TFT_8bit/blob/master/STM32_TFT_8bit.h#L62