LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi chip select in SPI

Hi everyone,

 

I am trying to get working 2 similar sensor with SPI connection but not able to make it work. The wiring is correct and also both seems to work individually but not able to get them working together. Also, if one sensor is select it works fine, however, now when the program is stopped and chip select is changed the other sensor does not work. So to get it working I have close the labview and run it again and then it work. I have attached my vi file below, If anyone got it working or know how to make it work it would be helpful.

 

Thanks. 

Download All
0 Kudos
Message 1 of 7
(1,251 Views)

I'm not familiar with your devices. You should give a link to a datasheet.

 

I can deduce from your LabVIEW diagram that you are trying to select both chips at the same time. Obviously this won't work. The whole idea of a Chip Select is that you select one chip at a time. So, select a chip by pulling the corresponding CS pin low, write and read data, once you're done set the CS high. Only then can you select another chip.

 

Think dataflow in your LabVIEW program, you can use the error wire to enforce it. There should only be one error wire, without any forks.

0 Kudos
Message 2 of 7
(1,233 Views)

Thanks for your reply. 

I have able to manage the turn High and Low chip select pin alternately but still not able to achieve data. I am using NI DAQ 8452. Trying to get continuous reading from it. I have attached the updated VI please let me know if there is a solution to this problem.

 

Thanks. 

0 Kudos
Message 3 of 7
(1,208 Views)

You wrote that both of them individually work. Do you mean that with all hardware wirings the same, if you try to control only 1, it works? Or you mean they work when they are electronically separated?

 

You may want to check the wiring in any case, because the updated VI you send looks ok (though I don't have the NI845x library installed).

 

With multiple devices, the SCLK, MOSI and MISO are shared with just a separate CSN pin for each device

0 Kudos
Message 4 of 7
(1,204 Views)

Hi Basjong,

 

the wire is connection proper as I have connected common MISO,MOSI,SCLK,VDD,GND to both the sensor and only SS is different from the DAQ. I have also checked the continuity of them.

 

Can It be a software issue, as when I run simple SPI labview VI and select SS 0, it works fine with first sensor and when I stop the program and then toggle the SS to 1 at that time the second sensor doesn't seems to work. However, when I close the application and reconnect the DAQ and again follow same process but at this I select SS 1 instead of 0. Then the other senor works, however when I stop the program and switch to SS (0) then first sensor doesn't work.

0 Kudos
Message 5 of 7
(1,198 Views)

I don't have experience with the NI845x library. If you have an oscilloscope or similar, you can check the signal. I'm sorry, I cannot help you further as the software looks ok to me. Maybe someone else has other idea.

0 Kudos
Message 6 of 7
(1,194 Views)

No worry Thanks a lot for your help appreciated.

0 Kudos
Message 7 of 7
(1,184 Views)