Go Down

Topic: STM32F103RB with 3.5" TFT (ILI9486) (Read 43 times) previous topic - next topic

bangaham

Hi,
working on a project and I am desperate to get it working. Trying to interface the STM32F103RBT6 dev. board:

https://www.aliexpress.com/item/33017566601.html

With 3.5" TFT LCD with the ILI9486 driver IC:

http://www.lcdwiki.com/3.5inch_Arduino_Display-UNO

The issue is I can't get it working. I am using the MCUFRIEND_kbv library, after doing some digging in the code of the library it didn't have the port defintions for the Generic STM32F103R series(installed stm32duino from the board manager) and I added them next to the NUCLEO_F103RB and maple rev3:

Code: [Select]

#if defined(ARDUINO_NUCLEO_F103RB) || defined(ARDUINO_STM_NUCLEO_F103RB)* || defined(ARDUINO_GENERIC_STM32F103R)* //F103 has unusual GPIO modes
//                                 PA10,PA9,PA8                       PB10                   PB5,PB4,PB3                             PC7
#define setWriteDir() {GP_OUT(GPIOA, CRH, 0xFFF); GP_OUT(GPIOB, CRH, 0xF00); GP_OUT(GPIOB, CRL, 0xFFF000); GP_OUT(GPIOC, CRL, 0xF0000000); }
#define setReadDir()  {GP_INP(GPIOA, CRH, 0xFFF); GP_INP(GPIOB, CRH, 0xF00); GP_INP(GPIOB, CRL, 0xFFF000); GP_INP(GPIOC, CRL, 0xF0000000); }
#else      //F0xx, F3xx, F4xx, L0xx, L1xx, L4xx use MODER
//                                   PA10,PA9,PA8           PB10,PB5,PB4,PB3                      PC7
#define setWriteDir() { setReadDir(); \
                        GPIOA->MODER |=  0x150000; GPIOB->MODER |=  0x100540; GPIOC->MODER |=  0x4000; }
#define setReadDir()  { GPIOA->MODER &= ~0x3F0000; GPIOB->MODER &= ~0x300FC0; GPIOC->MODER &= ~0xC000; }
#endif

#elif defined(ARDUINO_MAPLE_REV3)* || defined(ARDUINO_GENERIC_STM32F103R)* // Uno Shield on MAPLE_REV3 board
#warning Uno Shield on MAPLE_REV3 board
#define RD_PORT GPIOC
#define RD_PIN  0
#define WR_PORT GPIOC
#define WR_PIN  1
#define CD_PORT GPIOC
#define CD_PIN  2
#define CS_PORT GPIOC
#define CS_PIN  3
#define RESET_PORT GPIOC
#define RESET_PIN  4


The code in between the * --- * I added, without it the code won't compile.

And tried to connect the data pins according to the comment line (and tried backwards). The SPI lines are defined later and are pretty straight forward to figure out (I hope I'm right).

Connections:
LCD_D7 -> PA10
LCD_D6 -> PA9
LCD_D5 -> PA8
LCD_D4 -> PB10
LCD_D3 -> PB5
LCD_D2 -> PB4
LCD_D1 -> PB3
LCD_D0 -> PC7

LCD_RD -> PC0
LCD_WR -> PC1
LCD_RS -> PC2
LCD_CS -> PC3
LCD_RS -> PC4

I tried to compile the code and it compiled correctly, uploaded with ST-LINK v2 but the screen is just white and nothing happens. I'm new to the STM32 world and didn't find anything on Google to help so any guidance is welcome.

Go Up