Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5355

NI USB-8452 SPI Stream API

$
0
0

  I am using a CVI/LabWindows setup to access a DUT using a SPI serial interface.  I am using the NI USB-8452 controller to communicate over the serial interface.  Due to the inherent long delays between signal edges in the standard SPI communication, I have switched to SPI Stream API mode.  This has allowed me to configure the timing edges to desired values between the standard SPI I/O.  The 8452 is the master and is driving CS/SCLK/MOSI while getting MISO back from the DUT.

 

  I am using this mode successfully, but now I want to configure the data being sent to the slave in a particular manner, and I haven’t figured out a way to do this with the streaming commands available to me.  I have attached a timing diagram from the NI-845x Hardware and Software Manual, which shows the various signals and the timing parameters available.

 

I am trying to find a way to change the data that is contained in the first “nBits” packet to a different set of data for the second “nBits” packet.  I would like to alternate between the data sets, with just the definable T9 timing parameter (CS inactive) separating the packets.  If I drive these out as separate packets, I get a 3.5ms delay between packets, which is not allowing me to sample quickly enough.  I do, however, need an inactive CS between the alternating packets, so I can’t just lump them all into one “nBits” packet.

 

  I have set NumBits, NumSamples, and MosiData to values that I hoped would work.  I have tried different variations of them.  I can get the first 6 bytes of MosiData repeating over and over again, with an inactive CS between packets, but I can’t get the second set of 6 bytes to come out on alternating packets.  For this scenario, I set NumBits to 48 (8 bits * 6 bytes), NumSamples to 4 (just to see if the alternating pattern would repeat), and MosiData to a large array of data containing the same 12 bytes repeated multiple times.

 

  It seems I have to set up all parameters and then perform StreamStart, StreamRead, and StreamStop.  I haven’t been successful trying to change the parameters between StreamStart and SteamStop (e.g. doing a StreamRead, change parameters, then doing another StreamRead).

 

BTW, if there is another way to accomplish this, please let me know also.

 

Thanks!


Viewing all articles
Browse latest Browse all 5355

Trending Articles