Jump to content
  • 0

Waveforms SDK SPI Configuration


Thore

Question

Hello,

I'm using the Waveforms SDK with Labview and I experience some weird behavior. With FDwfDigitalSpiClockSet() I set DIO0 for the Clock. With FDwfDigitalSpiDataSet() I set DIO1 for MOSI. In the end both pin functionalities are swapped, so the CLK is on DIO1 and MOSI is on DIO0.

I first call FDwfDigitalSpiClockSet() and then FDwfDigitalSpiDataSet().

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hi @Thore

Which WaveForms version are you using?
Please verify what other functions are you calling, like FDwfDigitalSpiReset sets CLK to DIO_1

With WF v3.10.9 it works for me correctly.
The following script is executed with one device and the output captured with another device.

Digital_Spi.py

dwf.FDwfDigitalSpiFrequencySet(hdwf, c_double(1e3))
dwf.FDwfDigitalSpiClockSet(hdwf, c_int(0))
dwf.FDwfDigitalSpiDataSet(hdwf, c_int(0), c_int(1)) # 0 DQ0_MOSI_SISO = DIO-1
dwf.FDwfDigitalSpiModeSet(hdwf, c_int(0))
dwf.FDwfDigitalSpiOrderSet(hdwf, c_int(1)) # 1 MSB first

# cDQ 0 SISO, 1 MOSI/MISO, 2 dual, 4 quad
#                                cDQ       bits 0    data 0
dwf.FDwfDigitalSpiWriteOne(hdwf, c_int(0), c_int(8), c_uint(0xAB)) # write 1 byte to MOSI

image.png.5016b7b852023020f98ab38fc1707726.png

Link to comment
Share on other sites

I don't know why, but now it works. Maybe it had something to do how I close the Device Handle. What's the best practice for resetting and closing SPI? At the moment I call FDwfDigitalSpiReset(), and then close the device handle.

Link to comment
Share on other sites

On opening all the settings are reset. Essentially the close releases the memory used for device settings, 
The *reset functions are intended to be used before starting (a new) configuration. Like when an application performs multiple tasks, sequentially applies multiple setups.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...