Utilizing ESP32-S3 USB-UART in tandem with UART0 for Notecard Comms

Hello, I am experiencing an issue which I wasn’t able to find a concrete answer for elsewhere. I have a custom carrier board which is using an esp32-s3 to talk to a notecard cell+wifi. I have connections for both UART and I2C to the notecard, and my PC is connected to the ESP32-S3 through its integrated USB. It appears that when I am programming+looking at serial monitor over USB while communicating with the notecard over USB, only one of these serial comms works. I am usually not able to see any output in the serial monitor. However, when the ESP talks to the notecard over I2C, I am able to view the serial monitor. I couldn’t find a concrete answer from espressif on whether or not the USB uart interface is the same as UART0, and thus only one instance can be used at a time, or if it is a software issue. Thank you!

Hi @fzizzo21 , and welcome to the Blues community!

Just to confirm, is your setup configured like this?

  • A USB connection between your PC and the ESP32-S3 (for flashing and serial monitoring).
  • A second USB connection between your PC and the Notecard (for interacting directly with the Notecard via USB).
  • UART and I2C lines between the ESP32-S3 and the Notecard.

And based on your description, the issue only occurs when the ESP32 communicates with the Notecard over UART, but things work fine when using I2C, is that correct?

If this is the case, then it may be that the UART peripheral used for Notecard communication is clashing with the one used for serial logging. The ESP32-S3 has a flexible peripheral mux, but depending on how your project is configured, it’s possible that the UART is being shared between logging and Notecard comms. That could explain why serial output disappears in one case but not the other.

To help confirm, could you let us know which ESP32-S3 variant you’re using? If you can share a link to the hardware docs or dev board page, we’ll take a look. We’re also happy to review your code and hardware if you’d like us to check your UART/I2C setup or logging configuration.

In the meantime, is there anything blocking you from continuing with I2C? If it’s working reliably, that might be the quickest path forward.

Thanks
Youssif

Hi Youssif,

It seems that I2C is functional, but I would like and prefer to get UART working. The ESP32-S3 variant I am using is a ESP32-S3-Wroom-1 module on a custom PCB carrier for the notecard. I am using UART0 for comms with the notecard. Once I am home later today I am able to share my code for further debugging, but is there anything you notice with this setup?

Thank you

Thanks @fzizzo21, yes please share your files when you get a chance. In the meantime I did some digging, and it does seem that UART0 is typically tied to the USB Serial/JTAG peripheral, which is what your PC uses for flashing and serial logging. This means if you’re also using UART0 for communication with the Notecard, the two may be contending for the same peripheral, resulting in the loss of serial output you’re seeing.

You can find more detail about this at the links below:

Once you’re able to share your hardware and code files, we can confirm this and check if it’s possible to change the configuration to somehow avoid this. If possible, it would also be helpful to see the design files for your custom Notecarrier PCB. Feel free to share your files via DM if you prefer, we can to take a closer look and suggest the best strategy based on your setup.

Thanks
Youssif

I am pasting my arduino code below. This current implementation does use I2C because UART wasn’t working, but the hooks are there for UART to see if there is any issues with the code. I am also attaching a picture of my carrier schematic.

// Combined and updated code to use ICM42688 motion detection
// and send motion events over a Notecard connected via I2C
// ESP32-S3 host MCU, dual I2C buses

#include <Wire.h>
#include <Notecard.h>
#include “ICM42688.h”

// ---------------------- I2C PIN DEFINITIONS ----------------------
// IMU on I2C bus 0
#define IMU_SDA 40
#define IMU_SCL 41

// Notecard on I2C bus 1
#define NOTECARD_SDA 34
#define NOTECARD_SCL 48
#define NOTECARD_I2C_ADDR 0x17
#define NOTECARD_I2C_SPEED 100000

// Product UID (replace with your UID)
#define PRODUCT_UID “com.gmail.thezizgaming:test_project”

// ---------------------- MOTION CONFIG ----------------------
const float AX_THRESHOLD = 0.2;
const unsigned long CHECK_INTERVAL = 100; // ms

// LED for motion indication
#define MOTION_LED 45

// ---------------------- OBJECT DECLARATIONS ----------------------
ICM42688 IMU(Wire, 0x68);
Notecard notecard;

float last_ax = 0.0;
unsigned long last_check_time = 0;

// ---------------------- SETUP ----------------------
void setup() {
pinMode(MOTION_LED, OUTPUT);
digitalWrite(MOTION_LED, LOW);

Serial.begin(115200);
delay(1000); // Allow time for USB CDC

// Init IMU on I2C0
Wire.begin(IMU_SDA, IMU_SCL);
Wire.setClock(400000);

if (IMU.begin() < 0) {
Serial.println(“:cross_mark: IMU initialization failed!”);
while (1);
}
Serial.println(“:white_check_mark: IMU initialized”);

// Init Notecard on I2C1
Wire1.begin(NOTECARD_SDA, NOTECARD_SCL);
Wire1.setClock(NOTECARD_I2C_SPEED);
notecard.begin(NOTECARD_I2C_ADDR, NOTECARD_I2C_SPEED, Wire1);
Serial.println(“:white_check_mark: Notecard I2C initialized”);

// Configure Notecard for minimum connection mode
J* req = NoteNewRequest(“hub.set”);
if (req) {
JAddStringToObject(req, “product”, PRODUCT_UID);
JAddStringToObject(req, “mode”, “minimum”);
JAddBoolToObject(req, “sync”, false);
NoteRequest(req);
Serial.println(“:white_check_mark: Notecard configured (minimum mode)”);
}

last_check_time = millis();
}

// ---------------------- LOOP ----------------------
void loop() {
unsigned long now = millis();

if (now - last_check_time >= CHECK_INTERVAL) {
last_check_time = now;

IMU.getAGT();
float current_ax = IMU.accX();
float delta = abs(current_ax - last_ax);

Serial.print("ax: ");
Serial.print(current_ax, 6);
Serial.print("  Δ: ");
Serial.println(delta, 6);

if (delta > AX_THRESHOLD) {
  Serial.println("🚨 Motion detected!");

  digitalWrite(MOTION_LED, HIGH);

  // Send note to Notehub with sync
  J* note = NoteNewRequest("note.add");
  if (note) {
    JAddStringToObject(note, "file", "motion.qo");
    JAddBoolToObject(note, "sync", true);

    J* body = JCreateObject();
    JAddStringToObject(body, "message", "device has moved");
    JAddNumberToObject(body, "delta_ax", delta);
    JAddItemToObject(note, "body", body);

    if (NoteRequest(note) != NULL) {
      Serial.println("✅ Note sent to Notehub");
    } else {
      Serial.println("❌ Failed to send note");
    }
  }

  delay(1000);
  digitalWrite(MOTION_LED, LOW);
}

last_ax = current_ax;

}
}