U8g2 spi st7920 not working in esp idf but ok with Arduino
Posted: Tue Aug 18, 2020 8:25 am
Hello everyone!
I'm starting to learn esp idf, and I'm trying to use a GLCD 128x64 with ST7920 over SPI.
It works fine with the Arduino code, so the wiring it's ok (well... the rst pin is kind of a problem, but I can see things on the display so I'll check it later).
But when I use u8g2 and the relative hal from nkolban, the project compiles fine but I can see nothing in the display. The hardware is exactly the same, I just switch beetween the two environments.
here's the relative code in esp idf:
what am I missing? I tried to change the font pixel color, transparency, but I still can't ser anything.
Any idea on why this isn't working?
thank you in advance!
I'm starting to learn esp idf, and I'm trying to use a GLCD 128x64 with ST7920 over SPI.
It works fine with the Arduino code, so the wiring it's ok (well... the rst pin is kind of a problem, but I can see things on the display so I'll check it later).
But when I use u8g2 and the relative hal from nkolban, the project compiles fine but I can see nothing in the display. The hardware is exactly the same, I just switch beetween the two environments.
here's the relative code in esp idf:
Code: Select all
void app_main(void)
{
u8g2_esp32_hal_t u8g2_esp32_hw = U8G2_ESP32_HAL_DEFAULT;
u8g2_esp32_hw.clk = 14;
u8g2_esp32_hw.cs = 15;
u8g2_esp32_hw.mosi = 13;
u8g2_esp32_hw.reset = 16;
u8g2_esp32_hal_init(u8g2_esp32_hw);
u8g2_t u8g2;
u8g2_Setup_st7920_s_128x64_f(
&u8g2, U8G2_R0,
u8g2_esp32_spi_byte_cb,
u8g2_esp32_gpio_and_delay_cb);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
u8g2_ClearBuffer(&u8g2);
u8g2_SetFont(&u8g2, u8g2_font_timR14_tf);
u8g2_DrawStr(&u8g2, 2,17,"Hello World!");
u8g2_SendBuffer(&u8g2);
}
Any idea on why this isn't working?
thank you in advance!