Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-9401as SPI Slave Device

Hello Members,

I have an SPI master device which sends data to slave device. In response to Master data , slave device sends 6 byte of data and this process go repeatedly. I was trying to use NI 8452 but this can only be used as SPI master. Therefore i am trying to use NI 9401 and cDAQ chassis NI 9178. 

My connection are as follows;

 

1. Master Clock into PF0 (in  cDAQ NI 9178 Chassis)

2. Master; MOSI into NI 9401 Input Number 0.

3. Master MISO into NI 9401 Input Number 7 .

 

The read data from Master SPI device is working fine but writing data from SPI Slave to Master is not working.

Thanks

 

Regards

Muhammad

0 Kudos
Message 1 of 10
(3,651 Views)

Hi MuhammadShazor,

 

Are you receiving an error when you run your code, or is it not behaving as expected? What is the behavior you are observing? In addition, could you attach your code?

Brian.D
NI Product Owner
VeriStand
0 Kudos
Message 2 of 10
(3,619 Views)

Hello Brain,

Thanks for your response. As per now, I am not getting any error and I can visualize my data is being sent to the device but I am not getting any digital pulses at master device .

 

Regards

Muhammad Shazor

 

0 Kudos
Message 3 of 10
(3,604 Views)

It looks like you may have already created a service request with us at NI for this issue, and it will probably be easier to troubleshoot through that process. A couple of thoughts:

  • I assume the NI 9401 works fine on its own (i.e. you can run simple DIO tasks and verify you can read/write on the channels)
  • Have you probed channel 7 (your MISO line) to see what is being output?
Brian.D
NI Product Owner
VeriStand
0 Kudos
Message 4 of 10
(3,593 Views)

Thanks for your reply . I have checked the DIO module using as Digital Outputs. It is working fine . I have also checked the MISO line using probe but i did not get any data. 

Do you have any idea or thoughts on this issue.

0 Kudos
Message 5 of 10
(3,583 Views)

What data have you tried writing in your array out?

Brian.D
NI Product Owner
VeriStand
0 Kudos
Message 6 of 10
(3,568 Views)

Hello Brain,

The issue related to data writing is accomplished . Now I successfully write data from SPI slave device to my SPI Master device. The problem I am getting now is losing some data.

 

My logic is implemented as:

I am receiving data from SPI master using MOSI . On this line as soon as I received “E8” , my slave device should send data consist of 6 bytes. The master device only receive data when clock is present.

But I will lose some data which is transferred when clock is high as shown in attachment. In this way I will get wrong data on MISO line.

may you please let me know how to overcome this issue.

 

Thanks

 Best Regards

Muhammad Shazor

Tenneco

0 Kudos
Message 7 of 10
(3,559 Views)

I believe that behavior is due to the clock signal you are importing. What is the master clock signal that you are importing?

Brian.D
NI Product Owner
VeriStand
0 Kudos
Message 8 of 10
(3,532 Views)

Hello Brain,

The clock signal I am importing from SPI master device. My sending data is not synchronizing with clock signal . Therefore I am loosing data which result in wrong data to be read at master spi device.

 

Thanks

0 Kudos
Message 9 of 10
(3,505 Views)

If you have a service request open, it may easier to continue troubleshooting through that path. Could you further describe the clock signal? The DAQ device waits for a rising edge, so this could be due to your clock.

Brian.D
NI Product Owner
VeriStand
0 Kudos
Message 10 of 10
(3,491 Views)