Serial Not working After Sketch Load

I'm running Arduino 2.0.1 IDE on a Win10 PC loading sketches via a FTDI Basic breakout board. I'm experimenting with ESP-01 tutorials and loading the sketches. For some reason after the sketch loads I do not see the serial debug data on the IDE Serial Monitor. In most cases the sketch works. Its for those sketches that don't work that the debug data would come in handy. Is there a specific baud for the FTDI Basic or ESP-01 I need to use?

Below is code from a working sketch and no serial data.

void setup(){
  // Serial port for debugging purposes
  Serial.begin(115200);
  dht.begin();
  
  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  Serial.println("Connecting to WiFi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println(".");
  }

What do you see if you reset the board with the Serial monitor open ?

If I unplug the FTDI it says something to the effect that board not connected. then when it reconnects the serial pane is blank.

Loading the sketch I get this..

Executable segment sizes:

ICACHE : 32768           - flash instruction cache 

IROM   : 271372          - code in flash         (default or ICACHE_FLASH_ATTR) 

IRAM   : 27489   / 32768 - code in IRAM          (IRAM_ATTR, ISRs...) 

DATA   : 1504  )         - initialized variables (global, static) in RAM/HEAP 

RODATA : 2628  ) / 81920 - constants             (global, static) in RAM/HEAP 

BSS    : 25912 )         - zeroed variables      (global, static) in RAM/HEAP 

Sketch uses 302993 bytes (31%) of program storage space. Maximum is 958448 bytes.
Global variables use 30044 bytes (36%) of dynamic memory, leaving 51876 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port COM5
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:c7:6b:79
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 307152 bytes to 222551...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (14 %)
Writing at 0x00008000... (21 %)
Writing at 0x0000c000... (28 %)
Writing at 0x00010000... (35 %)
Writing at 0x00014000... (42 %)
Writing at 0x00018000... (50 %)
Writing at 0x0001c000... (57 %)
Writing at 0x00020000... (64 %)
Writing at 0x00024000... (71 %)
Writing at 0x00028000... (78 %)
Writing at 0x0002c000... (85 %)
Writing at 0x00030000... (92 %)
Writing at 0x00034000... (100 %)
Wrote 307152 bytes (222551 compressed) at 0x00000000 in 19.8 seconds (effective 124.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

After uplugging and plugging back in a couple times the Serial Monitor was filled with this, perhaps a stack dump??

14:09:21.779 -> 3fffff50:  3fffffb0 00000000 00000009 4010f522  
14:09:21.779 -> 3fffff60:  7f10cbfc ffffffff 00000000 3ab88265  
14:09:21.779 -> 3fffff70:  f084f8af bdb2241d f5aa7732 3bb0d68e  
14:09:21.779 -> 3fffff80:  09338cc1 79d7841c 86ec9b4a aa5b8eaf  
14:09:21.779 -> 3fffff90:  85da9275 894857b0 fcabde68 3908a42d  
14:09:21.779 -> 3fffffa0:  c41204cb 24acf0a5 ab0ea403 c3b98b44  
14:09:21.779 -> <<<stack<<<
14:09:21.779 -> 
14:09:21.779 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
14:09:21.779 -> 
14:09:21.779 ->  ets Jan  8 2013,rst cause:2, boot mode:(3,0)
14:09:21.779 -> 
14:09:21.779 -> load 0x4010f000, len 3460, room 16 
14:09:21.779 -> tail 4
14:09:21.779 -> chksum 0xcc
14:09:21.779 -> load 0x3fff20b8, len 40, room 4 
14:09:21.779 -> tail 4
14:09:21.779 -> chksum 0xc9
14:09:21.779 -> csum 0xc9
14:09:21.779 -> v0004afd0
14:09:21.779 -> ~ld
14:09:22.140 -> 
14:09:22.187 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
14:09:22.187 -> 
14:09:22.187 -> Exception (0):
14:09:22.187 -> epc1=0x4023b458 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000004e depc=0x00000000
14:09:22.187 -> 
14:09:22.187 -> >>>stack>>>
14:09:22.187 -> 
14:09:22.187 -> ctx: sys
14:09:22.187 -> sp: 3fffe6c0 end: 3fffffb0 offset: 0190
14:09:22.187 -> 3fffe850:  40105608 40105605 00000000 00000000  
14:09:22.187 -> 3fffe860:  400005e1 00000000 00000000 00000000  
14:09:22.187 -> 3fffe870:  4022fcbf 00000030 00000020 00000000  
14:09:22.187 -> 3fffe880:  0000004e 3ffe908e 000000ef 00000015  
14:09:22.187 -> 3fffe890:  0000004a 0300157c 0100157c 00000004  

Hi @oldpcguy

It is possible you might experience problems with the very high baud rates like 1000000, but any of the more conservative baud rates like the 115200 you are using in your sketch should be just fine.

The important thing is to make sure the baud rate menu at the top right corner of the Arduino IDE Serial Monitor is set to the same baud rate as the baud rate configured via the Serial.begin call in your sketch:

Is the menu in Serial Monitor set to 115200?

You have a bug in your code.

Do a search for the ESP exception decoder and install it. To my knowledge it does not (yet) work with IDE2.0. You can install IDE 1.8.19 and install the exception decoder in there.

Interesting. My code example is one that appears to run fine on my ESP-01. The screen dump only occurred in the serial monitor after unplugging the FTDI basic a couple times, probably not recommended.

The baud rates match code and the serial monitor. Is there something in a firewall or antivirus that could block the serial communication?

I came across an older post that said ESP-01 serial out was best set to 9600. That seems to be the fix.

void setup(){
  // Serial port for debugging purposes
//  Serial.begin(115200);
  Serial.begin(9600);
  dht.begin();

Question, If I set Serial to 9600 does that mean the DHT sensor also will run at 9600 or does it initialize at a default i2c value?

No. The library that you use implements its own timing.

No. It's not an I2C device.

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