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:
  1. void setup() {
  2.   Serial.begin(115200);
  3.   pinMode(18, OUTPUT); //Cold and warm white built in led
  4.   pinMode(19, OUTPUT);
  5. }
  6.  
  7. void loop() {
  8.   digitalWrite(18, HIGH);
  9.   digitalWrite(19, HIGH);
  10.   Serial.println("hello");
  11.   delay(1000);
  12. }
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?

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_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.

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_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

  1. #include "SevSeg.h"
  2. SevSeg sevseg;
  3.  
  4. const int dig1 = 9;  
  5. const int dig2 = 8;  
  6. const int dig3 = 1;  
  7. const int dig4 = 0;  
  8. const int A = 6;  
  9. const int B = 10;      
  10. const int C = 5;    
  11. const int D = 4;    
  12. const int E = 3;    
  13. const int F = 2;      
  14. const int G = 7;      
  15.  
  16. int sec = 0;
  17. unsigned long preTime = 0;
  18.  
  19.  
  20. void setup() {
  21.   byte numDigits = 4;
  22.   byte digitPins[] = {dig1, dig2, dig3, dig4};
  23.   byte segmentPins[] = {A, B, C, D, E, F, G, -1};
  24.   bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
  25.   byte hardwareConfig = COMMON_ANODE; // See README.md for options
  26.   bool updateWithDelays = false; // Default 'false' is Recommended
  27.   bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
  28.   bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected
  29.   sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
  30.                updateWithDelays, leadingZeros, disableDecPoint);
  31.   sevseg.setBrightness(100);
  32. }
  33.  
  34. void loop()
  35. {
  36.   sevseg.refreshDisplay();
  37.   if (millis() - preTime > 1000)
  38.   {
  39.     sevseg.setNumber(sec);
  40.     if (sec != 100) sec++; //count to 100 and stop
  41.     preTime = millis();
  42.   }
  43. }
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] and 68 guests