LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI example questions

Hi,

 

I am quite new to Labview and been working on a testing platform using the 7813R as a 3*SPI driver.

 

Using the the example http://zone.ni.com/devzone/cda/tut/p/id/9117 I have made 3 SPI channels within the FPGA. However I have 2 main issues I need to figure out.

 

The example only allows diasy chain (Slave select) addressing of 8 slaves per Bus and I need 32. How can I expand this? Is it even possible seeing the fpga's I/0 is ony 8-bits.

 

The example also uses 1 port for the SPI full duplex signals and 1 port for the slave selects. When I try to combine these I get an error. I really need all the signals on the same port.

 

I really hope someone can help. Tried to contact NI directly and our company is an NI partner but had no help so far.

 

Thanks in advance for any assitance. Smiley Sad

 

0 Kudos
Message 1 of 2
(3,085 Views)

Hi Eletrostatic. Basically you have to make some changes to the VI to be able to adress 32 slaves instead of 8. There are 3 options changing the CS Global Variable to u32 instead of u8, or add 3 more u8 variables, or add a portselect variable. 

   The first is change regardless of the option is  the cluster with the reference for the DIOs, basically add 3 more for the extra slaves that you need.

 

If you decided to add the 3 more U8 Variables. You will need to modify the following:

On the TOPFPGA VI Just modify de case:

  •  Init>>Configure Read here the extra variables you added. (duplicate the ones for the CS that alredy exist).

 

On the SPI_SPIPORT.vi you will need:

  • Modify the cluster with the states to handle the Extra CS
  • In the configure Hardware Case bundle the Values for the extra CS
  • In the Start Hardware case you will need to modify the SetCS State (basically duplicate the logic for the simple CS for the new ones).
  • Similar changes will happen in the Reset CS.

Probably one of the easiest ones would be just add the variable to handle the CS variable. Add the extra ports to the IO reference cluster.  And in the SetCS, And ResetCS add a case structure to just write to the port that was selected, with this you can handle the 32 slaves with the same Vi.

 

Best Regards

Benjamin C
Principal Systems Engineer // CLA // CLED
0 Kudos
Message 2 of 2
(2,912 Views)