PYNQ: PYTHON PRODUCTIVITY

PYNQ Z1 SPI CLK slower than expected

Hello,

I am trying to use the SPI interface on pmodA of the pynq Z1 to do a 3 byte transfer to a DAC module. However when I measure the SPI CLK it comes out to be ~14 kHz rather than 6.25 MHz as claimed in the documentation. My code is provided below:

from pynq.overlays.base import BaseOverlay
from pynq.lib import MicroblazeLibrary
from time import sleep
import numpy as np

base = BaseOverlay(‘base.bit’)
lib = MicroblazeLibrary(base.PMODA, [‘spi’])

#1st 4 pins from right side of PmodA
device = lib.spi_open(0,1,2,3) #spi_open(spiclk,miso,mosi,ss)
lib.spi_open_device(device)
device.configure(0, 1) #spi_configure(spi dev_id, unsigned int clk_phase, unsigned int clk_polarity)

writeBuf = bytearray(3)
readBuf = bytearray(3)
readBuf[0] = 0
readBuf[1] = 0
readBuf[2] = 0
MSB= (data >> 10)|0x40
ISB = data >> 2
LSB = (data & 0x3)<<6

writeBuf[0] = np.uint8(MSB)
writeBuf[1] = np.uint8(ISB) 
writeBuf[2] = np.uint8(LSB)

wr = np.array(writeBuf,dtype='int8')
rd = np.array(readBuf,dtype='int8')

device.transfer(wr,rd,3);

Any help would be greatly appreciated.

Thank you

How are you measuring this?

Cathal

Hi,

I am using an oscilloscope to measure the SPI CLK pin output while continuously sending a signal.