Oshel Posted January 17, 2018 Report Posted January 17, 2018 Hello, Well, after strugling for few hours I need to ask for a hint. I've just got this display: http://www.buydisplay.com/default/7-tft-screen-touch-lcd-display-module-w-ssd1963-controller-board-mcu I am trying to control it with SMT32F103VC. Everything goes well, it initiates and works (although I had to change PLL values- there is 20 MHz clock onboard instead of 10 MHz). But i do have problem with colors. White is yellow, green is super dark green (almost invisable), yellow is very light green, red is very light green, blue is dark red... I don't get it. I am setting it in RGB565 mode, 16 bit- default ugfx settings. I've also checked if I write good values to the RAM- and yes, everything is fine. EVerything else works, like the backlight etc- it means that ssd accepts commands. Any idea what is wrong? Here is init of FSMC code (works with ssd1289): #define GDISP_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */ #define GDISP_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */ { GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_AFIO_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_14 | GPIO_PIN_15; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); __HAL_RCC_FSMC_CLK_ENABLE(); FSMC_NORSRAM_InitTypeDef FSMC_NORSRAM_InitStruct; FSMC_NORSRAM_TimingTypeDef FSMC_NORSRAM_TimingInitStruct; FSMC_NORSRAM_InitStruct.NSBank = FSMC_NORSRAM_BANK1; FSMC_NORSRAM_InitStruct.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; FSMC_NORSRAM_InitStruct.MemoryType = FSMC_MEMORY_TYPE_SRAM; FSMC_NORSRAM_InitStruct.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; FSMC_NORSRAM_InitStruct.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; FSMC_NORSRAM_InitStruct.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; FSMC_NORSRAM_InitStruct.WrapMode = FSMC_WRAP_MODE_DISABLE; FSMC_NORSRAM_InitStruct.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; FSMC_NORSRAM_InitStruct.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; FSMC_NORSRAM_InitStruct.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; FSMC_NORSRAM_InitStruct.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; FSMC_NORSRAM_InitStruct.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; FSMC_NORSRAM_InitStruct.WriteBurst = FSMC_WRITE_BURST_DISABLE; hal_sram.Instance = FSMC_NORSRAM_DEVICE; hal_sram.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; hal_sram.Init = FSMC_NORSRAM_InitStruct; FSMC_NORSRAM_TimingInitStruct.AddressSetupTime = 2; FSMC_NORSRAM_TimingInitStruct.AddressHoldTime = 1; FSMC_NORSRAM_TimingInitStruct.DataSetupTime = 2; FSMC_NORSRAM_TimingInitStruct.BusTurnAroundDuration = 1; FSMC_NORSRAM_TimingInitStruct.CLKDivision = 2; FSMC_NORSRAM_TimingInitStruct.DataLatency = 2; FSMC_NORSRAM_TimingInitStruct.AccessMode = FSMC_ACCESS_MODE_A; HAL_SRAM_Init(&hal_sram, &FSMC_NORSRAM_TimingInitStruct, NULL); __HAL_AFIO_FSMCNADV_DISCONNECTED(); } Here are the settings (got it from the forum here): #define SCREEN_HSYNC_BACK_PORCH 46 #define SCREEN_HSYNC_FRONT_PORCH 210 #define SCREEN_HSYNC_PULSE 8 #define SCREEN_VSYNC_BACK_PORCH 23 #define SCREEN_VSYNC_FRONT_PORCH 22 #define SCREEN_VSYNC_PULSE 8 static const LCD_Parameters DisplayTimings[] = { // You need one of these array elements per display { 800, 480, // Panel width and height SCREEN_HSYNC_BACK_PORCH, SCREEN_HSYNC_FRONT_PORCH, SCREEN_HSYNC_PULSE, // Horizontal Timings (back porch, front porch, pulse) CALC_PERIOD(800,SCREEN_HSYNC_BACK_PORCH,SCREEN_HSYNC_FRONT_PORCH,SCREEN_HSYNC_PULSE), // Total Horizontal Period (calculated from above line) SCREEN_VSYNC_BACK_PORCH, SCREEN_VSYNC_FRONT_PORCH, SCREEN_VSYNC_PULSE, // Vertical Timings (back porch, front porch, pulse) CALC_PERIOD(480,SCREEN_VSYNC_BACK_PORCH,SCREEN_VSYNC_FRONT_PORCH,SCREEN_VSYNC_PULSE), // Total Vertical Period (calculated from above line) CALC_FPR(800,480,SCREEN_HSYNC_BACK_PORCH,SCREEN_HSYNC_FRONT_PORCH,SCREEN_HSYNC_PULSE,SCREEN_VSYNC_BACK_PORCH,SCREEN_VSYNC_FRONT_PORCH,SCREEN_VSYNC_PULSE,60ULL), // FPR - the 60ULL is the frames per second. Note the ULL! FALSE, // Flip horizontally FALSE // Flip vertically }, };
Oshel Posted January 17, 2018 Author Report Posted January 17, 2018 Well, I've changed TFT Panel Data Width to 24 bit and in gdisp_lld_config.h changed to GDISP_PIXELFORMAT_RGB565 to GDISP_PIXELFORMAT_BGR565 and it stated to work ;o Any explaination?
Joel Bodenmann Posted January 17, 2018 Report Posted January 17, 2018 Well, glad to hear that you got it working! RGB vs BRG is really just a different order of the bytes representing the color value. It's up to the display controller to decide which of the two will be used and µGFX simply adapts to that. With display controllers like the one you're using it's usually possible to configure that during initialization. You might want to have a look at that. The 24 bit thing is most likely a packed vs. non-packed issue. But it's hard to say without knowing the exact details. This again is something that can often be configured on more advanced display controllers.
Oshel Posted January 17, 2018 Author Report Posted January 17, 2018 I do have the MCU connected to the controller well- I mean D0 to D0, D1 to D1 etc. So when I program the controller in RGB mode it should work. After all- by default it is in RGB. I will look into that.
Joel Bodenmann Posted January 17, 2018 Report Posted January 17, 2018 The connection of the physical signals definitely needs to map 1:1 as that wouldn't only have an impact on the color values but also on any other values you write such as initialization values and other commands. I don't have another explanation for this at the moment. What you experienced happens often and so far it was always related to a mismatching config between the display controller and the µGFX configuration. But I guess the most important thing is that you have it working - that makes investigating a lot less frustrating
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now