Hi everyone,
I need help for setting up TFT display on STM32F103RDT6. I'm using display DT028TFT with R61505U driver.
DATA pins: PB0(0), PB1(1), PA2(2), PB3(3), PB4(4), PB5(5), PB6(6), PB7(7), PB8(8), PB9(9), PC6(10), PC7(11), PB12(12), PB13(13), PB14(14), PB15(15)
RS: PC5 WR: PA15 RD: PC4 CS: PA0 RESET: PA1
The initial sequence for display looks good, it's working on STM32F103ZE with FSMC Here is my code but it's not working
void Write_Cmd(uint16_t LCD_Reg) { uint16_t maskPA2=0x0004; uint16_t maskPC6_7=0x0C00; uint16_t PA2=0x0; uint16_t PC6_7=0x0; PA2 = LCD_Reg & maskPA2; PC6_7 = LCD_Reg & maskPC6_7; GPIOA->BRR=GPIO_BRR_BR0; // CS=0 GPIOC->BRR=GPIO_BRR_BR5; // RS=0 GPIOB->ODR = LCD_Reg; if(PA2==0x4){ // GPIOA->BSRR=GPIO_BSRR_BS2; } else{ GPIOA->BRR=GPIO_BRR_BR2; } switch (PC6_7) { case 0x0: GPIOC->BRR=GPIO_BRR_BR6; GPIOC->BRR=GPIO_BRR_BR7; break; case 0x0400: GPIOC->BSRR=GPIO_BSRR_BS6; GPIOC->BRR=GPIO_BRR_BR7; break; case 0x0800: GPIOC->BRR=GPIO_BRR_BR6; GPIOC->BSRR=GPIO_BSRR_BS7; break; case 0x0C00: GPIOC->BSRR=GPIO_BSRR_BS6; GPIOC->BSRR=GPIO_BSRR_BS7; break; } GPIOA->BRR=GPIO_BRR_BR15; // WR=0 GPIOA->BSRR=GPIO_BSRR_BS15; // WR=1 GPIOA->BSRR=GPIO_BSRR_BS0; // CS=1 } void Write_Dat(uint16_t LCD_Dat) { uint16_t maskPA2=0x0004; uint16_t maskPC6_7=0x0C00; uint16_t PA2=0x0; uint16_t PC6_7=0x0; PA2 = LCD_Dat & maskPA2; PC6_7 = LCD_Dat & maskPC6_7; GPIOA->BRR=GPIO_BRR_BR0; // CS=0 GPIOC->BSRR=GPIO_BSRR_BS5; // RS=1 GPIOB->ODR = LCD_Dat; if(PA2==0x4){ GPIOA->BSRR=GPIO_BSRR_BS2; } else{ GPIOA->BRR=GPIO_BRR_BR2; } switch (PC6_7) { case 0x0: GPIOC->BRR=GPIO_BRR_BR6; GPIOC->BRR=GPIO_BRR_BR7; break; case 0x0400: GPIOC->BSRR=GPIO_BSRR_BS6; GPIOC->BRR=GPIO_BRR_BR7; break; case 0x0800: GPIOC->BRR=GPIO_BRR_BR6; GPIOC->BSRR=GPIO_BSRR_BS7; break; case 0x0C00: GPIOC->BSRR=GPIO_BSRR_BS6; GPIOC->BSRR=GPIO_BSRR_BS7; break; } GPIOA->BRR=GPIO_BRR_BR15; // WR=0 GPIOA->BSRR=GPIO_BSRR_BS15; // WR=1 GPIOA->BSRR=GPIO_BSRR_BS0; // CS=1 } void LCD_WriteReg(uint8_t LCD_Reg, uint16_t LCD_Dat) { Write_Cmd(LCD_Reg); Write_Dat(LCD_Dat); } void LCD_WriteRAM_Prepare(void) { Write_Cmd(0x0022); } void LCD_WriteRAM(uint16_t RGB_Code) { Write_Dat(RGB_Code); }