Both the SARA-R5 and the nrf52840 MCU are inserted into a sparkfun Function Zero mainboard. Using Serial for console and Serial1 for the modem. In mySARA.begin(9600), the code never succeeds in connecting.
*** Debug ***
init: Begin module init.
init: Power cycling module.
sendCommandWithResponse: Command:
init: Begin module init.
init: Attempting autobaud connection to module.
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
init: Begin module init.
init: Power cycling module.
sendCommandWithResponse: Command:
init: Begin module init.
init: Attempting autobaud connection to module.
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
sendCommandWithResponse: Command: +IPR=9600
sendCommandWithResponse: Command:
init: Module failed to init. Exiting.
Unable to communicate with the SARA.
Manually power-on (hold the SARA On button for 3 seconds) on and try again.
sendCommandWithResponse: Command: +COPS?
**** Code ****
Serial.begin(115200); // Start the serial console
while (!Serial.available()) // Wait for the user to press a key (send any serial character);
while (Serial.available()) // Empty the serial RX buffer
Serial.read();
// Wait for user to press key to begin
Serial.println(F(“SARA-R5 Example”));
Serial.println(F(“Press any key to begin”));
mySARA.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
// For the MicroMod Asset Tracker, we need to invert the power pin so it pulls high instead of low
// Comment the next line if required
//mySARA.invertPowerPin(true);
// Initialize the SARA
if (mySARA.begin(saraSerial, 9600) )
{
Serial.println(F(“SARA-R5 connected!”));
}
else
{
Serial.println(F(“Unable to communicate with the SARA.”));
Serial.println(F(“Manually power-on (hold the SARA On button for 3 seconds) on and try again.”));
//while (1) ; // Loop forever on fail
}
Serial.println();
// First check to see if we’re already connected to an operator:
if (mySARA.getOperator(¤tOperator) == SARA_R5_SUCCESS) {
Serial.print(F("Already connected to: "));
Serial.println(currentOperator);
// If already connected provide the option to type y to connect to new operator
Serial.println(F(“Press y to connect to a new operator, or any other key to continue.\r\n”));
while (!Serial.available()) ;
if (Serial.read() != ‘y’)
{
newConnection = false;
}
else
{
mySARA.deregisterOperator(); // Deregister from the current operator so we can connect to a new one
}
while (Serial.available()) Serial.read();
}