ESP32S2 Serial Print not working

Khansday
Posts: 1
Joined: Fri Jun 28, 2024 4:20 pm

ESP32S2 Serial Print not working

Postby Khansday » Fri Jun 28, 2024 4:24 pm

I have bought the open source espressif drone ESP32S2 ESP32 Flight Control Open Source Quadcopter ESP-Drone Drone Model Wifi Remote Control Crazyflie - AliExpress 26
Since it is open source, I wanted to try to code it with custom programs wit the Arduino IDE on windows 10, the first thing I did was to blink an LED on board and I was successful at it. Then, I wanted to read the data from the onboard MPU6050, but was unable to get anything in the serial monitor.
I tried to run just a simple Hellow world program and I still was unable to do it, nothing would show up on the serial monitor! This is the code:

Code: Select all

#include "USB.h"

void setup() {
  USB.begin();
  Serial.begin(115200);
  delay(1000); // Wait for Serial to initialize
  Serial.println("Serial communication is working!");
}

void loop() {
  Serial.println("Hello from ESP32-S2!");
  delay(1000);
}
Here are all the testings I made to fix the problem:
1. **Enable USB CDC on Boot** which is disabled by default under the tools settings.
2. Try different board names, the ESP32S2 Wrover is not listed, so I have been using the ESP32S2 dev module and also tried with the ESP32S2 Native USB.
3. Change the tools settings, such as try to erase flash at upload, change upload speed etc.
4. **Delete the esp32 core** file manually and re install it again.
5. **Uninstall** and reinstall the **Arduino IDE (2.3.2).**
6. **Download the espressif IDE** and run an example file with the Hello World project.
7. Use ChatGPT to find any other fix I could do but that also did not work.
8. Check my **drivers**, I have the **Silicon Labs CP210x USB to UART bridge version: 11.3.0.176.**
None of the above steps worked. So, I gave my code to a colleague of mine with: Windows 10, **same** Arduino **IDE** version and same esp32 **core** and same board and same **tools** settings and **drivers**. When he uploaded my code, he started receiving the hello world on the serial monitor successfully, we even changed the serial monitor baud rate on code and it was still working.
The weird thing is, after flashing the code on the other machine, I connected the drone to my laptop and I was able to see the message **correctly**. So, I flashed the same code again from my machine and gave it to my colleague, again there was no output on the serial monitor.
Just to be sure, I flashed the blink test again, and the LEDs on my drone were blinking fine, it is specifically the serial library that is not working properly.
I also tried to:
1. Make a new user account on my laptop.
2. Make a new clean installation of the Arduino Ide 2.3.2 and the esp32 core form espressif.
3. Download the old Arduino IDE: 1.8.12
Still not working. I also set the **Core Debug Level to Verbose** as requested by GPT and apparently everything is fine, I asked my colleague to do the same, and I copied my message and my colleague’s message on GPT to spot any difference and they were identical.
All this time, from the very first upload, the only thing I always get on the Serial Monitor at specifically **115200** baud rates, irrespectively to what I put in the code (i.e. 9600), is the following message:
[/code]
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6110,len:0x578
load:0x4004b000,len:0x4
load:0x4004b004,len:0x978
load:0x4004f000,len:0x2d78
entry 0x4004b138
[/code]
**If I enable the Verbose debug I get:**

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6110,len:0x578
load:0x4004b000,len:0x4
load:0x4004b004,len:0x978
load:0x4004f000,len:0x2d78
entry 0x4004b138
[   545][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x40083c00
[   556][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x40083bd0
[   570][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x40083ba0
[   583][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x40083b70
[   597][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x40083c00
[   610][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x40083bd0
[   623][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x40083ba0
[   637][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x40083b70
[   651][D][esp32-hal-tinyusb.c:772] tinyusb_enable_interface2(): Interface CDC enabled
[   661][D][esp32-hal-tinyusb.c:655] tinyusb_load_enabled_interfaces(): Load Done: if_num: 2, descr_len: 75, if_mask: 0x10
[   677][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 44 successfully set to type UART_RX (2) with bus 0x3ffbf358
[   688][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 43 successfully set to type UART_TX (3) with bus 0x3ffbf358
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-S2
  Package           : 0
  Revision          : 0
  Cores             : 1
  CPU Frequency     : 240 MHz
  XTAL Frequency    : 40 MHz
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : No
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   246648 B ( 240.9 KB)
  Free Bytes        :   217676 B ( 212.6 KB)
  Allocated Bytes   :    26096 B (  25.5 KB)
  Minimum Free Bytes:   212524 B ( 207.5 KB)
  Largest Free Block:   196596 B ( 192.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  4194304 B (4 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Jun 27 2024 16:08:10
  Compile Host OS   : windows
  ESP-IDF Version   : v5.1.4-358-gbd2b9390ef-dirty
  Arduino Version   : 3.0.2
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32S2_DEV
  Arduino Variant   : esp32s2
  Arduino FQBN      : esp32:esp32:esp32s2:UploadSpeed=921600,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=verbose,PSRAM=disabled,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
============ Before Setup End ============
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   246648 B ( 240.9 KB)
  Free Bytes        :   217324 B ( 212.2 KB)
  Allocated Bytes   :    26352 B (  25.7 KB)
  Minimum Free Bytes:   212032 B ( 207.1 KB)
  Largest Free Block:   196596 B ( 192.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------
    43 : UART_TX[0]
    44 : UART_RX[0]
============ After Setup End =============
I cannot understand what is the difference between mine and my colleagues setup, please provide help as I am really stuck and even if I could just change machine, I want to really understand what the problem is like a real engineer.

Who is online

Users browsing this forum: No registered users and 66 guests