I am building an SPI proof of concept for the Analog Discovery 2 in LabVIEW and I am unable to get the entire thing working, despite other successful LabVIEW projects that use the Analog Discovery 2. The issue I am having is that I am capable of generating an SPI message output where the AD2 is the master, but I am unable to get the expected response in the Rx array.
The pinout is the clock is on pin 2, the chip select is on pin 1, the MOSI_SISO is on pin 4 and these three outputs are connected to an oscilloscope for observation. The MISO is on pin 7 and is connected to a pullup resistor to 3.3V on a supply separate from the AD2.
I perform the following function calls in the following order after opening the AD2 and enabling the internal AD2 power supplies: DigitalSpiReset(hdwf), DigitalSpiClockSet(hdwf, 2), DigitalSpiDataSet(hdwf, 0, 4), DigitalSpiDataSet(hdwf, 1, 7), DigitalSpiSelect(hdwf, 1, 1), DigitalSpiFrequencySet(hdwf, 1000000), DigitalSpiModeSet(hdwf, 1), DigitalSpiOrderSet(hdwf, 1).
I perform the following function calls in a while loop to continually send and receive a SPI message: DigitalSpiSelect(hdwf, 1, 0), DigitalSpiWriteRead(hdwf, 1, 8, Tx array, 2, RXarray, 2), DigitalSpiSelect(hdwf, 1, 1).
If these functions worked as expected, I should get an Rx array back that has the values 0xFF for elements 0 and 1. Instead I get an Rx array back with 0 for elements 0 and 1.
If I perform the exact same setup in waveforms, I can get the expected response with the exact same wiring setup. Please see the screenshot attached to this post.
I am scratching my head on this one. I can achieve the expected results in Waveforms, so I know my hardware is working properly, but I cannot get them working in my own program. I don't know if I am missing an important SPI function call or what.
Edit: I applied a scope probe to the MISO pin as well and the MISO pin is pulling down the input voltage as if it were an output. So my problem seems to be that the MISO line is not being correctly set as an input.
Question
Chris Pouzou
Hello,
I am building an SPI proof of concept for the Analog Discovery 2 in LabVIEW and I am unable to get the entire thing working, despite other successful LabVIEW projects that use the Analog Discovery 2. The issue I am having is that I am capable of generating an SPI message output where the AD2 is the master, but I am unable to get the expected response in the Rx array.
The pinout is the clock is on pin 2, the chip select is on pin 1, the MOSI_SISO is on pin 4 and these three outputs are connected to an oscilloscope for observation. The MISO is on pin 7 and is connected to a pullup resistor to 3.3V on a supply separate from the AD2.
I perform the following function calls in the following order after opening the AD2 and enabling the internal AD2 power supplies: DigitalSpiReset(hdwf), DigitalSpiClockSet(hdwf, 2), DigitalSpiDataSet(hdwf, 0, 4), DigitalSpiDataSet(hdwf, 1, 7), DigitalSpiSelect(hdwf, 1, 1), DigitalSpiFrequencySet(hdwf, 1000000), DigitalSpiModeSet(hdwf, 1), DigitalSpiOrderSet(hdwf, 1).
I perform the following function calls in a while loop to continually send and receive a SPI message: DigitalSpiSelect(hdwf, 1, 0), DigitalSpiWriteRead(hdwf, 1, 8, Tx array, 2, RXarray, 2), DigitalSpiSelect(hdwf, 1, 1).
If these functions worked as expected, I should get an Rx array back that has the values 0xFF for elements 0 and 1. Instead I get an Rx array back with 0 for elements 0 and 1.
If I perform the exact same setup in waveforms, I can get the expected response with the exact same wiring setup. Please see the screenshot attached to this post.
I am scratching my head on this one. I can achieve the expected results in Waveforms, so I know my hardware is working properly, but I cannot get them working in my own program. I don't know if I am missing an important SPI function call or what.
Edit: I applied a scope probe to the MISO pin as well and the MISO pin is pulling down the input voltage as if it were an output. So my problem seems to be that the MISO line is not being correctly set as an input.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.