Digispark + Arduino Setup on Fedora 35

Date: 2021-12-16
categories: avr;

Contents

Note: This page is largely focused on Fedora 35, Arduino IDE, and the Digispark ATTINY85. The information may be useful for other Linux distributions, but probably not.

I encountered some challenges getting up and running with my Digispark ATTINY85 Micro USB dev board on Fedora 35, so I thought I would document it before I forget. The board was a few dollars and similar to this one:

Digispark Clone

The problems I encountered:

Install the Arduino IDE

[sss_cache] [sysdb_domain_cache_connect] (0x0010): 
DB version too old [0.22], expected [0.23] for domain implicit_files!
systemctl stop sssd
rm -rf /var/lib/sss/db/*
systemctl restart sssd

I recently did a dist upgrade of Fedora from 33 to 35, so this problem may well have stemmed from that. Either way, I was able to clear that error.

Next, I ran into a problem with a mismatch of certain Java/Desktop dependencies (gtk, for example) and the version of Java that's shipped with the Arduino IDE. This manifested as missing menu text and similar graphical glitches. To resolve, I followed the instructions from this issue.

Github Issue
# cd in your arduino IDE extracted folder
sudo dnf install java-latest-openjdk
sudo alternatives --config java # select the number with java-latest-openjdk.x86_64
mv java{,_old}

Digispark Setup

I followed the instructions for setup, including the Linux instructions.

Digistump Setup Instructions

Added this to Additional Boards Manager URLs in the Arduino IDE:

http://digistump.com/package_digistump_index.json

Installed the Digistump AVR Boards and selected the Default 16.5 mhz Board.

Setup udev Rules

Added the udev rules, and reloaded: udevadm control --reload-rules

# UDEV Rules for Micronucleus boards including the Digispark.
# This file must be placed at:
#
# /etc/udev/rules.d/49-micronucleus.rules    (preferred location)
#   or
# /lib/udev/rules.d/49-micronucleus.rules    (req'd on some broken systems)
#
# After this file is copied, physically unplug and reconnect the board.
#
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.

Download udev rules

Programming the Board

It took me a few tries to figure out the trick to getting these things to program. The instructions on the site did tell me, I just didn't catch on right away.

The Digispark works a bit differently than some Arduino compatible products. The Digispark programs with a different procedure. From the Tools menu select Board→Digispark (Default - 16.5Mhz) (The Tools→Programmer selection does not matter) Write some code, open your code, or open a Digispark example. You do not need to plug in your Digispark before invoking upload. Hit the upload button. The bottom status box will now ask you to plug in your Digispark - at this point you need to plug it in - or unplug and replug it. You'll see the upload progress and then it will immediately run your code on the Digispark. If you unplug the Digispark and plug it back in or attach it to another power source there will be a delay of 5 seconds before the code you programmed will run. This 5 second delay is the Digispark Pro checking to see if you are trying to program it.

Basically, upload your sketch then plug in the Digispark. I found that I also had to repeat this process for each load, which is a bit of a pain.

You do not need to plug in your Digispark before invoking upload Hit the upload button. The bottom status box will now ask you to plug in your Digispark - at this point you need to plug it in - or unplug and replug it. You'll see the upload progress and then it will immediately run your code on the Digispark. If you unplug the Digispark and plug it back in or attach it to another power source there will be a delay of 5 seconds before the code you programmed will run. This 5 second delay is the Digispark Pro checking to see if you are trying to program it.

I also noticed that if I connected Pin 5 (RESET) to ground I didn't seem to need to plug in the board and unplug it so much. Also, in a future experiment I flashed a new micronucleus firmware and started to use the micronucleus cli to flash programs to the board, and that seemed to work without the plugging/unplugging. More on that in a future post!