Unresponsive modem on SFF 412M

I recently received a pair of Sodaq SFF 412M boards and cannot get reliable responses from the UBlox modem.

Sometimes after many resets/power cycles, software installs it will suddenly start responding.
Then the next day nothing.

The last time I had it running I was able to verify that the UBlox firmware is the most recent.
The battery is connected.
I have tried the sample passthrough code built on both Arduino Studio and VC/PlatformIO with no consistent results from either.

If I solder on a USB connection for direct modem commands will that void any warranty?
With the USB connection to pins 1-4 should I be able to directly issue AT commands to the modem or is it only for flash upgrades?

Any help would be greatly appreciated.

Below is the code I am currently using with VC/PlatformIO
#include <Arduino.h>

#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1

unsigned long baud = 115200; //start at 115200 allow the USB port to change the Baudrate

void sendCommand(const char* command) {
size_t sent = MODEM_STREAM.println(command);
if (sent < strlen(command)) {
DEBUG_STREAM.println(“Error writing to modem”);
}
MODEM_STREAM.write("\r\n");
MODEM_STREAM.flush();
DEBUG_STREAM.println(MODEM_STREAM.readString());
}

void setup()
{
delay(5000);
// Turn the power to the SARA module on.
// we have a powerswitch on board to switch the power to the SARA on/of when needed
// in most applications we keep the power on all the time
pinMode(SARA_ENABLE, OUTPUT);
digitalWrite(SARA_ENABLE, HIGH);

// Turn the nb-iot module on
// The R4XX module has an on/off pin. You can toggle this pin or keep it low to
// switch on the module
pinMode(SARA_R4XX_TOGGLE, OUTPUT);
digitalWrite(SARA_R4XX_TOGGLE, LOW);
delay(80);
pinMode(SARA_R4XX_TOGGLE, INPUT);
delay(500);

// Start communication
DEBUG_STREAM.begin(baud);
MODEM_STREAM.begin(baud);
delay(500);

DEBUG_STREAM.println(“Info”);
sendCommand(“ATI”);

DEBUG_STREAM.println(“Set enxtended error codes”);
sendCommand(“AT+CMEE=2”);

DEBUG_STREAM.println(“Disable Power Saving Mode”);
sendCommand(“AT+CPSMS=0”);

DEBUG_STREAM.println(“Disable EDRX”);
sendCommand(“AT+CEDRXS=0”);

DEBUG_STREAM.println(“Disable Power Saving Control”);
sendCommand(“AT+UPSV=0”);

DEBUG_STREAM.println(“Check Antena”);
sendCommand(“AT+UANTR=0”);

delay(500);

while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}

DEBUG_STREAM.println(“Setup Complete”);
}

// Forward every message to the other serial
void loop()
{
while (DEBUG_STREAM.available())
{
MODEM_STREAM.write(DEBUG_STREAM.read());
}

while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}

// check if the USB virtual serial wants a new baud rate
// This will be used by the UEUpdater to flash new software
if (DEBUG_STREAM.baud() != baud) {
baud = DEBUG_STREAM.baud();
MODEM_STREAM.begin(baud);
}
}

I found that using the r4x library my modem starts up und responds reliably with the following code:

#include <Arduino.h>
#include <Sodaq_R4X.h>
#define ARDUINO_SODAQ_SFF 1

#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1

unsigned long baud = 115200; //start at 115200 allow the USB port to change the Baudrate

static Sodaq_R4X r4x;
static Sodaq_SARA_R4XX_OnOff saraR4xxOnOff;
static bool isReady;

void sendCommand(const char* command) {
size_t sent = MODEM_STREAM.println(command);
if (sent < strlen(command)) {
DEBUG_STREAM.println(“Error writing to modem”);
}
MODEM_STREAM.write("\r\n");
MODEM_STREAM.flush();
DEBUG_STREAM.println(MODEM_STREAM.readString());
}

void setup()
{
while ((!DEBUG_STREAM) && (millis() < 10000)){
// Wait max 10 sec for the CONSOLE_STREAM to open
}

delay(5000);

// Start communication
DEBUG_STREAM.begin(baud);
MODEM_STREAM.begin(r4x.getDefaultBaudrate());
delay(500);

r4x.setDiag(DEBUG_STREAM);
//r4x.setRadioActive(true);
//r4x.setVerboseErrors(true);
r4x.init(&saraR4xxOnOff, MODEM_STREAM);
DEBUG_STREAM.println(r4x.on() ? “Modem is on” : “Modem is off”);

DEBUG_STREAM.print("Getting the Firmware Version : ");
char fwv[200];
memset(fwv, 0, sizeof(fwv));
r4x.getFirmwareVersion(fwv, sizeof(fwv));
DEBUG_STREAM.println(fwv);

DEBUG_STREAM.println(“Info”);
sendCommand(“ATI”);

DEBUG_STREAM.println(“Set enxtended error codes”);
sendCommand(“AT+CMEE=2”);

DEBUG_STREAM.println(“Disable Power Saving Mode”);
sendCommand(“AT+CPSMS=0”);

DEBUG_STREAM.println(“Disable EDRX”);
sendCommand(“AT+CEDRXS=0”);

DEBUG_STREAM.println(“Disable Power Saving Control”);
sendCommand(“AT+UPSV=0”);

DEBUG_STREAM.println(“Check Antena”);
sendCommand(“AT+UANTR=0”);

delay(500);

while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}

DEBUG_STREAM.println(“Setup Complete”);
}

// Forward every message to the other serial
void loop()
{
while (DEBUG_STREAM.available())
{
MODEM_STREAM.write(DEBUG_STREAM.read());
}

while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}

// check if the USB virtual serial wants a new baud rate
// This will be used by the UEUpdater to flash new software
if (DEBUG_STREAM.baud() != baud) {
baud = DEBUG_STREAM.baud();
MODEM_STREAM.begin(baud);
}
}