BuildingOnLinux - nopdotcom/i2c_tiny_usb-on-Little-Wire GitHub Wiki

This is copied from jabss at https://forum.openwrt.org/viewtopic.php?pid=282876#p282876 and is aimed at the Digispark.


First, I cloned your git repository.

mkdir digispark
cd digispark/
git clone https://github.com/nopdotcom/i2c_tiny_usb-on-Little-Wire
cd i2c_tiny_usb-on-Little-Wire/

(I also uncommented the USB ID as per your help) (see https://github.com/nopdotcom/i2c_tiny_usb-on-Little-Wire/blob/master/firmware/usbconfig.h#L157)

Then, installed "gcc-avr" and "avr-libc":

sudo apt-get install gcc-avr avr-libc

Then, compiled. It worked at first time!

user@server$ make hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size -C --mcu=attiny85 main.elf
AVR Memory Usage
----------------
Device: attiny85

Program:    3126 bytes (38.2% Full)
(.text + .data + .bootloader)

Data:         66 bytes (12.9% Full)
(.data + .bss + .noinit)

The result is the "main.hex" file.

Then, I followed this digispark tutorial that teaches how to add digispark support t Arduino IDE. https://digistump.com/wiki/digispark/tutorials/connecting This installs micronucleus in so it can be used to upload to Digispark. I had to search for it, in my case it was in /home/user/.arduino15/packages/digistump/tools/micronucleus/2.0a4.

After finding it, it was just a matter of copping all the files to the same directory and run:

sudo ./micronucleus --run --dump-progress --type intel-hex main.hex
{status:"waiting",step:1,steps:6,progress:0.500000}
> Please plug in the device ... 
> Press CTRL+C to terminate the program.
> Device is found!
{status:"connecting",step:2,steps:6,progress:0.000000}
{status:"connecting",step:2,steps:6,progress:0.180000}
{status:"connecting",step:2,steps:6,progress:0.360000}
{status:"connecting",step:2,steps:6,progress:0.540000}
{status:"connecting",step:2,steps:6,progress:0.720000}
{status:"connecting",step:2,steps:6,progress:1.000000}
> Device has firmware version 1.6
> Available space for user applications: 6012 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94  page size: 64
> Erase function sleep duration: 752ms
{status:"parsing",step:3,steps:6,progress:0.000000}
{status:"parsing",step:3,steps:6,progress:1.000000}
{status:"parsing",step:3,steps:6,progress:1.000000}
> Erasing the memory ...
{status:"erasing",step:4,steps:6,progress:0.000000}
{status:"erasing",step:4,steps:6,progress:0.010000}
[. . .]
{status:"erasing",step:4,steps:6,progress:0.989999}
{status:"erasing",step:4,steps:6,progress:0.999999}
{status:"erasing",step:4,steps:6,progress:1.000000}
> Starting to upload ...
{status:"writing",step:5,steps:6,progress:0.000000}
{status:"writing",step:5,steps:6,progress:0.010645}
{status:"writing",step:5,steps:6,progress:0.021291}
[. . .]
{status:"writing",step:5,steps:6,progress:0.979375}
{status:"writing",step:5,steps:6,progress:0.990020}
{status:"writing",step:5,steps:6,progress:1.000000}
> Starting the user app ...
{status:"running",step:6,steps:6,progress:0.000000}
{status:"running",step:6,steps:6,progress:1.000000}
>> Micronucleus done. Thank you!

dmesg shows some good news:

[ 2773.526627] usb 8-1.2: new low-speed USB device number 74 using xhci_hcd
[ 2773.551509] usb 8-1.2: New USB device found, idVendor=0403, idProduct=c631
[ 2773.551522] usb 8-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2773.551528] usb 8-1.2: Product: i2c-tiny-usb on littleWire
[ 2773.551534] usb 8-1.2: Manufacturer: nop.com
[ 2773.551538] usb 8-1.2: SerialNumber: 113
[ 2773.552738] i2c-tiny-usb 8-1.2:1.0: version 2.01 found at bus 008 address 074
[ 2773.553333] i2c i2c-11: connected i2c-tiny-usb device