PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

AXI SPI python code

Hell there,
Any example code for PYNQ supporting a Xilinx AXI Quad SPI in a custom overlay?
Something like the AxiIIC class but for SPI… I wouldn’t want to re-invent the wheel if anything is already available.
Best regards

I mean: I can’t use spidev, can I? the IP is in the PL so linux doesn’t know about it until the overlay is loaded…

I guess you will have to enable SPI kernel configurations and rebuild the linux kernel. One way to do it is to patch your own bsp, like this:

Well, if pynq is hugely good for anything, IMHO, it is for not having to rebuild the kernel when a different overlay is loaded… I am writing a simple AxiSPI.py module that allow me to read\write the quad spi peripheral registers, and for now it will be enough.
In the future I would like to write a class like AxiIIC using libspi.so, but it must be seen if I am going to be able (and have the time) to do so
Cheers
PS I am a board level engineer by trade and the “class” codeword in any software source still give me the shivering!!! :grinning:

Well, we cannot enable every configuration in the kernel… that will make the kernel pretty heavy… we will enable SPI in the next release though.

Just in case someone want to work on improving it. It’s rough, undocumented and garage-electronics style code as you would expect from a board designer, but works (for me…)
spi.py (3.0 KB)
it comes with no guarantees whatsoever! :grinning:

1 Like

Thanks for sharing!

Cathal