LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital output doesn't work in a software programmed SPI communication

Hi, I have a labview vi. which is used to achieve SPI communication. 

 

In the circled area, as you can see, I placed a probe there from which I can tell the true/false values are transferred to the write.vi. But I measured the corresponding digital output channels using osciliscope and they are always at low level, so I think the digital output doesn't work. But I don't know what's the exact problem. Could anyone give me some suggestions?

 

The program is attached.  Thanks.

360反馈意见截图162303139211186.jpg

Download All
0 Kudos
Message 1 of 14
(4,563 Views)

Hi cli,

 

cleaning up a block diagram also helps to understand your VI…

 

Why do you use a timed loop? Why don't you use hardware-timed digital output? What kind of hardware do you use at all?

Why do you mix "standard" DAQmx functions with all those ExpressVIs?

Do you get any errors with all those DAQmx functions?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(4,550 Views)

Thanks for your reply. 

 

The hardware I use is NI USB 6008. 

 

This program is not made by me. I got it from somewhere else. Before I make any changes to the program, I would like to make sure it works as the developer said. 

 

I didn't get any errors when running the program. 

 

I spent quite some time on this and I think I undersand the function. The loop is to work as a Clock. There is one channel functions as clock. This channel output high at one cyle and low at next cycle and continues to work as a clock signal. 

 

Ideally, the true/fulse values are gonna be writed to the channels, but they weren't. I haven't figure out the problem. 

 

0 Kudos
Message 3 of 14
(4,537 Views)

How do you know there are no errors? There's no error handling that I see in the code. Did you probe your error wires?

 

Did you get your code from someone who also used a USB 6008, or did they use different hardware? Is your USB 6008 configured identically (is the device name correct, for example)?

 

Have you tested out some simple code with the USB 6008 to see that you can set the output level? That would be a good place to start - write some much simpler code to toggle the output channels.

0 Kudos
Message 4 of 14
(4,520 Views)

Hi nathand, 

 

Thanks for your reply. 

 

I probe the error wire and did find one error. (I never know I can also probe the error wire before). 

 

Well, the error is 

 

 

Error -200452 occurred at Property Node DAQmx Channel (arg 3) in subvi1.vi:3190001->GsensorCtrl.vi

Possible reason(s):

Specified property is not supported by the device or is not applicable to the task.

Property: DO.OutputDriveType
Channel Name: CSI

Task Name: _unnamedTask<1D>

 

The device I use is NI USB 6008 while the developer use NI USB 6009. I though they are pretty much the same, everything is the same except bit resolution and sampling rate. 

 

Now it seems 6008 doesn't support Property: DO.OutputDriveType. 

 

Information about this property from help document is 

360反馈意见截图162303139211186.jpg

 

Then I searched the specification of NI 6008 and Ni 6009 and found this. 

 

360反馈意见截图162303139211186.jpg

 

 

In the program, this property is set Activie drive. But seems usb 6008 doesn't have this function. Is there any method that I can use 6008 to acheve function same as active drive? 

 

Thanks. 

0 Kudos
Message 5 of 14
(4,508 Views)

You would need to add external circuitry to add an active driver to the USB 6008. Are you sure you need active drive? The USB 6008 will still output 5V when the output is on, it just can't supply much current at that level. For signaling purposes such as SPI it should work fine.

0 Kudos
Message 6 of 14
(4,500 Views)

Hi cli,

 

as Nathan wrote you would need to add additional external circuitry to achieve the ActiveDrive feature. This would add some cost for hardware, PCB, and time needed for soldering. I guess buying an USB6009 would be cheaper…

Even cheaper would be to use some simple USB sticks. There are sticks availabe which provide a SPI interface, while you can program them using the virtual COM port (VCP) they provide!

 

I hope you learned from this thread to read manuals before starting to use/create software!

And I hope you beat this other developer with a big club because of the badly written code you got from him/her! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 14
(4,475 Views)

Hi nathand, the 

 

I've delete those DO.OutputDriveType properties. But the chip I want to communicate sent a alarm signal. I compared the original program with the revised one, I found that, for the original vi., when the  DO.OutputDriveType property is being set, the output signal is always high not matter what the input value is. In the program, the value false is written to some channels, output is high.  And this doesn't cause a alarm. But when the DO.OutputDriveType is deleted, the input is false, the output is low, and this causes alarm. I wonder if I use a USB 6009, when the DO.OutputDriveType is set active drive, and input is false, will the output be low or high?

 

Thanks,

cli

0 Kudos
Message 8 of 14
(4,439 Views)

Hi GerdW, 

 

Thanks for the reply. 

 

I think using USB sticks is a good idea since it provides the SPI interface which is better than software programed SPI.  I will try that later. 

 

Best,

cli

0 Kudos
Message 9 of 14
(4,428 Views)

Hi nathand, 

 

I think I found the problem. The alarm is caused by the reset signal. When I press start to start runing the vi. the program changes the reset signal from low level to high level. This casued the alarm happens.  Since the original vi. works, and reset also is high when start is pressed. So I think I can narrow the problem to the difference of high level between active drive and open collector is the reason causing the alarm. I searched that it is said that the open collector is floating at high level, do you think that is the problem?

 

Thanks.

0 Kudos
Message 10 of 14
(4,412 Views)