lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.02k stars 187 forks source link

The screen is initialized correctly every 2 times #543

Closed paxo-project closed 1 week ago

paxo-project commented 1 month ago

The screen is initialized correctly every 2 times

Whether when starting the code, or when resetting the screen after a sleep mode, resetting communication with the screen only works once in 2, whether using lcd ->init(); or lcd->init_without_reset() The project in question is still that of an open source phone and the fact that the screen only lights up once in 2 is quite problematic. The power supply is controlled by the esp32 and perfectly stable esp. I specify that during a bad initialization, I also receive an error from the touch part in i2c:

[333577][V][Touch_FT5x06.cpp:63] _check_init(): [FT5x06] CIPHER:0x64 / FIRMID:0x03 / VENDID:0x11

Environment ( 実行環境 )

Problem Description ( 問題の内容 )

Screen initialization fails 1 out of 2 times

Expected Behavior ( 期待される動作 )

White sceen

Steps to reproduce ( 再現のための前提条件 )

Just init the screen?

Schematic

image

Code to reproduce this issue ( 再現させるためのコード )

Please submit complete source code that can reproduce your problem. Full Code

// Config
#define LGFX_USE_V1

#include <LovyanGFX.hpp>

class LGFX : public lgfx::LGFX_Device
{
  lgfx::Panel_ILI9488     _panel_instance;
  lgfx::Bus_SPI       _bus_instance;   // SPIバスのインスタンス
  lgfx::Light_PWM     _light_instance;
  lgfx::Touch_FT5x06 _touch_instance;

public:
  LGFX(void)
  {
    {
      auto cfg = _bus_instance.config();

      cfg.spi_host = VSPI_HOST;
      cfg.spi_mode = 0;
      cfg.freq_write = 20000000;
      cfg.freq_read  = 16000000;
      cfg.spi_3wire  = true; // changed
      cfg.use_lock   = true;
      cfg.pin_sclk = 18;
      cfg.pin_mosi = 23;
      cfg.pin_dc   = 2;

     _bus_instance.config(cfg);
      _panel_instance.setBus(&_bus_instance);
    }

    {
      auto cfg = _panel_instance.config();

      cfg.pin_cs           =    13;
      cfg.pin_rst          =    -1;
      cfg.pin_busy         =    -1;

      cfg.panel_width      =   320; 
      cfg.panel_height     =   480; 
      cfg.offset_x         =     0; 
      cfg.offset_y         =     0; 
      cfg.offset_rotation  =     0; 
      cfg.dummy_read_pixel =     8; 
      cfg.dummy_read_bits  =     0;//1 
      cfg.readable         =  false; 
      cfg.invert           = false; 
      cfg.rgb_order        = false; 
      cfg.dlen_16bit       = false; 
      cfg.bus_shared       =  true; 

      cfg.memory_width     =   320; 
      cfg.memory_height    =   480; 

      _panel_instance.config(cfg);
    }
    {
      auto cfg = _light_instance.config();

      cfg.pin_bl = 5;
      cfg.invert = true;
      cfg.freq   = 44100;
      cfg.pwm_channel = 0;

      _light_instance.config(cfg);
      _panel_instance.setLight(&_light_instance);  // バックライトをパネルにセットします。
    }
    {
      auto cfg = _touch_instance.config();
      cfg.i2c_port = 1;
      cfg.i2c_addr = 0x38;
      cfg.pin_sda  = 21;
      cfg.pin_scl  = 22;

      _touch_instance.config(cfg);
      _panel_instance.setTouch(&_touch_instance);  // タッチスクリーンをパネルにセットします。
    }

    setPanel(&_panel_instance); // 使用するパネルをセットします。
  }
};

I hope it was me who made a simple mistake in my configuration Thanks in advance!

tobozo commented 1 month ago

Bus type: SPI (shared with SD card)

is that behaviour consistent whether there is a sdcard inserted or not?

paxo-project commented 1 month ago

It is the same even without SD card unfortunately

paxo-project commented 1 month ago

I also add that the screen is connected via 3-wire spi, so no miso

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 week ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.