Permalink
Browse files

Merge pull request #6 from jabdoa2/add_trinket

Add trinket
  • Loading branch information...
harbaum committed Jan 20, 2018
2 parents 74ebfff + 4a0d1e5 commit 42913cad831295f581b5edf5b8444eda1f1e2b8c
Showing with 81 additions and 64 deletions.
  1. +1 −1 README.md
  2. +15 −2 digispark/README.md
  3. +3 −0 digispark/main.c
  4. +62 −61 digispark/main.hex
@@ -1,6 +1,6 @@
# i2c-tiny-usb
No custom hardware is needed anymore since the i2c-tiny-usb firmware has been [ported to the digispark](https://github.com/harbaum/I2C-Tiny-USB/tree/master/digispark).
No custom hardware is needed anymore since the i2c-tiny-usb firmware has been ported to the digispark and the Adafruit Trinket. See the [instructions](https://github.com/harbaum/I2C-Tiny-USB/tree/master/digispark).
## Introduction
@@ -1,7 +1,10 @@
# I2C-Tiny-USB on Digispark
# I2C-Tiny-USB on Digispark and Adafruit Trinket
The i2c-tiny-usb firmware has been ported to the
[digispark](http://digistump.com/products/1). The original port is
[digispark](http://digistump.com/products/1) and the
[Adafruit Trinket](https://www.adafruit.com/product/1501).
It currently only works on the 5V Trinket because the 3.3V version does not
officially support operation at 16MHz. The original port is
available [here](https://github.com/nopdotcom/i2c_tiny_usb-on-Little-Wire).
The version distributed here is compatible with the original i2c-tiny-usb
@@ -18,6 +21,7 @@ Foto: rc522 i2c rfid reader connected to the digispark.
![Pinout](digispark_pins.svg)
```SDA``` is mapped to pin ```P0``` of the digispark. ```SCL``` is mapped to ```P2```.
```SDA``` is mapped to pin ```#0``` of the Adafruid Trinket. ```SCL``` is mapped to ```#2```.
### I2C pullup resistors
@@ -42,6 +46,9 @@ timeout and you'll see e.g. the following message in the linux syslog:
[...] i2c i2c-4: failure writing data
```
In this case the watchdog will trigger and you can see the Adafruit Trinket to
enter the bootloader again.
## Flashing the firmware
A compiled binary named ```main.hex``` is available in the repository.
@@ -53,4 +60,10 @@ from the digispark arduino installation:
micronucleus --run --dump-progress --type intel-hex main.hex
```
or the Adafruit Trinket using (make sure to apply their config tweeks first):
```
avrdude -pattiny85 -cusbtiny -D -Uflash:w:main.hex
```
More details on this can be found [here](https://github.com/nopdotcom/i2c_tiny_usb-on-Little-Wire/wiki/BuildingOnLinux).
@@ -66,6 +66,7 @@
#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/power.h>
#include <util/delay_basic.h>
#include <util/delay.h>
#include <util/atomic.h>
@@ -628,6 +629,8 @@ static inline void initSerialNumber();
int main(void) {
uchar i;
uchar calibrationValue;
clock_prescale_set(clock_div_1);
calibrationValue = eeprom_read_byte(0); /* calibration value from last time */
if(calibrationValue != 0xff){
@@ -7,9 +7,9 @@
:1000600069006C006C0020004800610072006200B2
:10007000610075006D00040309040100FF8E112466
:100080001FBECFE5D2E0DEBFCDBF10E0A0E6B0E0FE
:10009000E2EDFCE002C005900D92A037B107D9F760
:10009000E2EEFCE002C005900D92A037B107D9F75F
:1000A00020E0A0E7B0E001C01D92A43AB207E1F75A
:1000B000C5D40DC6A5CFA82FB92F80E090E041E0B0
:1000B000C5D415C6A5CFA82FB92F80E090E041E0A8
:1000C00050EA609530E009C02D9182279795879579
:1000D00010F084279527305EC8F36F5FA8F308956A
:1000E000EADF8D939D930895A6E088279927AA9526
@@ -114,24 +114,24 @@
:10071000309379002093780081E0232B09F080E06A
:10072000B6DF8993EBCF8091770081FF0CC0809179
:10073000780090917900892B31F47DDF04C060E06E
:1007400070E0802FA7D2812FDF91CF911F910F9161
:1007400070E0802FAFD2812FDF91CF911F910F9159
:1007500008950F931F93CF93DF93162F2091760068
:10076000462F50E0213031F520917800309179000A
:100770002417350708F4122F082FEC018C2F801B4B
:10078000811760F48091780090917900019790939F
:10079000790080937800899152DFF0CF80917700C3
:1007A00081FF0BC08091780090917900892B29F40A
:1007B00042DF03C060E070E06DD2812FDF91CF9106
:1007B00042DF03C060E070E075D2812FDF91CF91FE
:1007C0001F910F9108958F929F92AF92BF92CF92F7
:1007D000DF92EF92FF921F93CF93DF93EC0182E7BA
:1007E00090E0909389008093880099819230E9F09D
:1007F00070F4992391F0913009F087C044E050E003
:100800006AE770E082E790E03CD284E07FC09330FA
:100800006AE770E082E790E044D284E07FC09330F2
:1008100009F475C09830F0F178C08A818093720035
:100820008B818093730082E071C06A817B8180E05C
:1008300090E022E736E040E050E0A3D149015A01C0
:1008300090E022E736E040E050E0ABD149015A01B8
:10084000C501B401685A7D4F8F4F9F4F20EB34E0B4
:1008500040E050E072D12830310538F481E090E07A
:1008500040E050E07AD12830310538F481E090E072
:10086000909365008093640006C02750310930934F
:1008700065002093640080916400909165009695D6
:100880008795009711F481E090E090936300809346
@@ -151,58 +151,59 @@
:1009600010E00F5F1F4F21B730E0021713078CF024
:10097000BBDB8453994097FF03C091958195910902
:100980008E159F0514F4C1B77C0181B78F5F81BFBD
:10099000EACFC1BF61B780E090E08BD100B600FE26
:1009A00045C0CFB5D0E060E380E290E082D1CE01D7
:1009B00064E670E0AED0CB010AE010E0B801A9D047
:1009C00060E3680F81E290E074D1CE01B801A1D05C
:1009D000C82FCB01B8019DD060E3680F82E290E0A0
:1009E00068D160E36C0F83E290E063D180E290E035
:1009F00058D190E0909369008093680081E290E084
:100A000050D190E090936B0080936A0082E290E076
:100A100048D190E090936D0080936C0083E290E069
:100A200040D190E090936F0080936E00DF91CF9162
:100A30001F910F91FF90EF90DF90089580E090E07C
:100A400030D18F3F09F081BF80E290E02AD1182F8A
:100A500081E290E026D1D82F82E290E022D1C82F07
:100A600083E290E01ED110531A3008F04FC0D053EB
:100A7000DA3008F04BC0C053CA3008F047C080538A
:100A80008A3008F043C080E290E00BD190E0909370
:100A900069008093680081E290E003D190E0909338
:100AA0006B0080936A0082E290E0FBD090E090932C
:100AB0006D0080936C0083E290E0F3D090E090931F
:100AC0006F0080936E00B898C098BA98C298109240
:100AD000790010927800BB9A84E1E2EBF1EF319754
:100AE000F1F700C000008150C1F7BB989EE088E19B
:100AF0000FB6F894A89581BD0FBE91BD81DD7894A5
:100B0000B99ABD98C598A89553DCFDCF81E080BF08
:100B1000BACFAA1BBB1B51E107C0AA1FBB1FA61758
:100B2000B70710F0A61BB70B881F991F5A95A9F796
:100B300080959095BC01CD010895A1E21A2EAA1BC3
:100B4000BB1BFD010DC0AA1FBB1FEE1FFF1FA2177D
:100B5000B307E407F50720F0A21BB30BE40BF50B7A
:100B6000661F771F881F991F1A9469F76095709503
:100B7000809590959B01AC01BD01CF0108956894CB
:100B80000013E894A0E0B0E0E7ECF5E01DC0EFEF63
:100B9000E7F959016A015E23550FEE08FE2C870123
:100BA0009B01AC019E23990F660B762FCB013BD0A6
:100BB000CDB7DEB7EAE024C02F923F924F925F920A
:100BC0006F927F928F929F92AF92BF92CF92DF925D
:100BD000EF92FF920F931F93CF93DF93CDB7DEB7C2
:100BE000CA1BDB0B0FB6F894DEBF0FBECDBF099456
:100BF0002A88398848885F846E847D848C849B84AD
:100C0000AA84B984C884DF80EE80FD800C811B81BA
:100C1000AA81B981CE0FD11D0FB6F894DEBF0FBEE9
:100C2000CDBFED010895DF93CF939F92A0E49A2E5C
:100C30000024D001E001F00116950795F794E794A0
:100C4000D794C794B794A79448F41068A20FB31F21
:100C5000C41FD51FE61FF71F081E191E220F331FC2
:100C6000441F551F661F771F881F991F9A9421F7ED
:100C70009D01AE01BF01C00111249F90CF91DF9172
:100C80000895FB01DC0102C005900D9241505040D7
:100C9000D8F70895DC0101C06D9341505040E0F752
:100CA0000895E199FECF9FBB8EBBE09A99278DB343
:100CB0000895262FE199FECF1CBA9FBB8EBB2DBB9A
:100CC0000FB6F894E29AE19A0FBE01960895F8944F
:020CD000FFCF54
:100CD200FF5A030006000A033100320033003400D9
:10099000EACFC1BF61B780E090E093D100B600FE1E
:1009A00045C0CFB5D0E060E380E290E08AD1CE01CF
:1009B00064E670E0B6D0CB010AE010E0B801B1D037
:1009C00060E3680F81E290E07CD1CE01B801A9D04C
:1009D000C82FCB01B801A5D060E3680F82E290E098
:1009E00070D160E36C0F83E290E06BD180E290E025
:1009F00060D190E0909369008093680081E290E07C
:100A000058D190E090936B0080936A0082E290E06E
:100A100050D190E090936D0080936C0083E290E061
:100A200048D190E090936F0080936E00DF91CF915A
:100A30001F910F91FF90EF90DF90089520E030E03C
:100A400080E80FB6F89486BD26BD0FBE80E090E02A
:100A500030D18F3F09F081BF80E290E02AD1182F7A
:100A600081E290E026D1D82F82E290E022D1C82FF7
:100A700083E290E01ED110531A3008F04FC0D053DB
:100A8000DA3008F04BC0C053CA3008F047C080537A
:100A90008A3008F043C080E290E00BD190E0909360
:100AA00069008093680081E290E003D190E0909328
:100AB0006B0080936A0082E290E0FBD090E090931C
:100AC0006D0080936C0083E290E0F3D090E090930F
:100AD0006F0080936E00B898C098BA98C298109230
:100AE000790010927800BB9A84E1E2EBF1EF319744
:100AF000F1F700C000008150C1F7BB989EE088E18B
:100B00000FB6F894A89581BD0FBE91BD79DD78949C
:100B1000B99ABD98C598A8954BDCFDCF81E080BF00
:100B2000BACFAA1BBB1B51E107C0AA1FBB1FA61748
:100B3000B70710F0A61BB70B881F991F5A95A9F786
:100B400080959095BC01CD010895A1E21A2EAA1BB3
:100B5000BB1BFD010DC0AA1FBB1FEE1FFF1FA2176D
:100B6000B307E407F50720F0A21BB30BE40BF50B6A
:100B7000661F771F881F991F1A9469F760957095F3
:100B8000809590959B01AC01BD01CF0108956894BB
:100B90000013E894A0E0B0E0EFECF5E01DC0EFEF4B
:100BA000E7F959016A015E23550FEE08FE2C870113
:100BB0009B01AC019E23990F660B762FCB013BD096
:100BC000CDB7DEB7EAE024C02F923F924F925F92FA
:100BD0006F927F928F929F92AF92BF92CF92DF924D
:100BE000EF92FF920F931F93CF93DF93CDB7DEB7B2
:100BF000CA1BDB0B0FB6F894DEBF0FBECDBF099446
:100C00002A88398848885F846E847D848C849B849C
:100C1000AA84B984C884DF80EE80FD800C811B81AA
:100C2000AA81B981CE0FD11D0FB6F894DEBF0FBED9
:100C3000CDBFED010895DF93CF939F92A0E49A2E4C
:100C40000024D001E001F00116950795F794E79490
:100C5000D794C794B794A79448F41068A20FB31F11
:100C6000C41FD51FE61FF71F081E191E220F331FB2
:100C7000441F551F661F771F881F991F9A9421F7DD
:100C80009D01AE01BF01C00111249F90CF91DF9162
:100C90000895FB01DC0102C005900D9241505040C7
:100CA000D8F70895DC0101C06D9341505040E0F742
:100CB0000895E199FECF9FBB8EBBE09A99278DB333
:100CC0000895262FE199FECF1CBA9FBB8EBB2DBB8A
:100CD0000FB6F894E29AE19A0FBE01960895F8943F
:020CE000FFCF44
:100CE200FF5A030006000A033100320033003400C9
:00000001FF

0 comments on commit 42913ca

Please sign in to comment.