I tried to find a workaround for this SoftwareSerial issue by dynamically creating & destroying instances via new & delete. However, after a few cycles the board stalls, i.e. no life-beat and manual reset required. Seems like the destructor does not release all required resources.
Here is a sketch to reproduce the error:
#include <SoftwareSerial.h>
SoftwareSerial *SoftSerial;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
SoftSerial = new SoftwareSerial(0, 1); // Rx, Tx
SoftSerial->begin(9600);
SoftSerial->write(0x55);
delete(SoftSerial);
SoftSerial = new SoftwareSerial(0, 1); // Rx, Tx
SoftSerial->begin(19200);
SoftSerial->write(0x55);
delete(SoftSerial);
delay(500);
}
I tried to find a workaround for this SoftwareSerial issue by dynamically creating & destroying instances via new & delete. However, after a few cycles the board stalls, i.e. no life-beat and manual reset required. Seems like the destructor does not release all required resources.
Here is a sketch to reproduce the error: