Monday, October 16, 2023

Digispark ATtiny85 AVR USB Connect/Disconnect - Programming the Dev Board

I bought a couple little ATtiny85 development boards a while ago and I've used them in little projects here and there, like creating a 3D printed stoplight with my son. It's a great little AVR board with 5v pins making it ideal to work with. 

ATTiny85 Development Boards

Recently, I decided I would build an Arduino-based useless box for Halloween, and as I only need 3 pins (2 with PWM to control servos and 1 for the switch) and doesn't require a lot of memory or power I thought this might be a good option.

When I went to upload a sketch to the board, I found that the board would connect and quickly disconnect. 

After reviewing several websites and YouTube videos walking through the installation of digistump drivers and adding the board to Arduino IDE, all of which I had already done, I finally found some guys with a video showing the same problem I was having.


In this video, they begin the upload process for the board before connecting the board. Once the compilation has completed, the console will direct you to plug-in the board and then it will continue uploading the program as you would expect.

Note: For PlatformIO, just make sure to define your board correctly, leaving the com ports blank and the port selection set to auto. Everything else should be basically the same as from the Arduino IDE.

[env:attiny85]
platform = atmelavr
board = digispark-tiny
framework = arduino


It seems that the bootloader takes command of the TX/RX lines at the very beginning of the board boot waiting for a packet indicating an intention to program, if this does not appear within a short amount of time, the bootloader seems to start up the ATtiny MCU as it is. Feel free to educate me if you know more or would like correct my thinking here. 

For even simpler projects, you can buy just the ATtiny85 chips and a programmer board. Programmer boards vary greatly in price, but if you want to go cheap, you could even connect an existing ATtiny85 development board with a de-soldered MCU chip, and then wire it up to a breadboard to program more chips. That is essentially what is happening here.


https://www.deviantart.com/mortenaaserud/art/Digispark-Attiny85-Pinout-738150591


No comments: