Skip to content

Commit 070b364

Browse files
committed
Adding a custom chip definition to the ATmega2560 example
1 parent 4c0b340 commit 070b364

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

examples/avrprog_program_mega2560.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Arduino Mega 2560 programming example, be sure you have the Mega/2560 wired up so:
33
Mega Ground to CircuitPython GND
4-
Mega 5V to CircuitPythong USB or make sure the Trinket is powered by USB
4+
Mega 5V to CircuitPython USB or make sure the Trinket is powered by USB
55
Pin 52 -> CircuitPython SCK
66
Pin 50 -> CircuitPython MISO - Note this is backwards from what you expect
77
Pin 51 -> CircuitPython MOSI - Note this is backwards from what you expect
@@ -17,8 +17,18 @@
1717
avrprog = adafruit_avrprog.AVRprog()
1818
avrprog.init(spi, board.D5)
1919

20-
# Each chip has to have a definition so the script knows how to find it
21-
atmega2560 = avrprog.Boards.ATmega2560
20+
# To program a chip, you'll need to find out the signature, size of the flash,
21+
# flash-page size and fuse mask. You can find this in the datasheet or in
22+
# avrdude.conf located at:
23+
# http://svn.savannah.nongnu.org/viewvc/*checkout*/avrdude/trunk/avrdude/avrdude.conf.in
24+
# You can also use the predefined values in AVRprog.Boards
25+
atmega2560 = {
26+
'name': "ATmega2560",
27+
'sig': [0x1E, 0x98, 0x01],
28+
'flash_size': 262144,
29+
'page_size': 256,
30+
'fuse_mask': (0xFF, 0xFF, 0x07, 0x3F)
31+
}
2232

2333
def error(err):
2434
""" Helper to print out errors for us and then halt """

0 commit comments

Comments
 (0)