# Tesla FSD CAN Bus Enabler

> **For the most up to date version of this project, go to [Tesla-OPEN-CAN-MOD](https://gitlab.com/Tesla-OPEN-CAN-MOD/tesla-open-can-mod) on GitLab.** This repo was created for my own installation and port to the Adafruit Feather M4 CAN Express.

> **Background:** This project was inspired by [@mikegapinski](https://x.com/mikegapinski) and his [Tesla Android Diagnostic Tool](https://teslaandroid.com/products/tesla-diagnostic-tool), which enables FSD in regions where it is not yet fully available. I was interested in his product but was put off by the long delivery time and cost. Around the same time I came across a GitLab repository by Starmixcraft that took a simpler, DIY approach. The original repo appeared to be deleted but has since moved to [gitlab.com/Tesla-OPEN-CAN-MOD/tesla-fsd-can-mod](https://gitlab.com/Tesla-OPEN-CAN-MOD/tesla-fsd-can-mod) (the old Starmixcraft URL now redirects there). I picked up the last available version of that project and have been building on it — adding support for more boards and working toward feature parity with commercial solutions. The goal is not to undermine @mikegapinski's work (if you want a polished, plug-and-play product, go buy his tool), but to keep a DIY alternative available for the community.

## Project Structure

```
boards/
├── ESP32_MCP2515/       # ESP32 + external MCP2515 SPI module
│   └── ESP32_MCP2515.ino
├── ESP32S3_TWAI/        # ESP32-S3 with built-in TWAI (CAN) + transceiver (e.g. SN65HVD230)
│   └── ESP32S3_TWAI.ino
├── FeatherM4CAN/        # Adafruit Feather M4 CAN Express (ATSAME51 + MCP25625)
│   └── FeatherM4CAN.ino
├── RP2040CAN/           # Adafruit Feather RP2040 CAN (MCP25625)
│   └── RP2040CAN.ino
└── UNO_MCP2515_CAN/     # Arduino UNO + MCP2515 module
    └── UNO_MCP2515_CAN.ino
```

Each board variant lives in its own directory (required by the Arduino IDE). Pick the sketch that matches your hardware.

## 📌 Prerequisites

**You must have an active FSD package on the vehicle** — either purchased or subscribed. This board enables the FSD functionality on the CAN bus level, but the vehicle still needs a valid FSD entitlement from Tesla.

If FSD subscriptions are not available in your region, you can work around this by:

1. Creating a Tesla account in a region where FSD subscriptions are offered (e.g. Canada).
2. Transferring the vehicle to that account.
3. Subscribing to FSD through that account.

This allows you to activate an FSD subscription from anywhere in the world.

## 🛠️ What It Does

This firmware intercepts specific CAN bus messages to enable and configure Full Self-Driving (FSD). It supports multiple boards — from Adafruit Feathers with MCP25625, to ESP32 with external MCP2515 modules, to ESP32-S3 using its built-in TWAI (CAN) controller. Additionally, ASS (Actually Smart Summon) is no longer restricted by EU regulations.

🚗 Core Function

- Intercepts specific CAN bus messages
- Re-transmits them onto the vehicle bus

🧠 FSD Activation Logic

- Listens for Autopilot-related CAN frames
- Checks if "Traffic Light and Stop Sign Control" is enabled in the Autopilot settings Uses this setting as a trigger for Full Self-Driving (FSD)
- Adjusts the required bits in the CAN message to activate FSD

⚙️ Additional Behavior

- Reads the follow-distance stalk setting
- Maps it dynamically to a speed profile

⚙️ HW4 - FSD V14 Features

- Approaching Emergency Vehicle Detection

### Supported Hardware Variants

Select your hardware variant via the `#define HW` directive in the sketch for your board:

| Define   | Target       | Listens on CAN IDs | Notes                                         |
| -------- | ------------ | ------------------ | --------------------------------------------- |
| `LEGACY` | HW3 Retrofit | 69, 1006            | Sets FSD enable bit and speed profile via follow-distance stalk |
| `HW3`    | HW3 vehicles | 1016, 1021         | Adds speed-offset control via follow-distance |
| `HW4`    | HW4 vehicles | 1016, 1021         | Extended speed-profile range (5 levels)       |

> **Note:** HW4 vehicles on firmware **2026.2.9.X** are on **FSD v14**. However, versions on the **2026.8.X** branch are still on **FSD v13**. If your vehicle is running FSD v13 (including the 2026.8.X branch or anything older than 2026.2.9), compile with `HW3` even if your vehicle has HW4 hardware.

### How to Determine Your Hardware Variant

- **Legacy** — Your vehicle has a **portrait-oriented center screen** and **HW3**. This applies to older Model S and Model X vehicles retrofitted with HW3.
- **HW3** — Your vehicle has a **landscape-oriented center screen** and **HW3**. You can check your hardware version under **Controls → Software → Additional Vehicle Information** on the vehicle's touchscreen.
- **HW4** — Same as above, but the Additional Vehicle Information screen shows **HW4**.

### Key Behaviour

- **FSD enable bit** is set when **"Traffic Light and Stop Sign Control"** is enabled in the vehicle's Autopilot settings.
- **Speed profile** is derived from the scroll-wheel offset or follow-distance setting.
- **Nag suppression** — clears the hands-on-wheel nag bit.
- Debug output is printed over Serial at 115200 baud when `enablePrint` is `true`.

### CAN Message Details

The table below shows exactly which CAN messages each hardware variant monitors and what modifications are made.

#### Legacy (HW3 Retrofit)

| CAN ID | Hex | Name | Direction | Mux | Action |
|---|---|---|---|---|---|
| 69 | 0x045 | STW_ACTN_RQ | Read only | — | Read follow-distance stalk position → map to speed profile |
| 1006 | 0x3EE | — | Read + Modify | 0 | Read FSD state from UI; set bit 46 (FSD enable); write speed profile to bits 1–2 of byte 6 |
| 1006 | 0x3EE | — | Read + Modify | 1 | Clear bit 19 (nag suppression) |

#### HW3

| CAN ID | Hex | Name | Direction | Mux | Action |
|---|---|---|---|---|---|
| 1016 | 0x3F8 | — | Read only | — | Read follow-distance setting → map to speed profile |
| 1021 | 0x3FD | — | Read + Modify | 0 | Read FSD state from UI; calculate speed offset; set bit 46 (FSD enable); write speed profile to bits 1–2 of byte 6 |
| 1021 | 0x3FD | — | Read + Modify | 1 | Clear bit 19 (nag suppression) |
| 1021 | 0x3FD | — | Read + Modify | 2 | Write speed offset to bits 6–7 of byte 0 and bits 0–5 of byte 1 |

#### HW4

| CAN ID | Hex | Name | Direction | Mux | Action |
|---|---|---|---|---|---|
| 1016 | 0x3F8 | — | Read only | — | Read follow-distance setting → map to speed profile (5 levels) |
| 1021 | 0x3FD | — | Read + Modify | 0 | Read FSD state from UI; set bit 46 (FSD enable); set bit 60 (FSD V14); set bit 59 (emergency vehicle detection) |
| 1021 | 0x3FD | — | Read + Modify | 1 | Clear bit 19 (nag suppression); set bit 47 |
| 1021 | 0x3FD | — | Read + Modify | 2 | Write speed profile to bits 4–6 of byte 7 |

## Hardware Requirements

One of the following boards (or a compatible alternative):

| Board | CAN Interface | Notes |
|---|---|---|
| Adafruit Feather RP2040 CAN | MCP25625 (onboard) | Uses board-defined `PIN_CAN_*` constants |
| Adafruit Feather M4 CAN Express | Built-in MCAN controller | ATSAME51 with TJA1051T/3 transceiver, requires boost enable (`PIN_CAN_BOOSTEN`) |
| ESP32 + MCP2515 module | MCP2515 (external SPI) | Default: CS=GPIO5, INT=GPIO4. Check module crystal (8 vs 16 MHz) |
| ESP32-S3 + CAN transceiver | Built-in TWAI controller | Only needs a transceiver (e.g. SN65HVD230), no MCP2515 |
| Arduino UNO + MCP2515 module | MCP2515 (external SPI) | Default: CS=D10, INT=D2. Check module crystal (8 vs 16 MHz) |

All pin assignments are configurable at the top of each sketch. CAN bus connection to the vehicle must run at **500 kbit/s**.

## Flashing

### 1. Install the Arduino IDE

Download from [https://www.arduino.cc/en/software](https://www.arduino.cc/en/software).

### 2. Install the Board Package

Open **File → Preferences** and add the appropriate URL to **Additional Board Manager URLs**, then install the board package via **Tools → Board → Boards Manager**:

| Board | Board Manager URL | Package to install |
|---|---|---|
| Adafruit Feather RP2040 CAN | `https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json` | Raspberry Pi Pico/RP2040 |
| Adafruit Feather M4 CAN Express | `https://adafruit.github.io/arduino-board-index/package_adafruit_index.json` | Adafruit SAMD Boards |
| ESP32 / ESP32-S3 | `https://espressif.github.io/arduino-esp32/package_esp32_index.json` | esp32 by Espressif |
| Arduino UNO | *(built-in)* | Arduino AVR Boards |

### 3. Install Required Libraries

Install the required library for your board via **Sketch → Include Library → Manage Libraries…**:

| Board | Library | Notes |
|---|---|---|
| Adafruit Feather RP2040 CAN | **MCP2515** by autowp | CAN controller driver (`mcp2515.h`) |
| Adafruit Feather M4 CAN Express | **Adafruit CAN** | CANSAME5x driver (`CANSAME5x.h`) |
| ESP32 + MCP2515 | **MCP2515** by autowp | CAN controller driver (`mcp2515.h`) |
| ESP32-S3 | *(none)* | Uses built-in ESP-IDF TWAI driver |
| Arduino UNO + MCP2515 | **MCP2515** by autowp | CAN controller driver (`mcp2515.h`) |

### 4. Select Your Hardware Target

Near the top of the sketch for your board, change the `HW` define to match your vehicle:

```cpp
#define HW_TARGET TARGET_HW3  // Change to TARGET_LEGACY, TARGET_HW3, or TARGET_HW4
```

### 5. Upload

1. Connect your board via USB.
2. Select the correct board and port under **Tools**.
3. Click **Upload**.

### 6. Wiring

See the [Vehicle Installation](#vehicle-installation-2023-tesla-model-3-hw3) guide below for a complete wiring walkthrough with photos. If you're wiring directly (without an Enhance Auto cable), connect to the [**X179 connector**](https://service.tesla.com/docs/Model3/ElectricalReference/prog-233/connector/x179/) — CAN-H on pin 13, CAN-L on pin 14. For **legacy Model 3 (2020 and earlier)**, use the [**X652 connector**](https://service.tesla.com/docs/Model3/ElectricalReference/prog-187/connector/x652/) — CAN-H on pin 1, CAN-L on pin 2.

**Important:** If your board or CAN module has an onboard 120 Ω termination resistor, **cut or remove it**. The vehicle's CAN bus already has its own termination, and adding a second resistor will cause communication errors. This applies to Adafruit Feather CAN boards and many MCP2515 modules.

## Speed Profiles

The speed profile controls how aggressively the vehicle drives under FSD. It is configured differently depending on the hardware variant:

### Legacy (HW3 Retrofit)

Because the Legacy variant transmits follow distance differently, it uses a **speed offset value** (in km/h) to select the profile:

| Speed Offset (km/h) | Profile |
| ------------------- | ------- |
| 28                  | Chill   |
| 29                  | Normal  |
| 30                  | Hurry   |

### HW3 & HW4 Profiles

| Distance | Profile (HW3) | Profile (HW4) |
| :------- | :------------ | :------------ |
| 2        | ⚡ Hurry      | 🔥 Max        |
| 3        | 🟢 Normal     | ⚡ Hurry      |
| 4        | ❄️ Chill      | 🟢 Normal     |
| 5        | —             | ❄️ Chill      |
| 6        | —             | 🐢 Sloth      |

## Serial Monitor

Open the Serial Monitor at **115200 baud** to see live debug output showing FSD state and the active speed profile. Disable logging by setting `enablePrint = false`.

## Vehicle Installation (2023 Tesla Model 3 HW3)

This guide covers my personal setup — a complete vehicle installation using the following parts:

| Part | Link |
|---|---|
| Adafruit Feather M4 CAN Express (ATSAME51) | [antratek.nl](https://www.antratek.nl/feather-m4-can-express-with-atsame51) |
| Enhance Auto Tesla Gen 2 Cable | [enhauto.com](https://www.enhauto.com/products/tesla-gen-2-cable?variant=41214470094923) |
| 12V/24V to 5V USB-C DC/DC Converter | [aliexpress.com](https://nl.aliexpress.com/item/1005008928142771.html) |

### Step 1: Flash the firmware

1. Install the **Adafruit SAMD Boards** package and the **Adafruit CAN** library in Arduino IDE (see [Flashing](#flashing) above).
2. Open `boards/FeatherM4CAN/FeatherM4CAN.ino`.
3. Set `#define HW_TARGET TARGET_HW3` at the top of the sketch.
4. Connect the Feather via USB and upload.
5. Open the Serial Monitor at 115200 baud — you should see `CANSAME5x ready @ 500k`.

### Step 2: Identify the Enhance Auto connector pinout

The Enhance Auto Gen 2 Cable has a connector on the end that normally plugs into a S3XY Commander. We'll use this connector to tap into the vehicle's CAN bus and 12V power. The pinout is as follows:

![Enhance Auto connector pinout](images/pinout-labeled.png)

| Wire | Signal | Connect to |
|---|---|---|
| Red | 12V+ | DC/DC converter IN+ |
| Black | GND | DC/DC converter IN- |
| Black with stripe | CAN-H (Body Bus) | Feather CAN-H screw terminal |
| Black solid | CAN-L (Body Bus) | Feather CAN-L screw terminal |
| Remaining black pair | Other Bus | Not used — leave disconnected |

### Step 3: Wire the board

Connect the Enhance Auto cable's CAN-H (black with stripe) and CAN-L (black solid) wires to the Feather's CAN screw terminal. Wire the 12V+ (red) and GND (black) to the DC/DC converter's input. The converter outputs 5V via USB-C, which plugs directly into the Feather to power it.

![Connected setup](images/connected-setup.png)

### Step 4: Connect to the car

The Enhance Auto Gen 2 Cable plugs into the **X179 connector**, located behind the driver's side trunk panel. Remove the panel trim to access the connector cluster.

![X179 connector location](images/x179-connector.png)

Plug in the Enhance Auto cable — it provides both CAN bus data and 12V power through a single connection. No jumper wires needed. For a video guide on how to access the X179 connector and plug in the cable, see [this installation video by Enhance Auto](https://youtube.com/watch?v=ifwJNZgykVI).

### Step 5: Verify

1. Disconnect the DC/DC converter from the Feather's USB-C port and connect your laptop instead.
2. Open the Serial Monitor at 115200 baud — you should see handler output like `HW3Handler: FSD: 1, Profile: 2, Offset: 0`.
3. Enable **"Traffic Light and Stop Sign Control"** in Autopilot settings if not already enabled.
4. Change the follow-distance setting on the stalk and verify the Profile value changes.
5. Once everything is working, disconnect your laptop and plug the DC/DC converter back in — you're done.

## Roadmap

This fork aims to expand on the original project:

- **Enclosure** — a 3D-printable or off-the-shelf enclosure to protect the board and make the installation clean and permanent.
- **More supported boards** — e.g. Teensy 4.x (FlexCAN), STM32 + MCP2515.
- **New features** — contributions and ideas are welcome via issues and pull requests.

## Warning

**This project is for testing and educational purposes only.** Sending incorrect CAN bus messages to your vehicle can cause unexpected behavior, disable safety-critical systems, or permanently damage electronic components. The CAN bus controls everything from braking and steering to airbags — a malformed message can have serious consequences. If you don't fully understand what you're doing, **do not install this on your car**.

## Disclaimer

**Use this project at your own risk.** Modifying CAN bus messages on a vehicle can lead to unexpected or dangerous behavior. The authors accept no responsibility for any damage to your vehicle, injury, or legal consequences resulting from the use of this software. This project may void your vehicle warranty and may not comply with road safety regulations in your jurisdiction. Always keep your hands on the wheel and stay attentive while driving.

## License

This project is licensed under the **GNU General Public License v3.0** — see the [GPL-3.0 License](https://www.gnu.org/licenses/gpl-3.0.html) for details.
