I had a buster image which I booted an RPi3 with. Instead of running the flash script as written, I went through the commands manually, since I was apprehensive of the difference in Raspbian version and also the actual drivers in this image. The core of the script is to remove the snd_soc_pisound driver and adding the dtoverlay that adds spidev support, before running avrdude with the appropriate arguments. However, avrdude wanted to use gpio24 which seemed to be in use by one of the drivers in this particular (Zynthian) image. After some fruitless rmmoding I gave up. Booting a bullseye image (also Zynthian, but configured differently) was more hopeful because gpio24 was free, although the numbering was different, so GPIO24 corresponds to gpio536 . At this point I hacked avrdude to use gpio536 instead of gpio24 (see patch below), which seemed to work; running avrdude seemed to terminate as expected:
root@zynthian:~/src/pisound-firmware# sudo avrdude -c linuxspi -p t841 -b 150000 -P /dev/spidev0.0 -U flash:w:pisound.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9315
avrdude: NOTE: “flash” memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “pisound.hex”
avrdude: input file pisound.hex auto detected as Intel Hex
avrdude: writing flash (1466 bytes):
Writing | ################################################## | 100% 0.85s
avrdude: 1466 bytes of flash written
avrdude: verifying flash memory against pisound.hex:
avrdude: load data flash data from input file pisound.hex:
avrdude: input file pisound.hex auto detected as Intel Hex
avrdude: input file pisound.hex contains 1466 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.40s
avrdude: verifying …
avrdude: 1466 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:D7, L:EF)
avrdude done. Thank you.
Now to test if this made a difference, but it looks hopeful so far.
avrdude patch:
diff --git a/avrdude/avrdude.conf.in b/avrdude/avrdude.conf.in
index 7e83c26..ecc57e4 100644
--- a/avrdude/avrdude.conf.in
+++ b/avrdude/avrdude.conf.in
@@ -1271,7 +1271,7 @@ programmer
id = "linuxspi";
desc = "Use Linux SPI device in /dev/spidev*";
type = "linuxspi";
- reset = 24;
+ reset = 536;
baudrate=400000;
;
diff --git a/avrdude/pindefs.h b/avrdude/pindefs.h
index c060708..df33231 100644
--- a/avrdude/pindefs.h
+++ b/avrdude/pindefs.h
@@ -57,7 +57,7 @@ enum {
#define PIN_MASK (UINT_MAX>>1)
#define PIN_INVERSE (~(PIN_MASK)) /* flag for inverted pin in serbb */
#define PIN_MIN 0 /* smallest allowed pin number */
-#define PIN_MAX 31 /* largest allowed pin number */
+#define PIN_MAX 1023 /* largest allowed pin number */
#ifdef HAVE_LINUX_GPIO
/* Embedded systems might have a lot more gpio than only 0-31 */