# CAN-FD Gateway Logger

基于 ESP32-C5 的双路 CAN-FD 网关与数据记录器。

ESP32 Dual CAN-FD Bridge & Logger

基于 ESP32-C5 的双路 CAN-FD 网关与数据记录器。

- id: sebastians85-esp32-c5-gateway-logger
- author: SebastianS85
- repository: https://github.com/SebastianS85/ESP32_C5_gateway_logger
- license: Apache-2.0
- shape: headless
- scenes: tools
- boards: ESP32
- browser_playable: no
- preview: Project screenshots
- html: https://esp32gallery.com/projects/sebastians85-esp32-c5-gateway-logger/
- html_zh: https://esp32gallery.com/zh/projects/sebastians85-esp32-c5-gateway-logger/
- json: https://esp32gallery.com/data/catalog/projects/sebastians85-esp32-c5-gateway-logger.json

## Hardware

ESP32-class board. Verify the exact board revision, display, power source and wiring in the upstream build guide.

ESP32 类开发板；请在上游构建文档中核对具体板型、屏幕、供电与接线。

## English

```
A CAN FD tool built on the ESP32-C5's two on-chip TWAI-FD controllers, with three modes picked by DIP switches at boot: a direct bridge between CAN 1 and CAN 2, an SD card logger that stamps a .bin file from the DS3231MZ clock, or a Wi-Fi TCP server for live capture and injection from a PC. Data phase runs to 5 Mbit/s with payloads up to 64 bytes; 3 MB PSRAM ring buffers per channel guard against dropped frames. An I2C OLED, a PCF8574 for the switches and status LEDs, and a GPIO28 safe-eject button that flushes and unmounts the card complete the board. A Python GUI converts logs to Vector ASC for SavvyCAN, and a PyQt6 tool drives the device over TCP, including remote bitrate changes saved to NVS. Building needs ESP-IDF 6.0.2, PSRAM enabled and a custom 3 MB factory partition.
```

## 中文

```
用 ESP32-C5 片内两路 TWAI-FD 控制器做的 CAN FD 工具，开机时由 DIP 开关选三种模式之一：CAN 1 和 CAN 2 之间直通桥接、带 DS3231MZ 时钟打时间戳的 SD 卡记录，或者 Wi-Fi TCP 服务器供电脑实时抓包和注入。数据段速率可到 5 Mbit/s，单帧最多 64 字节；每路有 3 MB 的 PSRAM 环形缓冲，防止高负载丢帧。板上有 I2C OLED、负责读开关和点状态灯的 PCF8574，以及 GPIO28 上的安全弹出键，按下先刷缓冲再卸载文件系统。电脑端一个 Python 图形工具把日志转成 Vector ASC 给 SavvyCAN，另一个 PyQt6 工具通过 TCP 控制设备，包括远程改速率并写进 NVS。编译要 ESP-IDF 6.0.2、打开 PSRAM，还得自己划一个 3 MB 的 factory 分区。
```
