Add ATtiny13a board definitions, example upload code, and blink hex file.

This commit is contained in:
Aaron Averill 2019-08-19 22:51:04 -04:00
parent 1b62c7753a
commit 6e02697644
3 changed files with 58 additions and 0 deletions

View file

@ -59,6 +59,14 @@ class AVRprog:
""" """
Some well known board definitions Some well known board definitions
""" """
ATtiny13a = {
'name': "ATtiny13a",
'sig': [0x1E, 0x90, 0x07],
'flash_size': 1024,
'page_size': 32,
'fuse_mask': (0xFF, 0xFF, 0x00, 0x03),
'clock_speed': 100000
}
ATtiny85 = { ATtiny85 = {
'name': "ATtiny85", 'name': "ATtiny85",
'sig': [0x1E, 0x93, 0x0B], 'sig': [0x1E, 0x93, 0x0B],

View file

@ -0,0 +1,6 @@
:1000000009C00EC00DC00CC00BC00AC009C008C09A
:1000100007C006C011241FBECFE9CDBF02D012C059
:10002000EFCF81E087BB18BA98E088B3892788BBF7
:100030002FEF35EA8EE0215030408040E1F700C0DC
:080040000000F3CFF894FFCF9C
:00000001FF

View file

@ -0,0 +1,44 @@
"""
ATtiny13a programming example, be sure you have the '13a wired up so:
ATtiny13a GND to CircuitPython GND
ATtiny13a VCC to CircuitPython USB
Pin 2 -> CircuitPython SCK
Pin 1 -> CircuitPython MISO
Pin 0 -> CircuitPython MOSI
RESET -> CircuitPython D5 (or change the init() below to change it!)
Drag "attiny13a_blink.hex" onto the CircuitPython disk drive, then open REPL!
"""
import board
import busio
import adafruit_avrprog
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
avrprog = adafruit_avrprog.AVRprog()
avrprog.init(spi, board.D5)
# Each chip has to have a definition so the script knows how to find it
attiny13 = avrprog.Boards.ATtiny13a
def error(err):
""" Helper to print out errors for us and then halt """
print("ERROR: "+err)
avrprog.end()
while True:
pass
while input("Ready to GO, type 'G' here to start> ") != 'G':
pass
if not avrprog.verify_sig(attiny13, verbose=True):
error("Signature read failure")
print("Found", attiny13['name'])
avrprog.write_fuses(attiny13, low=0x7A, high=0xFF)
if not avrprog.verify_fuses(attiny13, low=0x7A, high=0xFF):
error("Failure verifying fuses!")
print("Programming flash from file")
avrprog.program_file(attiny13, "attiny13a_blink.hex", verbose=True, verify=True)
print("Done!")