waveshare esp32s3 crashing after connecting to wifi. #9919
Replies: 2 comments 1 reply
-
Same thing here. Hope that's not your real password? |
Beta Was this translation helpful? Give feedback.
-
The issue you're encountering with your ESP32-S3 board likely relates to a memory allocation problem. The error message indicates that an assertion failed when trying to locate a free memory block, suggesting that there isn't enough memory available to complete the requested operation. This can happen when combining WiFi connectivity with display operations, both of which can be memory-intensive. Here are some steps you can take to troubleshoot and potentially resolve the issue:
cpp
cpp void printMemoryInfo() { |
Beta Was this translation helpful? Give feedback.
-
Hello everyone.
I've recently started a project where I'm trying to make my own smart watch using a custom esp32 board from waveshare ( https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28#esp32-s3-touch-lcd-1.28-demo ).
The thing is that, as soon as I connect the board to wifi and want to display anything on the screen at the same time, the board reboots and the debug log gives me this message:
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29e4
entry 0x403c9880
Connecting to WiFi...
Connecting...
Connected to WiFi
PSRAM is correctly initialized
Memory allocated successfully for BlackImage
DEV_Module_Init OK
GPIO Init successful!
Debug : Set image Rotate 90
assert failed: block_locate_free tlsf.c:566 (block_size(block) >= size)
Backtrace: 0x40377336:0x3fca0ba0 0x4037db41:0x3fca0bc0 0x40383885:0x3fca0be0 0x40382f99:0x3fca0d10 0x40382951:0x3fca0d30 0x40382a80:0x3fca0d50 0x40377f6a:0x3fca0d70 0x4037803a:0x3fca0da0 0x40379605:0x3fca0df0 0x4209bcf9:0x3fca0e10 0x4209dda4:0x3fca0e40 0x4209e828:0x3fca0e70 0x4209ec9d:0x3fca0eb0 0x40041502:0x3fca0ef0 0x4209b54d:0x3fca0f20
ELF file SHA256: d7e68d302420fd69
Rebooting...
The code technically works, and displays the correct time, but only for about a second, before the board reboots.
However, connecting to wifi and displaying the time in serial works fine, as well as displaying text on the screen. the code even works if I remove the "connectToWiFi();" line from the code.
I'm kinda new to esp32 coding and don't know what could cause this?
Here is the code, and all the custom libraries that the code is using:
I am using arduino IDE 2.3.2
CODE:
#include <Arduino.h>
#include "LCD_Test.h"
#include <WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Wire.h>
#include "time.h"
UWORD Imagesize = LCD_1IN28_HEIGHT * LCD_1IN28_WIDTH * 2;
UWORD *BlackImage;
const char *ssid = "SSID";
const char *password = "PASSWORD";
const char *ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 3600;
const int daylightOffset_sec = 0;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, ntpServer, gmtOffset_sec);
#define RETRY_BUTTON_PIN 33
const unsigned long debounceDelay = 50;
bool buttonState = HIGH;
bool lastButtonState = HIGH;
unsigned long lastDebounceTime = 0;
unsigned long lastWiFiConnectTime = 0;
// Interval for automatic WiFi reconnection (48 hours)
const unsigned long wifiReconnectInterval = 48 * 60 * 60 * 1000;
void setup()
{
}
void connectToWiFi() {
Serial.println("Connecting to WiFi...");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}
Serial.println("Connected to WiFi");
}
void setLocalTime() {
while (!timeClient.update()) {
timeClient.forceUpdate();
delay(100);
}
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
}
void displayCurrentTime() {
timeClient.update();
String formattedTime = timeClient.getFormattedTime();
Paint_Clear(WHITE);
Paint_DrawString_EN(45, 50, formattedTime.c_str(), &Font16, WHITE, BLACK);
LCD_1IN28_Display(BlackImage);
}
bool isButtonPressed() {
bool reading = digitalRead(RETRY_BUTTON_PIN);
if (reading != lastButtonState) {
}
if ((millis() - lastDebounceTime) > debounceDelay) {
}
lastButtonState = reading;
return false; // Button is not pressed
}
void loop() {
}
if (isButtonPressed()) {
Serial.println("Manual reconnecting...");
WiFi.begin(ssid, password);
}
}
The libraries and a copy of the code are in this zip file:
code and libraries.zip
If you need any other files or informations, tell me.
thanks for your time.
Beta Was this translation helpful? Give feedback.
All reactions