NMEA 2000 iPad Adapter


Confirmed—the PDF is faithfully exporting a schematic that is electrically valid but badly scattered and oversized, especially around the ESP32 symbol and isolated blocks. I’ll reorganize the schematic into compact functional sections without changing connectivity, verify it visually/ERC, then regenerate the PDF.
Thought for 1 min 58 sec
Thought for 27 sec
1/3 Reorganize schematic into readable functional blocks without changing connectivity

Reorganize schematic into readable functional blocks without changing connectivity

Verify schematic image and ERC after cleanup

Regenerate and provide schematic PDF

Thought for 25 sec
Created a thread
Schematic Reorganization
Completed
View Thread
Thought for 13 sec
Awaiting 1 background task
Received notification from "Schematic Reorganization" that it finished — picking the work back up.
Confirmed: the schematic is electrically ERC-clean, but its symbols are scattered over a very large canvas, so the PDF is mostly empty space and unreadably small.
I’m blocked from correcting it because schematic-position and wire-geometry editing is unavailable in this session. The schematic must first be compacted in the editor; after that, I can verify and regenerate the PDF. No electrical or PCB changes were made.
Arrange schematic blocks
Create SVG schematic
Review connector pinout

Waiting for input


Firmware Starter — ESP32-S3 NMEA 2000 Wi-Fi Listener
Platform & Toolchain
  • MCU/module: ESP32-S3-MINI-1-N8 (U1)
  • Framework: Arduino on PlatformIO, using ESP-IDF TWAI driver through Arduino core
  • Purpose: Receive NMEA 2000/CAN frames at 250 kbit/s and serve a local Wi-Fi web dashboard to an iPad.
  • Safety model: Rev A is hardware RX-only. ISO1050 TXD is pulled recessive by R5 and is not connected to an ESP32 TX GPIO.
Pin Mapping

Table


FunctionESP32-S3 pin/netSchematic connectionDirectionNotes
CAN RXGPIO18 / CAN_RXDU2:RXD -> U1:IO18InputReceives isolated CAN transceiver output
CAN TX placeholderGPIO17 / not connectedNo fitted schematic path to U2:TXDOutput unusedRequired by TWAI driver config; not connected to bus hardware
USB D-GPIO19 / USB_D_NJ1/D2 -> U1:IO19USBNative USB programming/debug
USB D+GPIO20 / USB_D_PJ1/D2 -> U1:IO20USBNative USB programming/debug
BOOTGPIO0 / ESP_BOOTPull-up R4, button S2 to GNDInputHold BOOT while resetting for bootloader if needed
EN / resetESP_ENPull-up R3, RC cap C4, button S1 to GNDInputReset/enable
CAN TXD hardware defaultCAN_TXD_RECESSIVEU2:TXD pulled to 3V3 by R5Fixed highHardware listen-only default
platformio.ini

Ini


[env:nmea2000_listener]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
board_build.mcu = esp32s3
board_build.flash_mode = dio
lib_deps =
Complete Firmware Source (src/main.cpp)

Cpp


#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
#include "driver/twai.h"

// Schematic-grounded pins
#define CAN_RX_PIN 18          // U1 IO18 <- U2 RXD, net CAN_RXD
#define CAN_TX_UNUSED_PIN 17   // Not connected to U2 TXD in Rev A

// Wi-Fi AP shown to the iPad
static const char *AP_SSID = "N2K-Listener";
static const char *AP_PASS = "nmea2000";   // change before field use

WebServer server(80);

struct CanSnapshot {
  uint32_t id = 0;
  uint8_t dlc = 0;
  uint8_t data[8] = {0};
  uint32_t count = 0;
  uint32_t lastMs = 0;
};

volatile uint32_t rxCount = 0;
CanSnapshot lastFrame;

static uint8_t n2kPriority(uint32_t id) { return (id >> 26) & 0x7; }
static uint32_t n2kPgn(uint32_t id) {
  uint8_t pf = (id >> 16) & 0xFF;
  uint8_t ps = (id >> 8) & 0xFF;
  uint8_t dp = (id >> 24) & 0x01;
  uint8_t edp = (id >> 25) & 0x01;
  if (pf < 240) return ((uint32_t)edp << 17) | ((uint32_t)dp << 16) | ((uint32_t)pf << 8);
  return ((uint32_t)edp << 17) | ((uint32_t)dp << 16) | ((uint32_t)pf << 8) | ps;
}
static uint8_t n2kSource(uint32_t id) { return id & 0xFF; }

String frameJson() {
  noInterrupts();
  CanSnapshot f = lastFrame;
  uint32_t count = rxCount;
  interrupts();

  char buf[384];
  char dataHex[3 * 8 + 1] = {0};
  for (uint8_t i = 0; i < f.dlc && i < 8; i++) {
    char b[4];
    snprintf(b, sizeof(b), "%02X%s", f.data[i], (i + 1 < f.dlc) ? " " : "");
    strncat(dataHex, b, sizeof(dataHex) - strlen(dataHex) - 1);
  }

  snprintf(buf, sizeof(buf),
           "{\"rxCount\":%lu,\"lastMs\":%lu,\"id\":\"0x%08lX\",\"pgn\":%lu,\"priority\":%u,\"source\":%u,\"dlc\":%u,\"data\":\"%s\"}",
           (unsigned long)count,
           (unsigned long)f.lastMs,
           (unsigned long)f.id,
           (unsigned long)n2kPgn(f.id),
           n2kPriority(f.id),
           n2kSource(f.id),
           f.dlc,
           dataHex);
  return String(buf);
}

void handleRoot() {
  server.send(200, "text/html", R"HTML(
<!doctype html><html><head><meta name="viewport" content="width=device-width,initial-scale=1">
<title>NMEA 2000 Listener</title>
<style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;margin:24px;background:#101820;color:#eef}pre{font-size:18px;background:#172635;padding:16px;border-radius:8px}</style>
</head><body><h1>NMEA 2000 Wi-Fi Listener</h1><p>Hardware RX-only prototype. No CAN transmit path fitted.</p><pre id="out">Waiting...</pre>
<script>async function tick(){try{let r=await fetch('/api/frame');out.textContent=JSON.stringify(await r.json(),null,2);}catch(e){out.textContent=e;}setTimeout(tick,500)}tick();</script>
</body></html>)HTML");
}

void handleFrameApi() { server.send(200, "application/json", frameJson()); }

void initTwaiListenOnly() {
  twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT((gpio_num_t)CAN_TX_UNUSED_PIN, (gpio_num_t)CAN_RX_PIN, TWAI_MODE_LISTEN_ONLY);
  twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
  twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();

  esp_err_t err = twai_driver_install(&g_config, &t_config, &f_config);
  if (err != ESP_OK) {
    Serial.printf("TWAI driver install failed: %d\n", err);
    return;
  }
  err = twai_start();
  if (err != ESP_OK) {
    Serial.printf("TWAI start failed: %d\n", err);
    return;
  }
  Serial.println("TWAI listen-only started at 250 kbit/s");
}

void pollCan() {
  twai_message_t msg;
  while (twai_receive(&msg, 0) == ESP_OK) {
    if (!(msg.flags & TWAI_MSG_FLAG_EXTD)) continue; // NMEA 2000 uses 29-bit extended IDs
    noInterrupts();
    lastFrame.id = msg.identifier;
    lastFrame.dlc = msg.data_length_code;
    for (uint8_t i = 0; i < lastFrame.dlc && i < 8; i++) lastFrame.data[i] = msg.data[i];
    lastFrame.count++;
    lastFrame.lastMs = millis();
    rxCount = lastFrame.count;
    interrupts();
  }
}

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("NMEA 2000 Wi-Fi Listener booting");
  Serial.println("Safety: CAN TXD is hardware-held recessive and not connected to MCU TX in Rev A.");

  initTwaiListenOnly();

  WiFi.mode(WIFI_AP);
  WiFi.softAP(AP_SSID, AP_PASS);
  Serial.printf("Wi-Fi AP %s started, IP %s\n", AP_SSID, WiFi.softAPIP().toString().c_str());

  server.on("/", handleRoot);
  server.on("/api/frame", handleFrameApi);
  server.begin();
}

void loop() {
  pollCan();
  server.handleClient();
}
Build & Flash
  1. Connect USB-C to J1.
  2. If the device does not enumerate, hold BOOT (S2 / ESP_BOOT), tap reset (S1 / ESP_EN), then release BOOT.
  3. Build: pio run
  4. Upload: pio run -t upload
  5. Monitor: pio device monitor
  6. On the iPad, join Wi-Fi AP N2K-Listener, open http://192.168.4.1/.
Firmware Safety Notes
  • Keep TWAI_MODE_LISTEN_ONLY; do not change to normal mode for Rev A.
  • CAN_TX_UNUSED_PIN is intentionally not connected to U2:TXD.
  • Any future TX enable hardware should be DNI by default and clearly labeled.
  • Platform & Toolchain

  • Pin Mapping

  • `platformio.ini`

  • Complete Firmware Source (`src/main.cpp`)

  • Build & Flash

  • Firmware Safety Notes