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. I am using the Seeed Studio base board with the Orin Nx 16GB (https://www.seeedstudio.com/reComputer-J4012-p-5586.html) and have Jetpack 5.1.1 installed.
I used jetson-io.py to configure the MOSI, MISO, and SCK pins. I connected wires according to the datasheet for the base board & jetsion-io, MOSI on pin 19, MISO on pin 21, and SCK on pin 23. I picked pin 32 as the reset pin.
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.
When I run: sudo avrdude -v -p m328p -c linuxgpio
I get:
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
avrdude linuxgpio_sysfs_open() OS error: cannot export GPIO 12, already exported/busy?: Invalid argument
avrdude main() error: unable to open port gpiochip0 for programmer linuxgpio
avrdude done. Thank you.
I found a similar post (AVRDUDE and LinuxGPIO Issues) but this doesn’t seem to show me how to get it working. The MOSI, MISO, and SCK pins are in the same location on the Pi and the Nano so I kept the avrdude.conf file the same (using the Pi GPIO numbers on the Orin). I also tried using the actual pin numbers but I get:
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 : GPIO
Using programmer : linuxgpio
avrdude linuxgpio_sysfs_open() OS error: cannot export GPIO 32, already exported/busy?: Invalid argument
avrdude main() error: unable to open port GPIO for programmer linuxgpio
avrdude done. Thank you.
I have also tried connecting a logic analyzer to the MOSI and MISO pins and putting a jumper cable between them. I then ran some test code and confirmed a signal is being sent and received so I am fairly confident I have the GPIO pins configured correctly but I could be wrong.
Has anyone been able to flash an Arduino from a Jetson device using a ICSP connection?
Not sure if this is helpful but I also ran this command:
sudo cat /sys/kernel/debug/gpio
[sudo] password for dev:
gpiochip1: GPIOs 316-347, parent: platform/c2f0000.gpio, tegra234-gpio-aon:
gpio-316 (PAA.00 )
gpio-317 (PAA.01 )
gpio-318 (PAA.02 )
gpio-319 (PAA.03 )
gpio-320 (PAA.04 )
gpio-321 (PAA.05 |fixed-regulators:reg) out hi
gpio-322 (PAA.06 )
gpio-323 (PAA.07 )
gpio-324 (PBB.00 )
gpio-325 (PBB.01 )
gpio-326 (PBB.02 )
gpio-327 (PBB.03 )
gpio-328 (PCC.00 )
gpio-329 (PCC.01 )
gpio-330 (PCC.02 )
gpio-331 (PCC.03 |mux ) out hi
gpio-332 (PCC.04 )
gpio-333 (PCC.05 )
gpio-334 (PCC.06 )
gpio-335 (PCC.07 )
gpio-336 (PDD.00 )
gpio-337 (PDD.01 )
gpio-338 (PDD.02 )
gpio-339 (PEE.00 )
gpio-340 (PEE.01 )
gpio-341 (PEE.02 )
gpio-342 (PEE.03 )
gpio-343 (PEE.04 |power-key ) in hi IRQ ACTIVE LOW
gpio-344 (PEE.05 )
gpio-345 (PEE.06 )
gpio-346 (PEE.07 )
gpio-347 (PGG.00 )
gpiochip0: GPIOs 348-511, parent: platform/2200000.gpio, tegra234-gpio:
gpio-348 (PA.00 |fixed-regulators:reg) out lo
gpio-349 (PA.01 )
gpio-350 (PA.02 )
gpio-351 (PA.03 )
gpio-352 (PA.04 )
gpio-353 (PA.05 )
gpio-354 (PA.06 )
gpio-355 (PA.07 )
gpio-356 (PB.00 )
gpio-357 (PC.00 )
gpio-358 (PC.01 )
gpio-359 (PC.02 )
gpio-360 (PC.03 )
gpio-361 (PC.04 )
gpio-362 (PC.05 )
gpio-363 (PC.06 )
gpio-364 (PC.07 )
gpio-365 (PD.00 )
gpio-366 (PD.01 )
gpio-367 (PD.02 )
gpio-368 (PD.03 )
gpio-369 (PE.00 )
gpio-370 (PE.01 )
gpio-371 (PE.02 )
gpio-372 (PE.03 )
gpio-373 (PE.04 )
gpio-374 (PE.05 )
gpio-375 (PE.06 )
gpio-376 (PE.07 )
gpio-377 (PF.00 )
gpio-378 (PF.01 )
gpio-379 (PF.02 )
gpio-380 (PF.03 )
gpio-381 (PF.04 )
gpio-382 (PF.05 )
gpio-383 (PG.00 |force-recovery ) in hi IRQ ACTIVE LOW
gpio-384 (PG.01 )
gpio-385 (PG.02 )
gpio-386 (PG.03 )
gpio-387 (PG.04 )
gpio-388 (PG.05 )
gpio-389 (PG.06 )
gpio-390 (PG.07 |cd ) in lo IRQ
gpio-391 (PH.00 )
gpio-392 (PH.01 )
gpio-393 (PH.02 )
gpio-394 (PH.03 )
gpio-395 (PH.04 )
gpio-396 (PH.05 )
gpio-397 (PH.06 )
gpio-398 (PH.07 )
gpio-399 (PI.00 )
gpio-400 (PI.01 )
gpio-401 (PI.02 )
gpio-402 (PI.03 )
gpio-403 (PI.04 )
gpio-404 (PI.05 )
gpio-405 (PI.06 )
gpio-406 (PJ.00 )
gpio-407 (PJ.01 )
gpio-408 (PJ.02 )
gpio-409 (PJ.03 )
gpio-410 (PJ.04 )
gpio-411 (PJ.05 )
gpio-412 (PK.00 )
gpio-413 (PK.01 )
gpio-414 (PK.02 )
gpio-415 (PK.03 )
gpio-416 (PK.04 )
gpio-417 (PK.05 )
gpio-418 (PK.06 )
gpio-419 (PK.07 )
gpio-420 (PL.00 )
gpio-421 (PL.01 )
gpio-422 (PL.02 |nvidia,pex-wake ) in hi ACTIVE LOW
gpio-423 (PL.03 )
gpio-424 (PM.00 )
gpio-425 (PM.01 )
gpio-426 (PM.02 )
gpio-427 (PM.03 )
gpio-428 (PM.04 )
gpio-429 (PM.05 )
gpio-430 (PM.06 )
gpio-431 (PM.07 )
gpio-432 (PN.00 )
gpio-433 (PN.01 )
gpio-434 (PN.02 )
gpio-435 (PN.03 )
gpio-436 (PN.04 )
gpio-437 (PN.05 )
gpio-438 (PN.06 )
gpio-439 (PN.07 )
gpio-440 (PP.00 )
gpio-441 (PP.01 )
gpio-442 (PP.02 )
gpio-443 (PP.03 )
gpio-444 (PP.04 )
gpio-445 (PP.05 )
gpio-446 (PP.06 )
gpio-447 (PP.07 )
gpio-448 (PQ.00 )
gpio-449 (PQ.01 )
gpio-450 (PQ.02 )
gpio-451 (PQ.03 )
gpio-452 (PQ.04 )
gpio-453 (PQ.05 )
gpio-454 (PQ.06 )
gpio-455 (PQ.07 )
gpio-456 (PR.00 )
gpio-457 (PR.01 )
gpio-458 (PR.02 )
gpio-459 (PR.03 )
gpio-460 (PR.04 )
gpio-461 (PR.05 )
gpio-462 (PX.00 )
gpio-463 (PX.01 )
gpio-464 (PX.02 )
gpio-465 (PX.03 )
gpio-466 (PX.04 )
gpio-467 (PX.05 )
gpio-468 (PX.06 )
gpio-469 (PX.07 )
gpio-470 (PY.00 )
gpio-471 (PY.01 )
gpio-472 (PY.02 )
gpio-473 (PY.03 )
gpio-474 (PY.04 )
gpio-475 (PY.05 )
gpio-476 (PY.06 )
gpio-477 (PY.07 )
gpio-478 (PZ.00 )
gpio-479 (PZ.01 |vbus ) in hi IRQ ACTIVE LOW
gpio-480 (PZ.02 )
gpio-481 (PZ.03 )
gpio-482 (PZ.04 )
gpio-483 (PZ.05 )
gpio-484 (PZ.06 )
gpio-485 (PZ.07 )
gpio-486 (PAC.00 )
gpio-487 (PAC.01 )
gpio-488 (PAC.02 )
gpio-489 (PAC.03 )
gpio-490 (PAC.04 )
gpio-491 (PAC.05 )
gpio-492 (PAC.06 )
gpio-493 (PAC.07 )
gpio-494 (PAD.00 )
gpio-495 (PAD.01 )
gpio-496 (PAD.02 )
gpio-497 (PAD.03 )
gpio-498 (PAE.00 )
gpio-499 (PAE.01 )
gpio-500 (PAF.00 )
gpio-501 (PAF.01 )
gpio-502 (PAF.02 )
gpio-503 (PAF.03 )
gpio-504 (PAG.00 )
gpio-505 (PAG.01 )
gpio-506 (PAG.02 )
gpio-507 (PAG.03 )
gpio-508 (PAG.04 )
gpio-509 (PAG.05 )
gpio-510 (PAG.06 )
gpio-511 (PAG.07 )