T-Display-S3 icon indicating copy to clipboard operation
T-Display-S3 copied to clipboard

My board doesn't connect to WiFi

Open AlexC-0806 opened this issue 9 months ago • 16 comments

I recently bought a T-Display S3 board and tried some default sketches. They work fine, but then I tried creating a sketch to connect the board to WiFi and get the time data from NTP. The board doesn’t connect to WiFi, even though I’m sure the WiFi credentials are correct. Here’s my code:

#include <Arduino.h>
#include <Arduino_GFX_Library.h>
#include "WiFi.h"
#include "time.h"

#define WIFI_SSID "MY_SSID"
#define WIFI_PASS "MY_PASSWORD"

#define LYLIGO_T_DISPLAY_S3
#define GFX_EXTRA_PRE_INIT()          \
  {                                   \
    pinMode(15 /* PWD */, OUTPUT);    \
    digitalWrite(15 /* PWD */, HIGH); \
  }
#define GFX_BL 38
Arduino_DataBus *bus = new Arduino_ESP32PAR8Q(
    7 /* DC */, 6 /* CS */, 8 /* WR */, 9 /* RD */,
    39 /* D0 */, 40 /* D1 */, 41 /* D2 */, 42 /* D3 */, 45 /* D4 */, 46 /* D5 */, 47 /* D6 */, 48 /* D7 */);
Arduino_GFX *gfx = new Arduino_ST7789(bus, 5 /* RST */, 0 /* rotation */, true /* IPS */, 170 /* width */, 320 /* height */, 35 /* col offset 1 */, 0 /* row offset 1 */, 35 /* col offset 2 */, 0 /* row offset 2 */);

void setup()
{
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
#ifdef GFX_EXTRA_PRE_INIT
  GFX_EXTRA_PRE_INIT();
#endif

#if defined(LCD_PWR_PIN)
  pinMode(LCD_PWR_PIN, OUTPUT);    // sets the pin as output
  digitalWrite(LCD_PWR_PIN, HIGH); // power on
#endif

#ifdef GFX_BL
  pinMode(GFX_BL, OUTPUT);
  digitalWrite(GFX_BL, HIGH);
#endif

  // Init Display
  if (!gfx->begin())
  {
    Serial.println("gfx->begin() failed!");
  }
  gfx->fillScreen(RED);
  gfx->setTextSize(2);
  gfx->setTextColor(WHITE, PURPLE);
  gfx->setCursor(5, 5);
  gfx->println("Clock Test");
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  gfx->setCursor(5, 25);
  gfx->print("Connecting to WiFi...");
  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    gfx->print(".");
    Serial.println("Connecting to WiFi...");
  }
  gfx->println("Connected to WiFi");
  configTime(3600, 0, "pool.ntp.org", "time.nist.gov");
  gfx->println(time(nullptr));
}

void loop(){
  gfx->fillScreen(WHITE);
  delay(500);
  gfx->fillScreen(BLACK);
  delay(500);
  gfx->fillScreen(RED);
  delay(500);
  gfx->fillScreen(GREEN);
  delay(500);
}

The loop() isn’t really doing anything because I wanted to test if the basic WiFi function would work. I’m using Arduino GFX because it’s the simplest library that works, since I wasn’t able to use tft_eSPI, but this isn’t the problem now. The problem is that the board doesn’t connect to WiFi, even though I tried the WifiScan sketch from the Arduino GFX library and that works, so the board is able to scan WiFi networks. The problem is that it isn’t able to connect. I bought this board with really high expectations, so it would be very disappointing if I weren’t able to use its WiFi capabilities.

AlexC-0806 avatar May 11 '24 12:05 AlexC-0806