Go to file
2025-08-20 13:39:24 +02:00
2025-08-20 12:03:39 +02:00
2025-08-20 11:38:15 +02:00
2025-08-20 11:38:15 +02:00
2025-08-20 11:13:48 +02:00
2025-08-20 13:39:24 +02:00
2025-08-20 11:38:15 +02:00

lezyne-rear-light-firmware

Open firmware for Lezyne bike rear lights based on ATTINY202

This repository contains a minimal firmware as a C project for the ATtiny202 microcontroller using GCC, CMake, and VS Code. It also includes instructions for programming the chip using an FT232 USB-UART adapter via the UPDI interface with pymcuprog.


Table of Contents


Dependencies

Ensure the following tools are installed on your system:

  • GCC AVR toolchain (supports ATtiny 0/1-series)
    sudo zypper install avr-gcc avr-libc
    
  • CMake
      sudo zypper install cmake
    
  • Python 3, pip and venv
      sudo zypper install python3 python3-pip python3-venv
    
  • VS Code (optional but recommended)
  • CMake Tools extension for VS Code

Setup Build Environment

  1. Clone the repository:
     git clone https://git.mosad.xyz/localhorst/lezyne-rear-light-firmware
     cd lezyne-rear-light-firmware
    
  2. Configure the CMake project:
    • Open the folder in VS Code.
    • Select the AVR-GCC kit in the bottom blue bar.
    • Run CMake: Configure (from command palette) if it doesn't auto-run.

Building the Project

  1. Press F7 or Ctrl+Shift+B to build.
  2. Output files are generated in the 'build/' folder:
  • main.elf → ELF executable
  • main.hex → HEX file (flashable)
  • main.bin → BIN file

Flashing the Firmware

Hardware: FT232 USB-UART adapter connected to UPDI with a 4.7 kΩ resistor.

  1. Create and activate a Python virtual environment:
     python3 -m venv pyupdi-env
     source pyupdi-env/bin/activate
    
  2. Install pymcuprog inside the environment:
     pip install pymcuprog
    
  3. Verify installation:
     pymcuprog --version
    
  4. Flash using pymcuprog:
     pymcuprog -t uart -u /dev/ttyUSB0 -d attiny202 write -f build/main.hex
    

Hardware Setup (FT232 → ATtiny202 UPDI)

 FT232 TX ----[4.7kΩ]---- UPDI (pin 6)
 FT232 GND --------------- GND
 VCC -------------------- VCC (3.3V or 5V, must match FT232 logic)

License

This project is licensed under the MIT License. See LICENSE for details.

Description
Open firmware for Lezyne bike rear lights based on ATTINY202
Readme MIT 2.6 MiB
2025-09-06 11:59:36 +02:00
Languages
C 75.8%
CMake 24.2%