Hi, I'm plugging an ESP32 into an evaluation kit.
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
lib_deps = sparkfun/SparkFun Swarm Satellite Arduino Library@^1.1.10
monitor_speed = 115200
I have connected to the JTAG headers
![Captura de pantalla de 2023-02-20 00-28-40](https://user-images.githubusercontent.com/66859187/220003179-32dce32b-897c-4819-8455-e2eb5a457632.png)
1-I have downloaded the swarm library for arduino. But I can't connect to the hardwareSerial or SoftwareSerial. I have tried in various ways to make it work without success.
2- When executing a simple HardwareSerial code defining the baud and the pins (RX, TX). I can connect to the modem without problems and read the information returned by the eval kit. But even so, I do not receive a response from the commands sent by the serial2 port, since if I send a $FV*10 I do not get the expected response. I only see a $RT RSSI=XXX message every 5 seconds in the serial2.read()
`/*!
- @file Example5_GeospatialInformation.ino
- @mainpage SparkFun Swarm Satellite Arduino Library
- @section intro_sec Examples
- This example shows how to:
- Set the rate for the $GN geospatial information message
- Set up a callback for the $GN message
- Print the unsolicited geospatial information messages from the callback
- Want to support open source hardware? Buy a board from SparkFun!
- SparkX Swarm Serial Breakout : https://www.sparkfun.com/products/19236
- @section author Author
- This library was written by:
- Paul Clark
- SparkFun Electronics
- February 2022
- @section license License
- MIT: please see LICENSE.md for the full license information
*/
#include <SparkFun_Swarm_Satellite_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_Swarm_Satellite
SWARM_M138 mySwarm;
#define swarmSerial Serial2 // Use Serial1 to communicate with the modem. Change this if required.
void printGeospatial(const Swarm_M138_GeospatialData_t *info)
{
Serial.print(F("New geospatial information received: Lat: "));
Serial.print(info->lat, 4);
Serial.print(F(" Lon: "));
Serial.print(info->lon, 4);
Serial.print(F(" Alt: "));
Serial.print(info->alt, 2);
Serial.print(F(" Course: "));
Serial.print(info->course, 2);
Serial.print(F(" Speed: "));
Serial.println(info->speed, 2);
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void setup()
{
// Swarm Satellite Transceiver MicroMod Function Board PWR_EN
#ifdef swarmPowerEnablePin
pinMode(swarmPowerEnablePin, OUTPUT); // Enable modem power
digitalWrite(swarmPowerEnablePin, HIGH);
#endif
delay(1000);
Serial.begin(115200);
while (!Serial)
; // Wait for the user to open the Serial console
Serial.println(F("Swarm Satellite example"));
Serial.println();
//mySwarm.enableDebugging(); // Uncomment this line to enable debug messages on Serial
bool modemBegun = mySwarm.begin(swarmSerial); // Begin communication with the modem
while (!modemBegun) // If the begin failed, keep trying to begin communication with the modem
{
Serial.println(F("Could not communicate with the modem. It may still be booting..."));
delay(2000);
modemBegun = mySwarm.begin(swarmSerial);
}
// Just to prove it works, call getGeospatialInfo to request the most recent geospatial information
Swarm_M138_GeospatialData_t *info = new Swarm_M138_GeospatialData_t; // Allocate memory for the information
Swarm_M138_Error_e err = mySwarm.getGeospatialInfo(info);
while (err != SWARM_M138_SUCCESS)
{
Serial.print(F("Swarm communication error: "));
Serial.print((int)err);
Serial.print(F(" : "));
Serial.println(mySwarm.modemErrorString(err)); // Convert the error into printable text
Serial.println(F("The modem may not have acquired a valid GPS fix..."));
delay(2000);
err = mySwarm.getGeospatialInfo(info);
}
Serial.print(F("getGeospatialInfo returned: "));
Serial.print(info->lat, 4);
Serial.print(F(","));
Serial.print(info->lon, 4);
Serial.print(F(","));
Serial.print(info->alt);
Serial.print(F(","));
Serial.print(info->course);
Serial.print(F(","));
Serial.println(info->speed);
delete info; // Free the memory
// Set up the callback for the geospatial information message. Call printGeospatial when a new $GN message arrives
mySwarm.setGeospatialInfoCallback(&printGeospatial);
// Set the $GN message rate: send the message every 2 seconds
err = mySwarm.setGeospatialInfoRate(2);
if (err == SWARM_M138_SUCCESS)
{
Serial.println(F("setGeospatialInfoRate was successful"));
}
else
{
Serial.print(F("Swarm communication error: "));
Serial.print((int)err);
Serial.print(F(" : "));
Serial.print(mySwarm.modemErrorString(err)); // Convert the error into printable text
if (err == SWARM_M138_ERROR_ERR) // If we received a command error (ERR), print it
{
Serial.print(F(" : "));
Serial.print(mySwarm.commandError);
Serial.print(F(" : "));
Serial.println(mySwarm.commandErrorString((const char *)mySwarm.commandError));
}
else
Serial.println();
}
// Just to prove it works, call getGeospatialInfoRate to check the message rate
uint32_t rate;
mySwarm.getGeospatialInfoRate(&rate);
Serial.print(F("Message rate is "));
Serial.println(rate);
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void loop()
{
mySwarm.checkUnsolicitedMsg();
}`
Response
Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting... Could not communicate with the modem. It may still be booting...
Simple serial hardware code
`#include <HardwareSerial.h>
#define RXD2 16
#define TXD2 17
void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
}
void loop() {
while (Serial2.available()) {
Serial.print(char(Serial2.read()));
}
}`
Response
$RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d $RT RSSI=-110*1d
I send a $RT ?19 by Serial2.Println to stop the command from being sent by the modem. But the modem still sends me the response of $RT 513 (do you understand me??)
I followed the example of DHT20 sensor. But it didn't work for me.