Skip to content

Commit 5ce72ce

Browse files
author
Pete Lewis
committed
moved isolation switch control into pi_program.sh
This makes it easier to use pi_program.sh from the command line (if you'd like to make this call without relying on test.py and the capsense)
1 parent 5c8aff4 commit 5ce72ce

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

disable_switch.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Raspberry Pi stand alone AVR programmer
2+
# DISable Isolation switch for programming via command line
3+
# SparkFun Electronics
4+
# Pete Lewis 7/13/2018
5+
6+
import RPi.GPIO as GPIO
7+
8+
GPIO.setwarnings(False)
9+
10+
GPIO.setmode(GPIO.BOARD)
11+
12+
PGM_SWITCH = 36
13+
14+
GPIO.setup(PGM_SWITCH, GPIO.OUT)
15+
16+
GPIO.output(PGM_SWITCH, GPIO.LOW)

enable_switch.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Raspberry Pi stand alone AVR programmer
2+
# Enable Isolation switch for programming via command line
3+
# SparkFun Electronics
4+
# Pete Lewis 7/13/2018
5+
6+
import RPi.GPIO as GPIO
7+
8+
GPIO.setwarnings(False)
9+
10+
GPIO.setmode(GPIO.BOARD)
11+
12+
PGM_SWITCH = 36
13+
14+
GPIO.setup(PGM_SWITCH, GPIO.OUT)
15+
16+
GPIO.output(PGM_SWITCH, GPIO.HIGH)

pi_program.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ DEVICE=atmega328p
1717
#FUSE BITS
1818
HIGH_FUSE=0xD8
1919
LOW_FUSE=0xFF
20-
EXT_FUSE=0xFD # due to masking, 0x05 = 0xFD, 0x07 = 0xFF, ***Note on an ATMEGA2560, ext fuse writes and verifies as 0xFD
20+
EXT_FUSE=0x05 # due to masking, 0x05 = 0xFD, 0x07 = 0xFF, ***Note on an ATMEGA2560, ext fuse writes and verifies as 0xFD
2121
LOCK=0x0F # due to masking, 0x0F = 0xCF
2222

23+
#enable programming isolation switch
24+
sudo python enable_switch.py
25+
2326
#erase and then write FUSE bits
2427
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 125000 -D -v -e -u -U hfuse:w:$HIGH_FUSE:m -u -U lfuse:w:$LOW_FUSE:m -u -U efuse:w:$EXT_FUSE:m 2>/home/pi/fuse_results.txt
2528

@@ -31,3 +34,6 @@ sleep 0.1
3134

3235
#program flash and lock bits
3336
sudo avrdude -p $DEVICE -C /home/pi/avrdude_gpio.conf -c linuxspi -P /dev/spidev0.0 -b 2000000 -D -v -u -U flash:w:$firmware:i -u -U lock:w:$LOCK:m 2>/home/pi/flash_results.txt
37+
38+
#DISable programming isolation switch
39+
sudo python disable_switch.py

0 commit comments

Comments
 (0)