LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extra SPI clocks

Hi All, I have a problem using an NI USB-8451 to read data from a 2-byte shift register with an active high chip select input, using SPI. When I examine the waveforms with a scope I can see the Chip select go high exactly as expected, followed some 800 Us later by two burst of 8 clocks. The MISO lines show the expected data during these bursts. Perfect so far and the data returned is correct. But I'm puzzled by two extra burst of 8 clocks, which occur another 900us or so later, just before the chip select is returned low. (The MISO line remains high this time, presumably because 1's have been shifted in from the open-circuit serial-in pin at the front of the shift register.)

The only activity in the program during that 900us interval is a call to the NI 845x SPI Extract Script Read. This returns the data previously read from the shift register. Should this be producing SPI clocks. If so why? If not where might these extra two bytes worth of clocks be coming from? They don't deem to be corrupting my data in this instance but I would like to understand what's going on for the future, as we have lots of SPI-based boards to write test programs for.

The vi doing the SPI interaction is attached.

Thank you

George

 

0 Kudos
Message 1 of 4
(3,470 Views)

Hi George,

 

Hope you are doing well today!

 

I went through your code with a scope and confirmed what you saw. This was due to that the program was calling the "SPI Run Script.vi" several times. In fact you only need to call this VI once as specified in the software user manual for NI-845x (find the flowchart on page 7-4).

 

I have done some modifications to your code and uploaded as an attachment. Please try to run it and see if it meets your requirements and let me know how it goes. 🙂

Message Edited by Mark M on 10-23-2008 05:19 PM
Best regards,

Mark M.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(3,428 Views)

Hi George,

 

How did you get on with it? Did you solve the issue?

Best regards,

Mark M.
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 3 of 4
(3,404 Views)
Hi Mark,
thank you for taking the trouble to reply to my posting. Your answer was delayed by our Spam intercepting software so I've only just downloaded it. I'll look at it in the morning and let you know if it works.
Regards
George
0 Kudos
Message 4 of 4
(3,394 Views)