Solved: I added a pull down to GPIO2 and GPIO12 (explained in the comments

fastled-support
gplus
(Marc MERLIN) #1

Solved: I added a pull down to GPIO2 and GPIO12 (explained in the comments below) and that allowed proper reflashing and reboots.

Question:
ESP32 and level shifting question for @Sam_Guyer @Yves_BAZIN
I picked up this esp32-dev clone,: https://github.com/Nicholas3388/LuaNode
. My program works fine with it, but when I power through 5V (via USB or external 5V), and use the 3.3V to connect to a level shifter https://www.ezsbc.com/index.php/products/ls1.html , every time I reboot, the program in flash is lost

ets Jun  8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 

Is it a bad clone that corrupts its flash if you connect something to the 3.3V output, or could it be another problem?
For such a level shifter to work, I do have to connect its High pin to the 5V going to the ESP32, and I kind of have to use the 3.3V output of the ESP32 to connect to the Low pin of that level shifter, correct?
Sadly when I do this, I can’t even flash anything to it until I unplug the 3.3V wire.

(Yves BAZIN) #2

@Marc_MERLIN indeed that seems correct. VHi to 5v and Vlo to 3.3.
But this board is working with transistors

  1. it draws current not sure the 3.3v of your esp can deliver current at will

But if you can’t plug anything to the 3.3V and you want to use level shifter unidirectional just use 74hc245 it’s small really cheap and you need only to plug 5v

(Mike Thornbury) #3

I never bother with level shifting from ESPs. Once you’ve passed to the first led in the string, they all talk onwards at 5v. If the first led can discern the commands at 3.3v, you’re good to go. I’ve never had one that didn’t work.

(PaulStoffregen) #4

Those mosfet-based level shifters are far too slow for addressable LED data.

(Marc MERLIN) #5

@Mike_Thornbury Yves Bazin’s 16 way output on ESP32 has a signal that just isn’t good enough for 3.3V output. @Sam_Guyer 's driver does work at 3.3V, but had a few occasional glitches likely due to cross talk between wires when using parallel output.
@PaulStoffregen the level shifter I just gave seems to work fine for WS2812B, but warning duly noted, thanks.

(Marc MERLIN) #6

@Yves_BAZIN did you mean to post here? Someone just pointed me to https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection which may be my problem because my level shifter is bidirectional and may be pulling some pins in the wrong direction during boot.
I’m going to try some pull down resistors now

(Yves BAZIN) #7

@Marc_MERLIN ah Oki. Otherwise just get some hc245.
Happy to know that my driver works well now with the level shifter

(Sam Guyer) #8

I have not found that level-shifting makes a big difference in my ESP-based projects. As others have pointed out, if the first LED gets a decent signal, the rest of the strip should be fine. Then again, I’ve been having problems that I can’t solve! :wink:

(Marc MERLIN) #9

@Sam_Guyer while you were away, @Yves_BAZIN and I figured out that your ESP32 driver works reliably on my 64x64 matrix, while his driver does not work reliably enough, unless I use a level shifter (you probably deleted all the + mentions when you came back :slight_smile: ).
The problem here may not the distance to the first LED, which is barely 2 meters, but the parallel output and cross talk between the signals, even on twisted pair I guess. I’m also guessing that your driver, even with 16 way output (which I tested to work), uses the RMT driver 8 lines at a time and RMT probably outputs a longer/cleaner signal than Yves’ software signal, allowing yours to work at 3.3V while Yves’ does not.

(Marc MERLIN) #10

Problem solved thanks to https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection . Because my level shifter was bidirectional, I had to put a pull down to GPIO2 (required for flashing to work) and GPIO12 (without which flash can default to 1.8V and cause corruption)
Now that I have both pull downs, I can reflash remotely and power cycle without issues.

(Marc MERLIN) #11

Looks like you can also solve this issue with
components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V
as per https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio12

(Sam Guyer) #12

@Marc_MERLIN It’s funny, I somehow missed notifications for a lot of those mentions. Not sure what’s up with that.

Glad you fixed your problem! One thing I noticed when I first starting working on the ESP32 driver is that the timing numbers that FastLED uses for WS2812s is kind of aggressive. Most of the examples I saw online used timing numbers that might allow a wider range of tolerances.

I might try tweaking the numbers manually to see if that makes any difference for my problems.

(Marc MERLIN) #13

@Sam_Guyer no worries for the notifications, I figured that after you had missed over 10 of them you were on vacation :wink:
As for your driver, your timings are actually quite good, your driver had 99% correct output with 16 lines, at 3.3V while Yves’ driver was pretty unstable until I boosted the output to 5V. I’m assuming his timing is more aggressive and with borderline signalling at 3.3V the output signal wasn’t good enough to work reliably anymore.

(Sam Guyer) #14

@Marc_MERLIN That’s great to know! I had wondered how accurate the output was from the RMT device, but I don’t have a way to check.

I was not on vacation, but my brain was. :wink:

(Yves BAZIN) #15

@Sam_Guyer I am gonna look at your timing and try to apply it too to see if it makes a difference.
@Marc_MERLIN thank you for trying also my fork it helped a lot on trying to debug it and now give some advice too. As I never tried it on 3.3v but only with a level shifter.