Code won't run on DFRobot Beetle ESP32

I’m using this board
(Actually I’m using V1.0 of that board)

When I compile the source with Arduino and launcht it from there it works fine.
When I take the same sourcecode to PlatformIO and compile it there, I don’t get errors, but the board does nothing. What coulde be going wrong?

Source: (only change is the added ‘#include <Arduino.h>’ line

//========================================================================        
// Includes                                                                       
//========================================================================        
                                                                                  
#include <Arduino.h>    

#include <OneWire.h>
#include <DallasTemperature.h>

OneWire oneWire( D4 ); 
DallasTemperature sensors( &oneWire );

void setup() 
{
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // initialize Dallas
  pinMode( D7, OUTPUT );  
  pinMode( D4, INPUT_PULLUP );  
  pinMode( D3, OUTPUT );  

  digitalWrite( D7, LOW );
  digitalWrite( D3, HIGH );

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // initialize LED
  pinMode( LED_BUILTIN, OUTPUT );     

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Serial
  Serial.begin( 115200 );
  while( !Serial ) 
  {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() 
{
  float temp;
  
  // put your main code here, to run repeatedly:
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

  sensors.requestTemperatures(); // Send the command to get temperature readings
  temp = sensors.getTempCByIndex(0);
  Serial.println(temp);
}

Here’s my platformio.ini file:

; 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
; https://docs.platformio.org/page/projectconf.html

[env:beetle]
platform = espressif32
board = firebeetle32
framework = arduino
lib_deps = 
	knolleary/PubSubClient@^2.8
	bblanchon/ArduinoJson@^6.20.1
	paulstoffregen/OneWire@^2.3.7
	milesburton/DallasTemperature@^3.11.0

Here are the settings for the project in Arduino
dfrobot_arduino

You’re missing monitor_speed = 115200 in your platformio.ini.

What version of the Arduino-ESP32 core are you using in the Arduino IDE? (Tools->Board->Board Manager → esp32).

Changing the monitor speed helped me in seeing the following error repating in a fast way:


ELF file SHA256: 0000000000000000

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1b (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:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
E (181) spi_flash: Detected size(8192k) smaller than the size in the binary image header(16384k). Probe failed.

assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)


Backtrace:0x40083535:0x3ffe3aa00x40088069:0x3ffe3ac0 0x4008d18d:0x3ffe3ae0 0x400dbe72:0x3ffe3c10 0x40082c36:0x3ffe3c40 0x400792ba:0x3ffe3c90  |<-CORRUPTED

The ESP32 version in Arduino is 2.0.6

PlatformIO’s definition of the firebeetle esp32 board is indeed 16Mbyte of flash

Please add

board_upload.flash_size = 8MB

to the platformio.ini and retry.

Thanks! That helped.

(The website also says 16MB by the way. Could it be that version 1.0 had 8MB? I can’t find any info about v1.0 anymore)