2024-09-09 01:53 AM
I sent a write data to LCD like display the RED background on the LCD panel. But it display like this-
this is my code part:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_FSMC_Init();
MX_CRC_Init();
MX_FMPI2C1_Init();
/* USER CODE BEGIN 2 */
ST7789H2_Init();
LCD_Fill(0xF800, 0, 0, 240, 240);
/* USER CODE END 2 */
/* Init scheduler */
osKernelInitialize();
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
/* USER CODE END RTOS_EVENTS */
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
void LCD_Fill(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t width, uint16_t height)
{
for (uint16_t i=0; i<height; i++)
{
ST7789H2_DrawHLine(RGBCode, Xpos, Ypos++, width);
}
}
#include "main.h"
#include "LCD_Controller.h"
#define FMC_BANK1_REG ((uint16_t *) 0x60000000) // Register Address for A0
#define FMC_BANK1_DATA ((uint16_t *) 0x60000002) // Data Address for A0 -> A0<<1 -> 0010
void LCD_IO_WriteReg(uint8_t Reg)
{
*FMC_BANK1_REG = Reg;
}
void LCD_IO_WriteData(uint16_t RegValue)
{
*FMC_BANK1_DATA = RegValue;
}
void LCD_IO_WriteMultipleData(uint16_t *pData, uint32_t Size)
{
for (uint32_t i=0; i<Size; i++)
{
LCD_IO_WriteData(pData[i]);
}
}
uint16_t LCD_IO_ReadData(void)
{
return *FMC_BANK1_DATA;
}
void LCD_IO_Delay(uint32_t delay)
{
HAL_Delay(delay);
}
void LCD_IO_Init(void)
{
HAL_GPIO_WritePin(MC_LCD_RESET_GPIO_Port, MC_LCD_RESET_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LCD_ENABLE_GPIO_Port, LCD_ENABLE_Pin, GPIO_PIN_RESET);
LCD_IO_Delay(5);
// HAL_GPIO_WritePin(BL_CONTROL_GPIO_Port, BL_CONTROL_Pin, GPIO_PIN_RESET);
// LCD_IO_Delay(5);
HAL_GPIO_WritePin(MC_LCD_RESET_GPIO_Port, MC_LCD_RESET_Pin, GPIO_PIN_SET);
HAL_GPIO_WritePin(LCD_ENABLE_GPIO_Port, LCD_ENABLE_Pin, GPIO_PIN_SET);
// HAL_GPIO_WritePin(BL_CONTROL_GPIO_Port, BL_CONTROL_Pin, GPIO_PIN_SET);
}
Can anyone help me?
2024-09-09 04:30 AM
Hello @Meenakshi ,
It seems the function you are calling to write to your screen is "LCD_Fill(0xF800, 0, 0, 240, 240);" which does this :
for (uint16_t i=0; i<height; i++)
{
ST7789H2_DrawHLine(RGBCode, Xpos, Ypos++, width);
}
I do not know what ST7789H2_DrawHLine(RGBCode, Xpos, Ypos++, width); does.
Also, this function above is not related to TouchGFX but to (I assume) the library you are using.
The second code you share (I don't know the name of the file) is not related to this function I think.
For TouchGFX, it is recommended to test the LCD control by following this guide if you put your framebuffer in internal ram and this guide if you put your framebuffer in external ram.
Furthermore, you want to do a TBD (TouchGFX Board Setup), so you should follow the board bring up guide .
I hope this helps!
If this message (or another) solves your problem, I invite you to select it as "best answer".
Regards,
2024-09-30 03:23 AM
Hello @Meenakshi ,
Have you been able to move forward with your issue?
Regards,
2024-09-30 10:20 PM
Hi @GaetanGodart , Thanks for your support.
I couldn't able to solve the problem. Still, I'm not able to display the color background.
Regards,
Meena
2024-10-01 12:47 AM - edited 2024-10-01 12:47 AM
Ok no problem.
Keep me updated when you make progress / have new questions.
Regards,