Quickstart ini templates for ATtinyX4/X5-based platform.io electronics projects, that are programmed via an Arduino UNO. This guide assumes you're using VSCode on Windows.
Some things to check if your uploads don't work:
- Ensure the Arduino is properly set up (see: Instructables guide, Github gist, PlatformIO guide)
- Check the PlatformIO selected environment and COM port
- Note that "Auto" COM port detection can be buggy - it's best to specifically define it in the platformio.ini, eg COM6
- Set the fuses on your chip
- If you're 100% sure your chip is good, and the device isn't recognized, it's possible the reset pin has been disabled. In that case, it'll need to be reset.
- If you're using a custom fuse build environment, ensure the
lib_deps
andboard_fuses
in platformio.ini match your board environment
- If you suspect your project is exceeding your chip's memory size, in
platformio.ini
, set build config type tobuild_type = debug
to enable size debugging, and debug flagdebug_build_flags = -Os
to minimize debug build filesize (which otherwise would be significantly larger than therelease
build type) - If you haven't, add a small polarized capacitor (eg 10uF) from your Arduino programmer's RESET pin to GND
- In weird circumstances, I've seen PIO bugs go away by using PlatformIO Extension > Project Tasks > Miscellaneous > Rebuild Intellisense Index
- Turn it off and on again :)
Some useful links :)
- Datasheets for ATtinyX4 and ATtinyX5
- AVR Fuse Calculator, and All You Need To Know About AVR Fuses
- ATtiny pinout diagrams (and the whole Arduino core repo) by @SpenceKonde
- AVR MCU Sleep Modes and Sleep Controller