ESP32, code uploaded from Arduino works, from pio works not

Hello,

As stated above, I try to upload the BasicOTA excample, wich works perfectly fine uploaded by Arduino, but the ESP32 fails with a BrownOutDetection failure and resets itself continuously.

Output from the serial terminal:

ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_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:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:9768
entry 0x400789b8
Booting
Wifi_STA

Brownout detector was triggered

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_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:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:9768
entry 0x400789b8
Booting
Wifi_STA

Brownout detector was triggered

And so on…

I noticed that Arduino uses the esptool.exe with the following flags:

C:\Users\<name>\Documents\Arduino\hardware\espressif\esp32/tools/esptool.exe --chip esp32 --port COM15 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_freq 80m --flash_mode dio --flash_size 4MB 0x1000 C:\Users\<name>\Documents\Arduino\hardware\espressif\esp32/tools/sdk/bin/bootloader.bin 0x8000 C:\Users\<name>~1\AppData\Local\Temp\arduino_build_717920/BasicOTA.ino.partitions.bin 0xe000 C:\Users\<name>\Documents\Arduino\hardware\espressif\esp32/tools/partitions/boot_app0.bin 0x10000 C:\Users\<name>~1\AppData\Local\Temp\arduino_build_717920/BasicOTA.ino.bin

and PlatformIO IDE uses esptool.py, but won’t show the arguments used there…
So I’m pretty confused right now and i can’t even find were to edit the flash command…

maybe anyone can help…

cad435

  1. Could you provide platformio.ini?
  2. Verbose mode can be enabled via pio run -t upload --verbose

Hello,

platformoi.ini:

; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; Redirecting...

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_baud = 115200

.

well, Im using the IDE and have not really a clue were to enter the commands…
I tried using the “PlatformIO:NewTerminal” option, but there I cant find a “pio” command…

nvm, found it out…
I guess you need theese lines from the verbose output:

Checking program size
text       data     bss     dec     hex filename
417113    74708   26808  518629   7e9e5 .pioenvs\esp32dev\firmware.elf
"c:\users\<name>\.platformio\penv\scripts\python.exe" "C:\Users\<name>\.platformio\packages\tool-esptoolpy@1.20000.0\esptool.py" --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4
MB -o .pioenvs\esp32dev\firmware.bin .pioenvs\esp32dev\firmware.elf
esptool.py v2.0-beta1
MethodWrapper(["upload"], [".pioenvs\esp32dev\firmware.bin"])
Auto-detected: COM15
"c:\users\<name>\.platformio\penv\scripts\python.exe" "C:\Users\<name>\.platformio\packages\framework-arduinoespressif32\tools\esptool.py" --before default_reset --after hard_reset --chip esp32 --port
 "COM15" --before default_reset --after hard_reset --baud 115200 write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 "C:\Users\<name>\.platformio\packages\framework-arduinoespress
if32\tools\sdk\bin\bootloader.bin" 0x8000 "E:\_DATEN\<name>\Projekte\Code\PlatformIO\ArduinoOTA_Test_ESP32\.pioenvs\esp32dev\partitions.bin" 0xe000 "C:\Users\<name>\.platformio\packages\framework-ardu
inoespressif32\tools\partitions\boot_app0.bin" 0x10000 .pioenvs\esp32dev\firmware.bin
esptool.py v2.1-beta1

Just surfed by… I had the same brownout detector problem.
The ESP32 draws a lot of power, check the voltage level on the 3V3 pin, My guess it’s your PSU is not good enough!
I was using a ESP32 Devkit V1 from doit.am and added an extra Volts in instead of relying on the USB Voltage. Your set up is probably different but you do need more power!

Hey there!

Yes, you are right, used my Lapbench PSU with 3.4V and it works…
So arduino SW must disable the BOD or setting the reset-voltage somehow lower, as with the “crappy” 5V voltageregulator, code from Arduino worked just fine all the time…
And I never observed the Voltage, because… Well, it worked just fine :smiley:
(And my sketches are always stable up to this point)

Anyone knows how to do so in PIO?