Spi pmod pynq-z2

Hi all, I am using a Digital Thermometer (https://datasheets.maximintegrated.com/en/ds/MAX31723PMB1.pdf), which works by SPI in PMOD in the PYNQ-Z2.

I have written a code that is a kind of translation from a C code, but it always returns -1. It is as if it does not connect to the PMOD or something else is missing to make it work well. I have not found any example of SPI by PMOD to guide me.

Has anyone worked with any PMOD over SPI module on the PYNQ-Z2?, could you tell me what might be wrong or what I am missing?.

The code is as follows:

SPI

PMOD B

Connector Sup. Pmod B

lib_spi = MicroblazeLibrary(base.PMODB, [‘spi’])
lib_spi.spi_configure(spi, 1, 1)
spi = lib_spi.spi_open(3, 2, 1, 0)

length = 3
read_data = [0x01, 0x00, 0x00]

#spi.transfer(“NULL”, [0x01, 0x00], length)
spi.transfer(“NULL”, read_data, length)

print(read_data)

spi.close()

Thanks a lot!!!

1 Like

Hi,

PMOD OLED uses SPI protocol. You can take a look at it:

Thanks

2 Likes

Thanks!!!