A fatal error occurred: No serial data received

Hi, RD back and puzzled,

I was able to run a basic blink sketch on my ESP32C3 (insert cheering and applause) but a slightly more complex sketch delivers a whole bunch of information that I do not understand related to why this is not working. Long story short, no serial data was received.

Would someone examine the code and, more importantly, the error messages and give me your best shot at why the serial data is not flowing. I am posting the code below and the error messages below the code. Thank you so much for even considering this issue.

BTW, this is a simple sketch designed to read the humidity, temperature, and atmospheric pressure from the BME280 and display it on the SSD1306.

[code]
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET    -1
#define SCREEN_WIDTH  128
#define SCREEN_HEIGHT 32
#define SCREEN_ADDRESS 0x3C // Change this address to match your display

Adafruit_BME280 bme; // Create a BME280 sensor object
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  // Initialize I2C communication
  Wire.begin();

  // Initialize BME280 sensor
  if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }

  // Initialize OLED display
 
    Serial.println(F("SSD1306 allocation failed"));
 

  display.display(); // Clear the display buffer
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0,0);
  display.println("BME280 Data:");

  display.display(); // Display the header
  delay(1000); // Pause for a moment
}

void loop() {
  // Read sensor data
  float temperature = bme.readTemperature();
  float humidity = bme.readHumidity();
  float pressure = bme.readPressure() / 100.0F;

  // Display sensor data on OLED
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.print("Temperature: ");
  display.println(temperature, 2);
  display.print("Humidity: ");
  display.println(humidity, 2);
  display.print("Pressure: ");
  display.print(pressure, 2);
  display.println(" hPa");

  display.display(); // Show updated data on the display
  delay(2000); // Update every 2 seconds
}
[/code]


Sketch uses 329790 bytes (25%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14580 bytes (4%) of dynamic memory, leaving 313100 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM4
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:85:18:07:c8:3c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600

A fatal error occurred: No serial data received.
A fatal error occurred: No serial data received

You haven't selected the Port ?

  • Tools
    • Port

Looking at the output, looks like it fails just after cranking the baud rate up..
faulty cable??
Looking at the code very quickly, Serial and Screen objects were never initialized in your setup, don't think this is the reason for the error as the code never uploaded..

good luck.. ~q

Thanks for the suggestion, I wish it were that simple. The port is selected and the IDE seems to know everything about the system. It simple hangs on the upload after compiling.

Yes - that is what bothers me. I uploaded a simple "Blink" sketch to flash an LED so I know my cable is good. My mission is to find out what is holding this microprocessor up. The blink sketch keeps running showing that the newer sketch is never uploaded after being compiled.

Sometimes to go forward one must step back..
Go back to your blink sketch, change it somehow, blink faster or slower..
Get it uploaded..

Still could be a faulty cable..
Could be affected by the environment..
If everything was connected during the failed uploading, disconnect everything from board and try to upload again..
Maybe some pics are in order..

good luck.. ~q

check this thread here..

Follow the link to the github..
Scroll down to where migue27au post his solution and give that a try..

good luck.. ~q

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.