SPI interfacing through C++

Hi there,

I’m using an SPI device with a C++ that I’d like to use and after a lot of searching haven’t been able to figure out how to interface the Nano SPI with C++.

Is this at all possible, or will I have to port the library to python and use the SPIdev module?

Thanks for your answer!


You must enable SPI pins and the spidev module.
What that module does, is expose the /dev/spi* device drivers.
You can then open and use those drivers from C/C++ code – this is what the Python module does.

Ah, I understand!
I’ll try and enable SPI and spidev using Tiryo’s script (https://github.com/rt-net/JetsonNano_DT_SPI) and see how it goes.
I found this spidev c++ library: http://linux-sunxi.org/SPIdev#Using_the_SPI_bus
Am I correct that besides modifying the device tree Tiryo’s script also takes care of the “configuring kernel” and “configuring your FEX” sections? Or would there be an additional step before jumping right to using the SPI bus examples?

Thanks for your time!

I haven’t used Tiryo’s script, but if it ends up with a loadable spidev module and the correct pin configurations in the device tree, then yes, it should be ready to go for anything that uses the /dev/spi* devices.

Thanks for the info!