Skip to content

Examples for the ATtiny85 with USB bootloader using GNU make and avr-gcc

License

Notifications You must be signed in to change notification settings

cyber-murmel/tiny85-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny85 Examples

This repository contains examples for the ATtiny85.

Hardware

This projects supports two hardware setups - either with an ISP or via USB. I recommend the USB setup due to its ease of use.

ISP Setup

For this you only need an AVR In Ssystem Programmer like the USBasp. This setup is only necessary if you currently can't assemble an USB setup or because the ATtiny doesn't have the bootloader yet.

The schematic are simple connections between the programmer and the micro controller.

    ┌─────────────────────┐
    │                     │
    │                    ┌┘
    │                    │
    │     ┌──────────┐ ┌─┼──────────────────────────┐
┌───┼─────┤MOSI   VCC├─┘ │                          │
│   │     │          │   └┐RST 1┌────────┐8 VCC     │
│   │    ─┤GND    TXD├─   └─────┤PB5  VCC├──────────┘
│   │     │          │         2│        │7 SCK
│   └─────┤RESET  RXD├─       ──┤PB3  PB2├──────────────┐
│         │          │         3│        │6 MISO        │
│   ┌─────┤SCK    GND├─       ──┤PB4  PB1├───────────┐  │
│   │     │          │     GND 4│        │5 MOSI     │  │
│   │   ┌─┤MISO   GND├──────────┤GND  PB0├───────┐   │  │
│   │   │ └──────────┘          └────────┘       │   │  │
│   │   │ USBasp                ATtiny85         │   │  │
│ ┌─┼───┼─┐                                      │   │  │
└─┘ │   │ └──────────────────────────────────────┘   │  │
    │   │                                            │  │
    │   └────────────────────────────────────────────┘  │
    │                                                   │
    └───────────────────────────────────────────────────┘

USB Setup

This is based on the Digispark schematic and requires the bootloader to be flashed to the ATtiny85. If necessary, flash the bootloader with the ISP setup.

For the USB setup you need the following components:

  • an USB connector
  • one 1.5kΩ resistor
  • two 68Ω resistors
  • two 3V Zener diodes

Connect the components according to the schematic below.

┌─────┐
│ VBUS├──┬──────────────────────────────────────┐
│     │  │                                      │
│     │  │ ┌───┐                                │
│     │  └─┤1k5├─┐        ┌───┐                 │
│   D-├─┐  └───┘ ├────┬───┤68R├───┐             │
│     │ │        │    │   └───┘   │ 1┌────────┐8│
│     │ └────────┘    │           │ ─┤PB5  VCC├─┘
│     │             ┌─┼─┐ ┌───┐   │ 2│        │7
│   D+├───────┬─────┘ │ └─┤68R├─┐ └──┤PB3  PB2├─
│     │       │       │   └───┘ │   3│        │6
│     │ ┌─|>l─┘ ┌─|>l─┘         └────┤PB4  PB1├─
│     │ │ 3V    │ 3V                4│        │5
│  GND├─┴───────┴────────────────────┤GND  PB0├─
└─────┘                              └────────┘
USB                                  ATtiny85

Software

In the following I want to describe the step necessary to build flash the examples.

Cloning

Clone this repository recursively.

git clone --recurse-submodules https://github.com/cyber-murmel/tiny85-examples.git

Prerequisites

To build this project you need to install

For automatic code formatting you can also install clang.

Nix

If you are using Nix(OS) you can simply run nix-shell to enter a development enviroment.

Bootloader

To build and flash the bootloader, run

make -C micronucleus/firmware/ CONFIG=t85_default

hook up hook up the ISP setup and run the following - depending on your permission with sudo

make -C micronucleus/firmware/ CONFIG=t85_default flash

Firmware

To build and upload an actual firmware example, first select a target from the src/ directory, then build it with

make TARGET=<target name>
# e.g.
make TARGET=blink

To then upload the binary run

make TARGET=<target name> upload

This also (re-)builds the firmware if necessary.

Cleanup

If you build another target or something seems wrong, you are well acvised to clean up the old build files first. Do this by running make clean.

Credits

Bootloader:

USB:

About

Examples for the ATtiny85 with USB bootloader using GNU make and avr-gcc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published