Hello. I’m currently writing an application for the Arduino IOP on the PYNQ-Z1 to communicate with a sensor via SPI. I have the sensor connected to the SPI header and am using the Xilinx-provided SPI library (boards/sw_repo/pynqmb/src/spi.h); however, I cannot find any mention in the docs or examples of what pin numbers are associated with the dedicated SPI pins to be passed as args to the spi_open() function.
Right now, I’m using the following pin assignments:
const unsigned int SPICLK_PIN = 13;
const unsigned int MISO_PIN = 12;
const unsigned int MOSI_PIN = 11;
const unsigned int SS_PIN = 10;
I’m thus far unable to communicate with the sensor, and the MicroBlaze program seems to consistently hang on the first attempted SPI transfer. For reference, here is my IOP program source and here is the associated Python wrapper as well.
You need to first find out which spi controller you want to use. If it is not SPI controller 0, you will have to use spi_open_device() instead (PYNQ/spi.c at master · Xilinx/PYNQ · GitHub).
Pins are correct, but it might be on the other SPI controller. There are 2 SPI controllers, one connected to the dedicated header pin, the other connected to pin 10-13.
I’d like to use the two SPI controllers at the same time, but where can I find the correspondence of the int number of the pins and their names? Is the picture you posted here from a public documentation? Can you share it?
Hey rock, thanks for the reply!
So my understanding is shown in the code below. I’m using the base.bit and the code would go into the MB processor in base.ARDUINO.
I haven’t got the chance to test the code yet. But would assume this is what you mean. Otherwise I just don’t know how to refer to these PINs when writing C code for the MB processor.
Could you please let me know if it’s also possible to use the other Arduino pins (0-10) as slave select? I am trying to connect multiple slaves for my requirement.