Skip to content
Back to skills

Esp32 Can Twai

ASecurity

Use when an ESP32 joins a CAN bus - no frames arrive, the bus goes off after a while, the bitrate will not match, or the transceiver is missing. Covers TWAI setup, termination, bitrate and bus-off recovery.

  • 16 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agentsgonode

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add Esmail-sarhadi/esp32-agent-skills --skill esp32-can-twai --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Esp32 Can Twai?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Esp32 Can Twai
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/esmail-sarhadi-esp32-can-twai/badge)](https://www.skillsdirectory.com/skills/esmail-sarhadi-esp32-can-twai)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: esp32-can-twai
description: Use when an ESP32 joins a CAN bus - no frames arrive, the bus goes off after a while, the bitrate will not match, or the transceiver is missing. Covers TWAI setup, termination, bitrate and bus-off recovery.
license: MIT
---

# CAN (TWAI) on ESP32

The ESP32 has a CAN 2.0B controller called TWAI. It is a controller only: the
transceiver, the termination and the bus itself are your problem.

## Which chips have it

The classic ESP32, the C3 and the C6 have a TWAI controller. The **S2 and S3 do
not** - a design that needs CAN and picked an S3 has to add an external
controller over SPI. Check this before writing the driver.

## The transceiver is not optional

TWAI pins are logic-level TX and RX. A CAN bus is differential and needs a
transceiver (3.3 V parts exist, e.g. SN65HVD230). Connecting TX/RX directly to
CANH/CANL damages both ends and never works.

## Termination

120 ohms at **both physical ends** of the bus, and nowhere else. Two nodes on a
bench need two resistors; a long bus with ten nodes still needs two, at the ends.
A missing termination shows up as frames that work at 125 kbit/s and fail at
500 kbit/s.

## Bitrate

Every node must use the same nominal bitrate and the same sample point. A node at
500 kbit/s on a 250 kbit/s bus does not "fail to receive" - it floods the bus with
error frames and takes the whole segment down.

## Bus-off

A node that accumulates too many errors goes bus-off: it stops transmitting and
listening. The controller can recover automatically, or only when told. For a
product, automatic recovery with a backoff is usually right; for diagnostics,
manual recovery tells you how often it happened.

## Filters

Acceptance filters decide which identifiers reach the driver. An empty filter set
that accepts everything is fine on a bench and wrong on a vehicle bus: the CPU
spends its time discarding frames.

## Symptom to cause

| Symptom | Usually |
|---|---|
| no frames at all | no transceiver, TX/RX swapped, no termination |
| works until traffic rises | bitrate or sample point mismatch |
| goes silent after a while | bus-off, no recovery configured |
| frames arrive twice | two nodes transmitting the same identifier |

Files in this skill

  • LICENSE.txt857 B
  • SKILL.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.