Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Huzzah32-ESP32 Breakout, Serial.read() always returns 0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Sun Jun 30, 2019 2:59 am

Hello

I just bought a Huzzah32-ESP32 breakout board, and experience the wired issue that Serial.read() always returns 0.

I could not find anything on the web. I also should mention that I'm anything than a beginner.

I'm clueless. I can't imagine what sort of hardware fault could produce the described behavior, but also can't imagine what could be wrong with the settings or used sketch.

I tend to conclude that the board is flawed and that I should return it, but wanted to first double check here to ensure that I haven't just overlooked a simple thing and that the issue isn't on my side :).

Many thx in advance, Olli

Details:

The board is a Adafruit HUZZAH32-EPS32 Breakout and has the markings XML-2 E315391 94V-0 15 19

I've installed all latest required Arduino packages, and did the installs for the Huzzah32 as described on the Adafruit page. The blink sketch provided there works fine.

I can upload the sketches, which I take as an proof that all my wiring and external electronics (USB-TTL adapter, etc) is all fine. It especially proofs that the communication from the USB-TTL adapters's Tx pin to the Huzzah's Rx pin, relevant to Serial.read(), is working fine!

The board is powered from an external stabilized 5V linear regulator source which can provide 1A, and to rule out power issues I also used a 2S lipo discharged to 6V as well as a regulated bench source, with identical observations.

Serial.print() works as expected, i.e., I can see it's output in a terminal (even for more complicated outputs than in the test sketch below). But Serial.read() always returns 0x00.

The code is as simple as this:
Code: Select all | TOGGLE FULL SIZE
void setup()
{
  Serial.begin(115200);
  Serial.println("Hello");
}

void loop()
{
  if (Serial.available() > 0) {
    char c = Serial.read();
    Serial.print(c);
  }
}

This code (of course) works perfectly with any other Arduino-supported board I have.

In the Arduino IDE the settings are "Board: Adafruit ESP Feather", "Flash Frequency: 80MHz". I've tested "Upload Speed: 921000" and 115200, both with identical observations.

At startup of the board I see this printout in the terminal:
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c

Hello


???

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by adafruit_support_carter on Mon Jul 01, 2019 1:45 pm

In the Arduino IDE the settings are "Board: Adafruit ESP Feather"

Just to make sure, do you mean Adafruit ESP32 Feather?

What USB-TTL adapter are you using?

adafruit_support_carter
 
Posts: 16833
Joined: Tue Nov 29, 2016 2:45 pm

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Tue Jul 02, 2019 10:26 am

many thx for responding!

no, it's the Adafruit Huzzah32-ESP32 breakout board, https://www.adafruit.com/product/4172, the "pared down ... Feather ESP32"

What USB-TTL adapter are you using?


interesting thought, the output resistances indeed sometimes are a problem ...

I have several at my disposal, here I've used one with a CP2102 ... from the fact that the flashing of the firmware works without any issues I concluded that there shouldn't be a problem with it

you suggest to try one with a FTDI chip? (I typically have more issues with it than with the CP2102)

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Wed Jul 03, 2019 2:26 am

I've tried now a couple of different USB-TTL adapters, some with FTDI chip among them. I also tried to keep the wiring as short as possible. With all the same observation: I can upgrade the firmware, and I see the data send from the HUZZAAH32 (Tx pin), but read (Rx pin) gives 0's all time.

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by adafruit_support_carter on Wed Jul 03, 2019 1:27 pm

I've generally repeated this issue. Really odd since TX/RX must be working to even program the board. And the basic serial read example works as expected on a Feather ESP32, which is nominally the same hardware chain - USB -> CP2104 -> ESP32.

Will try and investigate.

adafruit_support_carter
 
Posts: 16833
Joined: Tue Nov 29, 2016 2:45 pm

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Wed Jul 03, 2019 6:49 pm

so you can reproduce the issue
that's great, should help to identify/resolve it

I'm not sure what I should do now. I was thinking about returning the board/asking for a replacement, assuming a fault with it, but since you see that too a new board wouldn't help, right.

yeah, that's the mystery, why it's possible to flash, but read() doesn't work

one would think that this points to a software issue, e.g. some bug in the serial library. However since it works on other ESP32's one would think that it' not a software but a hardware issue ...

I unfortunately don't have a feather ESP32, so can't test and compare myself, but what I would do is to flash both the feather ESP32 and the ESP32 breakout board with one and exactly the same firmware binary (i.e. not a compile and flash as with the Arduino IDE). If the feather when works but the breakout doesn't I think one would have proven that it has to be some hardware issue, and not a software issue.

I couldn't find a electronic sketch of the ESP32 breakout board, only of the feather ESP32. Is it available somewhere, would you have a link?

many thanks for looking deeper at this!
I would be really eager to use this board in my project(s), it would be a great little piece

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by adafruit_support_carter on Wed Jul 03, 2019 6:52 pm


adafruit_support_carter
 
Posts: 16833
Joined: Tue Nov 29, 2016 2:45 pm

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Thu Jul 04, 2019 1:04 am

ohhhh ... how could I not find it ...
many thanks!

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Thu Jul 04, 2019 1:17 am

so, I bet diode D2 is the problem
1. it's not on the feather ESP32, so the two boards are in fact not identical hardware-wise
2. if it's really a 1n4148 it really wouldn't have been a good choice for the purpose anyhow
3. maybe the real board is not even populated with an 1n4148 but with a whatever-diode-was-around diode...
I'll check this by bypassing the diode

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Thu Jul 04, 2019 2:48 am

ok, this is it ...

I first tested by connecting the USB-TTL adapter's Tx directly to the ESP32's Rx pin, bypassing the diode => works!

I then replaced the diode with a Schottky diode, a 1PS76SB40 which was the only of that size I had around => didn't work, admitedly to my surprise

I then soldered in back the original diode, and added a 1 k resistor from the ESP32's Rx pin to the 3.3V rail to strengthen the pullup (according to the datasheet the ESP32 only has a weak pullup) => works!

so, I think, one has to conclude that this is clearly a design mistake ... not sure how much that board was tested before production

this all doesn't explain why flashing works anyway, I guess one would have to dig deeper into the exact details of the EPS32's pins, there might be a subtle difference in boot mode and normal mode. But even without understanding this, I guess the conclusion is clear.

the diode was probably added as overvoltage protection. I think one needs to more carefully inspect the situation and redesign this part. The simplest option would be to remove the diode or solder in a 0R (which is what I'm going to do) as a hack, but I'm not sure that's a generally desirable option.

looking forward to hear your thoughts

:)

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Mon Jul 08, 2019 6:53 pm

no comment/response?

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by adafruit_support_carter on Wed Jul 10, 2019 8:00 pm

Good sleuthing and testing! I tried the diode bypass and got the same results - it works.

Thanks for all the testing and posting the info and results here. I'll pass all this on.

adafruit_support_carter
 
Posts: 16833
Joined: Tue Nov 29, 2016 2:45 pm

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by adafruit2 on Fri Jul 12, 2019 4:16 pm

thanks! good analysis - yeah there should be a 1K pullup on RX to 3.3V - it is really weird that you can program it, we did some testing but not that particular thing. we'll redesign to add the diode! for now you can just jumper RX.

adafruit2
Site Admin
 
Posts: 19353
Joined: Fri Mar 11, 2005 7:36 pm

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by olliw on Tue Jul 16, 2019 3:19 am

I really like these boards in general, and it would be great if fully functioning boards would be available to us asap
if this here would have helped to get there, fantastic :)
all the best

olliw
 
Posts: 9
Joined: Sat Jun 29, 2019 2:32 am

Re: Huzzah32-ESP32 Breakout, Serial.read() always returns 0

by jeremypoulter on Tue Sep 03, 2019 2:21 am

I too had this issue when 'porting' code that works fine on all other ESP32 boards. Unfortunately I did not find this article till I knew what the issue was.

As far as I understand the diode is used to make the Rx pin 5v safe. Luckily I had to do some research into how this all worked and noticed that they have a pull up that is not on the Huzzah-ESP32. It is really weird as the same technique is used on the ESP8266 Huzzah and that works fine. Anyway I added
Code: Select all | TOGGLE FULL SIZE
pinMode(3, INPUT_PULLUP)
after the
Code: Select all | TOGGLE FULL SIZE
Serial.begin
and that 'fixed' the issue for me.

jeremypoulter
 
Posts: 4
Joined: Mon Jun 29, 2015 2:02 pm

Please be positive and constructive with your questions and comments.