Program not working correctly on ESP32

I have a program that uses the BluetoothSerial library for the ESP32. The program looks for text input from text sent by a Bluetooth terminal running on a laptop. Once it receives text, it saves the text to a file, and then closes the file. Waits 6 seconds and opens the file and sends the file one character at a time via bluetooth to the laptop.

After the program starts it sets up the bluetooth radio for pairing. You then have to pair with the ESP32. Once this is done, you open the bluetooth terminal and then connect to the ESP32. Then you can send text to the ESP32.

When the ESP32 is programmed with the Arduino IDE, the program works fine. But if I program the ESP32 with VSCode and PlatformIO, the program doesn’t work correctly. The ESP32 does set up the bluetooth. And I can pair with the ESP32 with the laptop. But when I try to connect to the ESP32 with the bluetooth terminal, I get this message on the terminal monitor connected to the ESP32 serial port. So I can’t connect to the ESP32 with the bluetooth terminal.

ASSERT_WARN(103 23), in lc_task.c at line 8775ASSERT_WARN(103 24), in lc_task.c at line 8775

Any ideas?

What exact version of the ESP32 package do you have installed in the Arduino IDE board manager?

What’s the platformio.ini of the project?

I am experiencing the exact same issue. Have you managed to figure out what’s wrong with PlatformIO?

Do you have that info plus the exact code you’re running?

Hello Max! Thanks for replying.
My code:

#include <Arduino.h>
#include "BluetoothSerial.h"
#include <Wire.h>
#include "Adafruit_MPRLS.h"
// You dont *need* a reset and EOC pin for most uses, so we set to -1 and don't connect
#define RESET_PIN  -1  // set to any GPIO pin # to hard-reset on begin()
#define EOC_PIN    -1  // set to any GPIO pin to read end-of-conversion by pin
Adafruit_MPRLS mpr = Adafruit_MPRLS(RESET_PIN, EOC_PIN);
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
float pressure_start;
void setup() {
  Serial.begin(115200);
  Serial.println("MPRLS Simple Test");
  SerialBT.begin("ESP");
  if (! mpr.begin()) {
    Serial.println("Failed to communicate with MPRLS sensor, check wiring?");
    while (1) {
      delay(10);
    }
  }
  Serial.println("Found MPRLS sensor");
  pressure_start = mpr.readPressure();
}
void loop() {
  float pressure_hPa = (pressure_start - mpr.readPressure())*100;
  Serial.println(pressure_hPa);
  SerialBT.println(pressure_hPa);
  delay(100);
}

Reads from a pressure sensor and reports to serial. When compiled with the arduino IDE the bluetooth initiates just fine and shows up. With platformIO no such bluetooth device shows up.
I’ve completely switched to platformIO so I’m interested to find out why it behaves differently?

Thank you for your help.

P.S. my .ini:

[env:ttgo-lora32-v1]
platform = espressif32
board = ttgo-lora32-v1
framework = arduino
lib_deps = adafruit/Adafruit MPRLS Library@^1.1.0
monitor_speed = 115200

I had Espressif Systems version 1.0.4 installed in Arduino IDE.
I just updated to 1.0.6 and it still works with Arduino IDE.

My apologies, there was nothing wrong with PlatformIO and I was just being stupid (compiling a different code than the one I thought I was). It’s working now and thank god it was only one day wasted.

Thanks @maxgerhardt !