I am trying to program an Arduino Nano using AVRDUDE via the ICSP header on the Nano and the MOSI, MISO, and SCK pins on the 40 pin expansion header on the Orin Nx (running JetPack 5.1.1 on this baseboard if this matters: https://www.seeedstudio.com/reComputer-J4012-p-5586.html).
I couldn’t get AVRDUDE to work on the Orin so I used this guide to get it working on a Raspberry Pi 3B+ (How to Program an AVR/Arduino using the Raspberry Pi GPIO - ozzmaker.com). The pin mapping done in the avrdude.conf file use the GPIO number not the pin number:
The Pi was able to register the Arduino Nano (and upload code, not shown here):
sudo avrdude -v -p m328p -c linuxgpio
avrdude: Version 7.2-20240110 (a336e47a)
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is /usr/local/etc/avrdude.conf
User configuration file is /root/.avrduderc
User configuration file does not exist or is not a regular file, skipping
Using port : gpiochip0
Using programmer : linuxgpio
AVR Part : ATmega328P
Programming modes : ISP, HVPP, debugWIRE, SPM
Programmer Type : linuxgpio
Description : Use the Linux sysfs interface to bitbang GPIO lines
Pin assignment : /sys/class/gpio/gpio{n}
RESET = 12
SCK = 11
SDO = 10
SDI = 9
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude done. Thank you.
I have installed the latest version of AVRDUDE (v7.2) & made a build for Linux enabling LinuxGPIO using these steps: Building AVRDUDE for Linux · avrdudes/avrdude Wiki · GitHub. The same commands were run on the Pi and the Orin.
For now, I am just trying to read the Arduino Nano without flashing code to it using the same command I used on the Pi. I modified linuxgpio.c and rebuilt AVRDUDE to use the Orin Nx naming convention for GPIO pins in the /sys/class/gpio folder.
When I run: sudo avrdude -v -p m328p -c linuxgpio
I get:
avrdude: Version 7.2-20231218 (67792ca8)
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is /usr/local/etc/avrdude.conf
User configuration file is /root/.avrduderc
User configuration file does not exist or is not a regular file, skipping
Using port : gpiochip0
Using programmer : linuxgpio
avrdude main() error: unable to open port gpiochip0 for programmer linuxgpio
avrdude done. Thank you.
Has anyone managed to get this working? I have tried using linuxSPI but get the same error about being unable to open the port. I have also posted on the NVIDIA forums but was told its a program specific issue rather than a hardware issue even though the code works fine on the Pi.