Closed AndreAhmed closed 1 month ago
Maybe a complete different solution could be to use stm32duino project.
Can you link it please?
Here is the link for the Lcd https://www.buydisplay.com/graphic-lcd-240x64-module-display-ra6963-fully-compatible-with-t6963
Can you link it please?
For stm32duino? It is here: https://github.com/stm32duino
STM32Duino is a extension to the Arduino IDE. It will make almost any STM32 compatible with Arduino. U8g2 will then work out of the box.
@olikraus Can you check the display please if it needs any special pin configuration, for example negative CS,WR?
there seems to be a copy & paste error in your code:
case U8X8_MSG_GPIO_D1: // D1 or SPI data pin: Output level in arg_int
HAL_GPIO_WritePin(DATA_PORT, D0_Pin, arg_int);
D0_Pin probably should be D1_Pin. Same issues for the other pins also...
@olikraus Sorry I fixed that already in my code, but I still don't get any display, any other things needed for logic to work ? I mean PIN configuration or PIN Logic state ?
it looks like a standard T6963 display, which should work out of the box with u8g2. Did you add a proper var-pot like show here: https://www.buydisplay.com/download/interfacing/ERM24064-1_Interfacing.pdf ?
@olikraus Yes I added it, no display is showing
Then... I assume a wiring error...
@olikraus After MX_GPIO Init, I get horizontal line in the display, before u8g2 init, after its init, it goes out. that's very weird ? any idea? I have doubled checked the connection, its correct
@olikraus I negated the reset pin in code, and I have two lines now... I'm drawing a string and a picture
/* USER CODE BEGIN 2 */
u8g2_Setup_t6963_240x64_f(&u8g2, U8G2_R0,u8x8_byte_8bit_8080mode, u8x8_stm32_gpio_and_delay);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
// clear VRAM
for (int y=0;y<LCD_ys;y++)
for (int x=0;x<LCD_xs>>3;x++)
VRAM[y][x]=col0;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
u8g2_ClearBuffer(&u8g2);
u8g2_SetDrawColor(&u8g2,1);
u8g2_DrawCircle(&u8g2, 20, 20, 20, U8G2_DRAW_ALL);
u8g2_SetFont(&u8g2, u8g2_font_ncenB14_tr);
u8g2_DrawStr(&u8g2, 0, 15, "Tarkan");
for(int i = 0; i < 200; i++)
{
u8g2_DrawPixel(&u8g2, i, i);
}
u8g2_SendBuffer(&u8g2);
Running this, I get a line Without even Initializing the display
__HAL_RCC_GPIOE_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9
|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_0
|GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
I also noticed something very weird, when I remove pin 3 VDD which is 5V, and at power the MCU, I see the LCD is working(light on), how come ?!
that's their sample app
uint8_t u8x8_stm32_gpio_and_delay(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_GPIO_AND_DELAY_INIT:
/* Insert codes for initialization */
break;
case U8X8_MSG_DELAY_10MICRO:
for (uint16_t n = 0; n < 320; n++)
{
__NOP();
}
break;
case U8X8_MSG_DELAY_NANO:
delay_ns(arg_int);
break;
case U8X8_MSG_DELAY_100NANO:
for(int i = 0; i < 100; i++)
{
delay_ns(1);
}
break;
case U8X8_MSG_DELAY_MILLI:
/* ms Delay */
HAL_Delay(arg_int);
break;
case U8X8_MSG_GPIO_E:
/* Insert codes for SS pin control */
HAL_GPIO_WritePin(GPIOE, WR_Pin, arg_int);
break;
case U8X8_MSG_GPIO_CS:
/* Insert codes for SS pin control */
HAL_GPIO_WritePin(GPIOE, CE_Pin, arg_int);
break;
case U8X8_MSG_GPIO_DC:
/* Insert codes for DC pin control */
HAL_GPIO_WritePin(GPIOE, CD_Pin, arg_int);
break;
case U8X8_MSG_GPIO_RESET:
/* Insert codes for RST pin control */
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, arg_int);
break;
case U8X8_MSG_GPIO_D0: // D0 or SPI clock pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D0_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D1: // D1 or SPI data pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D1_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D2: // D2 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D2_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D3: // D3 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D3_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D4: // D4 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D4_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D5: // D5 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D5_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D6: // D6 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D6_Pin, arg_int);
break;
case U8X8_MSG_GPIO_D7: // D7 pin: Output level in arg_int
HAL_GPIO_WritePin(GPIOE, D7_Pin, arg_int);
break;
default:
u8x8_SetGPIOResult(u8x8, 1); // default return value
break;
}
return 1;
}``
@olikraus
I have followed your advice and used stm32arduino, and still no output to the display
I used graphics test as example
I am a little bit confused by the purple ERM2 graphics LCD connector. What exactly is the purpose of this device. What is the schematic for this purple add on board?
Hello Guys, I'm in a trouble. I'm trying to interface an LCD t6963 based controller, and I'm using STM32F4, now I'm trying to use u8g2 lib for interfacing with the LCD. My problem right now is how to configure the GPIO pins for Data and for control. From my experience, before Setting a GPIO to Output or to Read, I have to use stm32Hal to reinit the port/pin, to be output or input. But in u8g2, it has a call back, that just set the pin to reset or set, How can I make that work, in case that GPIO data port if it's as input or output ?
also how do I clear a pixel at position ?
and here the GPIO_INIT