Open shaharsery opened 4 years ago
@nkolban I have been facing the same problem, kindly help.
Same issue here. I am using the same config. It compiles but nothing is shown on the display.
According to this reply on the ESP forum, it is necessary to configure the default value of the chip selector pin. This pin is initially set by default when using the Arduino Framework.
So, it's necessary to change this line from '0' to SPI_DEVICE_POSITIVE_CS.
spi_device_interface_config_t dev_config;
dev_config.address_bits = 0;
dev_config.command_bits = 0;
dev_config.dummy_bits = 0;
dev_config.mode = 0;
dev_config.duty_cycle_pos = 0;
dev_config.cs_ena_posttrans = 0;
dev_config.cs_ena_pretrans = 0;
dev_config.clock_speed_hz = 10000;
dev_config.spics_io_num = u8g2_esp32_hal.cs;
dev_config.flags = SPI_DEVICE_POSITIVE_CS;
dev_config.queue_size = 200;
dev_config.pre_cb = NULL;
dev_config.post_cb = NULL;
//ESP_LOGI(TAG, "... Adding device bus.");
ESP_ERROR_CHECK(spi_bus_add_device(HSPI_HOST, &dev_config, &handle_spi));
Hi, I'm trying to create a simple project with the u8g2 library, an ST7920 LCD and the ESP32 using eclipse and the ESP-IDF but I can't get the LCD to show anything. I've created a simple project using this guide When I connect the same setup and use the Arduino IDE with the 'HelloWorld' example and U8G2_ST7920_128X64_F_SW_SPI everything works fine.
This is my main app:
include <driver/gpio.h>
include <driver/spi_master.h>
include
include <freertos/FreeRTOS.h>
include <freertos/task.h>
include
include
include
include "sdkconfig.h"
include "u8g2_esp32_hal.h"
include "u8g2_esp32_hal.c"
define PIN_CLK 18
define PIN_MOSI 23
define PIN_RESET 22
define PIN_CS 5
void app_main() { u8g2_esp32_hal_t u8g2_esp32_hal = U8G2_ESP32_HAL_DEFAULT; u8g2_esp32_hal.clk = PIN_CLK; u8g2_esp32_hal.mosi = PIN_MOSI; u8g2_esp32_hal.cs = PIN_CS; u8g2_esp32_hal.reset = PIN_RESET; u8g2_esp32_hal_init(u8g2_esp32_hal);
}
I'm pretty new to all of this so I might be missing something pretty simple, any help would be much appreciated, Thanks!