Firebeetle board esp32 with softwareserial

Hi, I have been working with the esp32 development board from Doit and the Wisol SFM10R1 module for sigfox communication. With this module I have not had any problem to make it work. Now I have tried to use an esp32 development board from the manufacturer Firebeetle and I am not able to get the softwareserial to work. I tried to use hardwareserial and got the following message on my console:
“Guru Meditation Error: Core 1 panic’ed (IllegalInstruction) Exception was unhandled.”

Any idea how to make it work? I’m shocked that it doesn’t work because the development boards are practically the same

Attached is the code I used on the manufacturer’s Doit development board

#include <SoftwareSerial.h>

#define RxNodePin 12
#define TxNodePin 13

uint8_t sigfoxMsg[12];
SoftwareSerial Sigfox(RxNodePin, TxNodePin);

void setup() {
Serial.begin(115200);
Sigfox.begin(9600);
delay(300);
Serial.print("Device ID: " + getID());
Serial.print("Device PAC Number: " + getPAC());
delay(100);
}

void loop() {
memcpy(sigfoxMsg, &temperatura, sizeof(temperatura));
sendMessage(mensajeSigfox, 8);
}

String getID () {
String deviceId = “”;
char sigfoxBuffer;
Sigfox.print(“AT$I=10\r”);
while (!Sigfox.available()){
delay(20);
}

while(Sigfox.available()){
sigfoxBuffer = Sigfox.read();
deviceId += sigfoxBuffer;
delay(20);
}
return deviceId;
}

String getPAC (){
String pacNumber = “”;
char sigfoxBuffer;

// to WISOL to GET PAC number
Sigfox.print(“AT$I=11\r”);
while (!Sigfox.available()){
delay(10);
}
while(Sigfox.available()){
sigfoxBuffer = Sigfox.read();
pacNumber += sigfoxBuffer;
delay(10);
}
return pacNumber;
}

String sendMessage(uint8_t sigfoxMsg, int bufferSize) {
String status = “”;
char sigfoxBuffer;

Sigfox.print(“AT$SF=”);
for(int i= 0;i<bufferSize;i++){

if (sigfoxMsg*<0x10) *

  • {*
  • Sigfox.print(“0”);*
  • }*
    _ Sigfox.print(String(sigfoxMsg*, HEX));_
    _
    }_
    _
    Sigfox.print("\r");_
    _
    while (!Sigfox.available()){_
    _
    delay(10);_
    _
    }_
    _
    while(Sigfox.available()){_
    _
    sigfoxBuffer = (char)Sigfox.read();_
    _
    status += sigfoxBuffer;_
    _
    delay(10);_
    _
    }_
    _
    return status;_
    _
    }_
    _
    [/quote]*_

There is no need to use SoftwareSerial on an ESP32, any hardware pin can be used with one of the three hardware serial interfaces.

As for your hardware you failed to provide links to the hardware used.

I'm using this developed board. I don't know in this board wich is the hardware serial.

https://wiki.dfrobot.com/FireBeetle_Board-328P_with_BLE4.1_SKU__DFR0492

from the link you posted:

.

Yes, I see. In the code that I sent I used pin D0 and D1 (Pin 12 and 13) but I can't sent anything.

In the code that I sent I used pin D0 and D1 (Pin 12 and 13) but I can't sent anything.

Who told you that D0 and D1 are pins 12 and 13? According to the IDE's variant file for that board (firebeetle32):

static const uint8_t TX = 1;
static const uint8_t RX = 3;

it's completely different.

or is this


your board?

Notice the 2 boards are different, one is a ESP32 and the other is not. I ask because the link you provided does not go to a ESP32. Thus, I'd link to confirm that you do indeed have a ESP32 Firebettle.

Reason is that the ESP32 has a programmable GPIO pin matrix and comes with 3 UARTS. Out of those 3 UARTS you can use 2, for now.

So, do you really have a ESP32 and if you do, I can show code on how to use 2 of the UARTS, even show the setting of the GPIO pin matrix to use non-default pins.

#include <HardwareSerial.h>

// pin =RX, pin =TX
HardwareSerial GPSSerial ( 1 );
// pin 2=RX, pin 15=TX
HardwareSerial LIDARSerial ( 2 );
// pin 26=RX, pin 25=TX

void setup()
{
 LIDARSerial.begin ( SerialDataBits, SERIAL_8N1, 26, 25 );
  GPSSerial.begin ( GPS_DataBits, SERIAL_8N1, 2, 15 ); // begin GPS hardware serial
}

Here is the code to use the serial port

void fGPS_Parse(  void *pvParameters )
{
  // int iBit = 1;
  for (;;)
  {
    xEventGroupWaitBits (eg, evtGPS_Parse, pdTRUE, pdTRUE, portMAX_DELAY) ;
    if ( xSemaphoreTake( sema_GPS_Gate, xTicksToWait0 ) == pdTRUE )
    {
      //query GPS: has a new complete chunk of data been received?
      if ( GPSSerial.available() > 1 )
      {
        if ( GPS.encode(GPSSerial.read()) )
        {
          if (  GPS.location.isValid())
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Lat = GPS.location.lat();// store data into structure
              xPosit.Lon = GPS.location.lng();
              xSemaphoreGive( sema_Posit );
            }
          } // if (  GPS.location.isValid())
          if (GPS.speed.isValid())
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.MPH = GPS.speed.mph();
              xPosit.KPH = GPS.speed.kmph();
              xSemaphoreGive( sema_Posit );
            }
          } //  if (GPS.speed.isValid())
          if (GPS.time.isValid())
          {
            if ( xSemaphoreTake( sema_Time, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xTime.iSeconds = GPS.time.second();
              xTime.iMinutes = GPS.time.minute();
              xTime.iHours = GPS.time.hour();
              xSemaphoreGive( sema_Time );
            }
          } // if (GPS.time.isValid())
          if (GPS.date.isValid())
          {
            if ( xSemaphoreTake( sema_Date, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xDate.iMonth = GPS.date. month();
              xDate.iDay = GPS.date.day();
              xDate.iYear = GPS.date.year();
              xSemaphoreGive( sema_Date );
            }
          } // if (GPS.date.isValid())
          if (  GPS.altitude.isValid() )
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Alti = GPS.altitude.meters();
              xSemaphoreGive( sema_Posit );
            }
          } //  if (  GPS.altitude.isValid() )
          if ( GPS.course.isUpdated() )
          {
            if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
            {
              xPosit.Hdg = GPS.course.deg();
              xSemaphoreGive( sema_Posit );
            }
          } // if ( GPS.course.isUpdated() )
          if ( xSemaphoreTake( sema_Posit, xSemaphoreTicksToWait ) == pdTRUE )
          {
            xQueueOverwrite( xQ_Posit, (void *) &xPosit );
            xSemaphoreGive( sema_Posit );
          }
        } // if ( GPS.encode(GPSSerial.read()))
      } // if ( GPSSerial.available() > 0 )
      xSemaphoreGive( sema_GPS_Gate );
    }
  } // for (;;)
  vTaskDelete( NULL );
} // void fGPS_Parse(  void *pvParameters )

The code for the other serial port which uses my more generic ESP32 serial code.

void fReceiveSerial_LIDAR( void * parameters  )
{
  bool BeginSentence = false;
  char OneChar;
  char *str;
  str = (char *)ps_calloc(300, sizeof(char) ); // put str buffer into PSRAM
  // log_i("Free PSRAM before String: %d", ESP.getFreePsram());
  for ( ;; )
  {
    EventBits_t xbit = xEventGroupWaitBits (eg, evtReceiveSerial_LIDAR, pdTRUE, pdTRUE, portMAX_DELAY);
    if ( LIDARSerial.available() >= 1 )
    {
      while ( LIDARSerial.available() )
      {
        OneChar = LIDARSerial.read();
        if ( BeginSentence )
        {
          if ( OneChar == '>')
          {
            if ( xSemaphoreTake( sema_ParseLIDAR_ReceivedSerial, xSemaphoreTicksToWait10 ) == pdTRUE )
            {
               xQueueOverwrite( xQ_LIDAR_Display_INFO, ( void * ) &str );
              xEventGroupSetBits( eg, evtParseLIDAR_ReceivedSerial );
              //
            }
            BeginSentence = false;
            break;
          }
          strncat( str, &OneChar, 1 );
        }
        else
        {
          if ( OneChar == '<' )
          {
            strcpy( str, ""); // clear string buffer
            BeginSentence = true; // found beginning of sentence
          }
        }
      } //  while ( LIDARSerial.available() )
    } //if ( LIDARSerial.available() >= 1 )
    xSemaphoreGive( sema_ReceiveSerial_LIDAR );
    //        log_i( "fReceiveSerial_LIDAR " );
    //        log_i(uxTaskGetStackHighWaterMark( NULL ));
  }
  free(str);
  vTaskDelete( NULL );
} //void fParseSerial( void * parameters  )

As a note the ESP32 does not work well using if ( LIDARSerial.available() > 0 ), note the zero, a more common usage but has caused me issues with the ESP32. I found that using if ( LIDARSerial.available() >= 1 ) does not cause issues.

Idahowalker this is my board

Is it really an esp32?

cbproyectos:
Idahowalker this is my board

Is it really an esp32?

Yes, it is a ESP32. Now you should find the link to the spec sheet for the board you are using and check that you've wired it up correctly.

And I posted the code of how to use serial with an ESP32.

Again, good luck.