From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with NI 8451 CS lines all responding

Hi, im a newbie to labview and was hoping for some help as im using the SPI script examples to perform a write using the USB NI 8451 and am noticing regardless of which CS line is selected as a constant to be exercised during the write, that all remaining CS lines will also respond.  I was expecting the unused lines to be either held high, low or tristate.  

 

Im ultimately trying to perform writes using 4 different devices and need the unused CS lines to remain preferably high and cant tell how to configure this in the script.

 

Thanks for the help.

0 Kudos
Message 1 of 4
(740 Views)

You didn't provide your code (pictures are useless -- VIs or nothing), you didn't provide a description of the circuit and chip(s) you were using.  I've used the 845x SPI devices when I was first learning about SPI.  As you probably know, CS means "Chip Select", and is asserted on the one Chip you wish to respond to the other SPI signals, SCLK, MOSI, and MISO.  In our case, we used other circuitry driven by an NI USB DIO module to enable us to route CS to the A/D chip.  We do that first, then use the other 845x commands to send the SPI signals that our A/D chip requires to configure it, to tell it to convert, and then by writing MOSI to it, we got it to MISO us back the sampled data.

 

I have no idea what you are doing, and cannot advise you how to fix it unless you provide more information.

 

Bob Schor

0 Kudos
Message 2 of 4
(702 Views)

The documentation for the 845x seems a bit vague on how you should communicate with multiple slaves using the Scripting API (and the other APIs seem less preferable currently?), but it appears if you're not 'enabled', things should be in tristate.

 

I'd suggest trying the following:

 

a) ensure your CS lines are indeed wired to the CS pins on the device, and that those are what you're monitoring with your oscilloscope/whatever (worth checking just in case 😉 )

 

b) Call all of the setup VIs as you're already doing in the 2nd box.

c) Add a For loop with an array of all your CS lines as numeric constants as the autoindexing input - wire these into the "SPI Script CS High.vi" node (use a Shift Register for the reference, just in case...)

 

d) proceed with the rest of your code (from the CS Low node to the Disable). So the For loop should be at the very beginning of your 3rd box (or between boxes 2 and 3).

 

If you go on to use this in an application, I'd imagine you might not want to Enable/Disable in a loop, and would prefer to just call the Run Script node in the loop after configuring first, but I'm not familiar with the 845x, so I can't say for sure. (I've used SPI from scratch on cRIO+FPGA, which is both easier (everything is very clear and straightforward, no hidden behaviour) and harder (you have to do everything....)


GCentral
0 Kudos
Message 3 of 4
(693 Views)

Thanks for the responses i appreciate it.  I will give the loop method a shot.

 

What i am seeing is from even using the example library SPI scripts for the USB8451, that although the CS line is set to use the CS0 port, that CS1-7 are also being cycled simultaneously.   I have verified using an oscope.    I would have thought the device would hold the unused CS lines either at a logic high or tristate.  

 

I am basically using the USB 8451 to perform a 1 byte write to two variable gain amplifiers Mini CIrcuits DVGA-201 with predefined 1 byte values.  When i run my script, all CS0-7 are being enabled when i have the CS script set to 0 using a numeric constant.  

 

I have now migrated to a myRio as i had one on hand and i can get discrete chip select to work with that device.

0 Kudos
Message 4 of 4
(684 Views)