Artemis as a peripheral for connecting with ESP32.

Hello, I am currently working on a project that requires connection via GNSS/Iridium and WiFi. For this, I am using an ESP32-S3 together with SparkFun’s “Artemis Global Tracker” (AGT). When buying the AGT, I was hoping that I could use it as a peripheral (“slave”) and the ESP32 as the master. However, this does not seem to be straightforward. In the GitHub repo, it looks like I2C and SPI only work if the Artemis Apollo3 is the master. However, in the datasheet for the Apollo3 microcontroller, it seems like I2C/SPI could be used as a slave. My question is, is it possible to implement this somehow so it works in Arduino IDE, since a lot of the example code for GNSS/Iridium is already written there? If not, how would I connect these two boards (AGT and ESP32)? I have thought about UART, but it seems like one of the two is connected to the Iridium module while the other one is used for the USB-C port for bootloading. Could I use the UART that is used for bootloading after the booting is done? BLE is also a possibility, but this would require turning off the WiFi on the ESP32 during BLE use. What seems most reasonable: I2C/SPI, UART, or BLE, and how should I proceed?

It’s possible to use the ESP32-S3 as the I2C/SPI master and the Artemis Apollo3 microcontroller on the AGT as the slave, but it would require some custom code and configuration…

## I2C/SPI Implementation

The Artemis Apollo3 microcontroller supports both I2C and SPI slave modes, as mentioned in the datasheet. However, the SparkFun AGT board and its accompanying libraries are designed to use the Apollo3 as the master by default.

To use the ESP32-S3 as the master, you would need to modify the AGT firmware to configure the Apollo3 as an I2C/SPI slave and implement the necessary communication protocol. This may involve writing custom code or modifying the existing

SparkFun libraries

## UART Option

Using UART for communication between the ESP32-S3 and the AGT is a viable option. The Apollo3 microcontroller has multiple UART interfaces, and one of them is likely available for this purpose. You can use the UART interface that is not connected to the Iridium module or the USB-C port for bootloading. However, you need to ensure that the UART interface you choose is not already in use by other peripherals or functions on the AGT board. To use the UART interface after bootloading, you may need to modify the AGT firmware to enable the UART communication after the initial bootloading process is complete.

## BLE Option

Using Bluetooth Low Energy (BLE) for communication between the ESP32-S3 and the AGT is also possible, but has some limitations and trade-offs. The ESP32-S3 supports BLE, and you can use it to establish a BLE connection with the AGT board. However, as you mentioned, using BLE on the ESP32-S3 may require disabling the WiFi functionality during BLE operation, which could be a limitation depending on your project requirements. Additionally, BLE has a lower data rate compared to other communication interfaces like UART or SPI, which may be a consideration if you need to transfer large data

## Recommendation

Using UART for communication between the ESP32-S3 and the AGT seems to be the most reasonable option. It offers a relatively simple and reliable communication interface, and you can potentially use an available UART interface on the AGT board without interfering with the Iridium module or the bootloading process.

To proceed with the UART option, you would need to:

  1. Identify an available UART interface on the AGT board that is not already in use.

  2. Modify the AGT firmware to enable and configure the UART interface for communication after bootloading.

  3. Implement the necessary UART communication protocol on both the ESP32-S3 and the AGT firmware.

  4. Establish the UART connection between the two boards and exchange data as required by your project.

Here is some example code to implement from an AI model (so there may be bugs!)

// ESP32-S3 code
#include <HardwareSerial.h>

HardwareSerial mySerial(1); // Use UART1

void setup() {
  mySerial.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN); // Adjust RX_PIN and TX_PIN
  Serial.begin(115200); // Debugging
}

void loop() {
  if (mySerial.available()) {
    String data = mySerial.readStringUntil('\n');
    Serial.println("Received from AGT: " + data);
  }
  // Add code to send data to AGT if needed
}
// AGT code
#include <Wire.h>

void setup() {
  Serial.begin(115200);
  // Wait for serial port to connect.
  while (!Serial);
}

void loop() {
  if (Serial.available()) {
    String data = Serial.readStringUntil('\n');
    Serial.println("Received from ESP32: " + data);
  }
  // Add code to send data to ESP32 if needed
}

If you encounter any issues or limitations with the UART approach, you can consider exploring the I2C/SPI or BLE options further, but they may require more extensive firmware modifications and custom code development