Skip to content

Commit 6e02697

Browse files
committed
Add ATtiny13a board definitions, example upload code, and blink hex file.
1 parent 1b62c77 commit 6e02697

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

adafruit_avrprog.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ class Boards:
5959
"""
6060
Some well known board definitions
6161
"""
62+
ATtiny13a = {
63+
'name': "ATtiny13a",
64+
'sig': [0x1E, 0x90, 0x07],
65+
'flash_size': 1024,
66+
'page_size': 32,
67+
'fuse_mask': (0xFF, 0xFF, 0x00, 0x03),
68+
'clock_speed': 100000
69+
}
6270
ATtiny85 = {
6371
'name': "ATtiny85",
6472
'sig': [0x1E, 0x93, 0x0B],

examples/attiny13a_blink.hex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:1000000009C00EC00DC00CC00BC00AC009C008C09A
2+
:1000100007C006C011241FBECFE9CDBF02D012C059
3+
:10002000EFCF81E087BB18BA98E088B3892788BBF7
4+
:100030002FEF35EA8EE0215030408040E1F700C0DC
5+
:080040000000F3CFF894FFCF9C
6+
:00000001FF

examples/avrprog_program_tiny13a.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""
2+
ATtiny13a programming example, be sure you have the '13a wired up so:
3+
ATtiny13a GND to CircuitPython GND
4+
ATtiny13a VCC to CircuitPython USB
5+
Pin 2 -> CircuitPython SCK
6+
Pin 1 -> CircuitPython MISO
7+
Pin 0 -> CircuitPython MOSI
8+
RESET -> CircuitPython D5 (or change the init() below to change it!)
9+
Drag "attiny13a_blink.hex" onto the CircuitPython disk drive, then open REPL!
10+
"""
11+
12+
import board
13+
import busio
14+
import adafruit_avrprog
15+
16+
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
17+
avrprog = adafruit_avrprog.AVRprog()
18+
avrprog.init(spi, board.D5)
19+
20+
# Each chip has to have a definition so the script knows how to find it
21+
attiny13 = avrprog.Boards.ATtiny13a
22+
23+
def error(err):
24+
""" Helper to print out errors for us and then halt """
25+
print("ERROR: "+err)
26+
avrprog.end()
27+
while True:
28+
pass
29+
30+
while input("Ready to GO, type 'G' here to start> ") != 'G':
31+
pass
32+
33+
if not avrprog.verify_sig(attiny13, verbose=True):
34+
error("Signature read failure")
35+
print("Found", attiny13['name'])
36+
37+
avrprog.write_fuses(attiny13, low=0x7A, high=0xFF)
38+
if not avrprog.verify_fuses(attiny13, low=0x7A, high=0xFF):
39+
error("Failure verifying fuses!")
40+
41+
print("Programming flash from file")
42+
avrprog.program_file(attiny13, "attiny13a_blink.hex", verbose=True, verify=True)
43+
44+
print("Done!")

0 commit comments

Comments
 (0)