ESP32-C3-01M built in led flashing and serial not working

sebidani
Posts: 3
Joined: Sat Apr 01, 2023 10:23 am

ESP32-C3-01M built in led flashing and serial not working

Postby sebidani » Sat Apr 01, 2023 2:37 pm

Hi!

I recently ordered an esp32-c3-01m kit microcontroller and encountered two issues with it.

I would like to use it to drive a 7-segment display, but I noticed that the display flashes approximately every 2 seconds (there is no delay or serial print in the code). I won't include the code for this because it also causes the LEDs on the board (cold and warm white) to flash simultaneously after a simple digitalWrite turn-on.

The other problem is with the serial monitor.
Previously, with the esp32, I was used to sending debug messages to the serial monitor when it started/restarted, but this does not send anything. Even with the following basic code, I don't get anything when I open the serial monitor:

Code: Untitled.cpp Select all


void setup() {
Serial.begin(115200);
pinMode(18, OUTPUT); //Cold and warm white built in led
pinMode(19, OUTPUT);
}

void loop() {
digitalWrite(18, HIGH);
digitalWrite(19, HIGH);
Serial.println("hello");
delay(1000);
}
The only thing I notice when I open the serial monitor is that all the LEDs on the board turn off, and they turn on again when I close the serial monitor.
For me, Serial is not important for this project, but I thought maybe it's related to the two issues. If the LEDs wouldn't flash, I would be satisfied with it.
Does anyone have any ideas or has anyone experienced something similar?

Sprite
Espressif staff
Espressif staff
Posts: 10596
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3-01M built in led flashing and serial not working

Postby Sprite » Sun Apr 02, 2023 1:13 am

If you're using the built-in USB-serial converter, your use of GPIO18/19 is the issue; these normally are the pins USB is connected to and reconfiguring them will break that connection.

sebidani
Posts: 3
Joined: Sat Apr 01, 2023 10:23 am

Re: ESP32-C3-01M built in led flashing and serial not working

Postby sebidani » Sun Apr 02, 2023 10:01 am

Thanks for the quick reply. There is a ch340c ic on the board that does the serial-usb conversion. I tried the code pins 18 and 19 excluded, but the same issue.

Sprite
Espressif staff
Espressif staff
Posts: 10596
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3-01M built in led flashing and serial not working

Postby Sprite » Mon Apr 03, 2023 12:34 am

How did you connect the 7-segment display? Are you sure you're not hooking anything up to the ESP TxD0/RxD0 pins?

sebidani
Posts: 3
Joined: Sat Apr 01, 2023 10:23 am

Re: ESP32-C3-01M built in led flashing and serial not working

Postby sebidani » Mon Apr 03, 2023 8:05 am

Code: Untitled.cpp Select all


#include "SevSeg.h"
SevSeg sevseg;

const int dig1 = 9;
const int dig2 = 8;
const int dig3 = 1;
const int dig4 = 0;
const int A = 6;
const int B = 10;
const int C = 5;
const int D = 4;
const int E = 3;
const int F = 2;
const int G = 7;

int sec = 0;
unsigned long preTime = 0;


void setup() {
byte numDigits = 4;
byte digitPins[] = {dig1, dig2, dig3, dig4};
byte segmentPins[] = {A, B, C, D, E, F, G, -1};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(100);
}

void loop()
{
sevseg.refreshDisplay();
if (millis() - preTime > 1000)
{
sevseg.setNumber(sec);
if (sec != 100) sec++; //count to 100 and stop
preTime = millis();
}
}
At this code, I stop the counting at 100, and it is clearly visible that the 7-segment display flashes approximately every 2 seconds (which is obviously not caused by the display refreshing since the content is static). I apologize if I worded it ambiguously. I don't intend to use serial communication in the project, I just mentioned it because it doesn't work, and I thought it might be related to the display flashing. The flashing of the display is my main issue.

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 6 guests