OK…so here is my final update. I think I got it working.
Just a reminder, I first flashed the Jetson using the SDK Manager https://developer.nvidia.com/nvidia-sdk-manager. This was how I was told to get the Jetson up and running. Only later did I decided I wanted to connect some sensors via SPI, hence my reasoning for taking on this task.
Start by following steps 1-8 above: https://devtalk.nvidia.com/default/topic/1062484/jetson-tx2/for-the-love-of-god-make-spi-easy-to-enable-/post/5381235/#5381235 Technically, you might only have to do steps 1-5 at this point. After editing the pinmux file (see below) you need to flash the system, so maybe you don’t need to do it twice? Not sure…maybe someone can comment on that. Nevertheless, I did steps 1-8 then proceeded…
Once those steps were complete, I needed to update my pinmux, as outlined in the elinux doc (https://elinux.org/Jetson/TX2_SPI). Thank god for others help on this, because I still don’t have a clue what’s going on here. On top of that, the pin-name mapping stuff is really confusing to keep track of. The file is found on the host OS in the directory created by the SDK Manager:
For the Jetson TX2, the file you want to edit is:
I found this file reading the issue: https://devtalk.nvidia.com/default/topic/1061079/problem-creating-pinmux-for-jetson-tx2-using-spi/?offset=6#5381639
Edit the file EXACTLY as outlined in the elinux doc (link above). I will copy paste for convenience
pinmux.0x02430038 = 0x00000401; # gpio_cam4_pn3: spi4, tristate-disable, input-disable
pinmux.0x02430040 = 0x00000455; # gpio_cam5_pn4: spi4, pull-down, tristate-enable, input-enable
pinmux.0x02430048 = 0x00000401; # gpio_cam6_pn5: spi4, tristate-disable, input-disable
pinmux.0x02430050 = 0x00000409; # gpio_cam7_pn6: spi4, pull-up, tristate-disable, input-disable
After editing the file
- Start the Jetson board in recovery mode such that it is ready to be flashed from host
- Returning to the host,
- sudo ./flash.sh jetson-tx2 mmcblk0p1
NOTE there is a difference between the last command and that of step 8 (link above). The last command ended up flashing a “fresh new system”, whereas the previous step 8 flash (link above) appears to only update, as opposed to overwrite, the system. This is why I question the need to perform step 8 (link above) prior to editing the pinmux file.
Finally, the elinux doc (link above) states you need (1) obtain and (2) compile spidev_test.c to a binary. The SDK Manager does not provide the source file, so it must be downloaded with the L4T Source files. I have a detailed write up explaining how I performed these steps here: https://devtalk.nvidia.com/default/topic/1061072/jetson-tx2/problem-running-the-test-for-spi/post/5381260/#5381260
On the Jetson
After everything above is complete, we should be able to run the spidev_test binary that was copied to the Jetson (see detailed write up in link above). After connecting the jumper wire and running the script, my test output reads:
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@......................ð
NOTE: This is not the same exact output as found in the elinux doc (link above). But, if you read the spidev_test.c source code back on the host (see detailed write up in link above), the variable “uint8_t default_tx” does get assigned this transmit sequence which loops back. I don’t know what the trailing gibberish is, but the rest looks like everything works.
Please, follow up with posts to correct my errors as this is my first time performing this. It is highly likely I could have made a mistake.