Industrial bus

TWAI / CAN

Industrial and automotive bus. The chip is a controller; you still need a transceiver.

Industrial bus CAN / TWAI ESP32 / S3 / C3 / C6 class with TWAI

Official path: examples/peripherals/twai

01 Overview

TWAI is CAN-compatible. The example sends and receives frames.

  • Use when: vehicle or industrial hosts.
  • Skip when: you only need USB debug.

02 Hardware

  • Add a CAN transceiver (e.g. SN65HVD230).
  • CANH/CANL, 120Ω, common ground.
  • Isolated supplies if the site is noisy.

03 Software flow

1. Bitrate and acceptance filter.

2. Install driver, send std/ext frames.

3. Recover from error counters and bus-off.

04 Core points

  • No transceiver, no CAN.
  • Custom work: bitrate, filters, protocol.

中文

工业总线

TWAI / CAN

工业与汽车总线。芯片是 TWAI 控制器,外面还要收发器。

工业总线 CAN / TWAI ESP32 / S3 / C3 / C6 class with TWAI

官方路径: examples/peripherals/twai

01 项目概述

TWAI 兼容 CAN。官方示例收发帧。

  • 适用: 车机、工业主机互联。
  • 不适用: 只要 USB 调试。

02 项目硬件描述

  • 必须加 CAN 收发器(如 SN65HVD230)。
  • CANH/CANL、120Ω、共地。
  • 隔离电源看现场干扰。

03 项目软件流程描述

1. 配比特率、验收滤波。

2. 装驱动,发标准/扩展帧。

3. 错误计数和总线关闭要有恢复策略。

04 项目核心点

  • 没有收发器就没有 CAN。
  • 可定制: 波特率、滤波、协议层。