diff options
author | Quentin Schulz <quentin.schulz@theobroma-systems.com> | 2024-01-25 12:52:33 +0100 |
---|---|---|
committer | Quentin Schulz <quentin.schulz@theobroma-systems.com> | 2024-02-08 12:21:55 +0000 |
commit | 86aa1f3044e3f0b64816bc90f4113c67567cd287 (patch) | |
tree | e20b19adaeeb8f977905df88d21f8398ea5f46bf | |
parent | cf5e3c6170d1e5ab5b9f8bb9db3538e16c6e1414 (diff) |
mule-attiny.sh: support Tiger v1.1
Tiger v1.1 has the UPDI lanes cut by default unless
ATtiny_GATE_CONTROL_d (GPIO0_C4) is pulled high.
Let's toggle that GPIO before flashing so that the UPDI can go through
to the ATtiny.
Since that GPIO was used for UART0 in Tiger v1.0, it is not supported
anymore (but those were engineering samples anyway).
Relates-to: TIGR-192
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
-rwxr-xr-x | mule-attiny/mule-attiny.sh | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mule-attiny/mule-attiny.sh b/mule-attiny/mule-attiny.sh index df15345..3e928b8 100755 --- a/mule-attiny/mule-attiny.sh +++ b/mule-attiny/mule-attiny.sh @@ -25,6 +25,7 @@ fi command -v avrdude >/dev/null 2>&1 || die "avrdude tool needed but not found.\nPlease run '$AVRDUDE_INSTALL_CMD'!" MODEL= +UPDI_ENABLE= for compatible in $(tr '\000' ' ' < /proc/device-tree/compatible); do case "$compatible" in "tsd,rk3588-jaguar") @@ -34,6 +35,8 @@ for compatible in $(tr '\000' ' ' < /proc/device-tree/compatible); do "tsd,rk3588-tiger") CONNECTION_PORT="/dev/ttyS4" MODEL=$compatible + # ATtiny_GATE_CONTROL_d GPIO0_C4 + UPDI_ENABLE=20 ;; *) ;; @@ -55,8 +58,22 @@ case "$1" in elif [ $# -lt 2 ] ; then usage fi + + if [ -n "$UPDI_ENABLE" ]; then + if [ ! -d "/sys/class/gpio/gpio${UPDI_ENABLE}" ]; then + echo "$UPDI_ENABLE" > /sys/class/gpio/export + fi + + echo out > "/sys/class/gpio/gpio$UPDI_ENABLE/direction" + echo 1 > "/sys/class/gpio/gpio$UPDI_ENABLE/value" + fi + echo "Flashing mule-attiny for '$MODEL'..." avrdude -c serialupdi -P "$CONNECTION_PORT" -b "$BAUDRATE" -p t816 -U flash:w:"$FIRMWARE" + + if [ -n "$UPDI_ENABLE" ]; then + echo 0 > "/sys/class/gpio/gpio$UPDI_ENABLE/value" + fi ;; --*) usage @@ -66,4 +83,4 @@ case "$1" in ;; esac -exit 0
\ No newline at end of file +exit 0 |