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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

stream ni-8452

Solved!
Go to solution

Hello,
I have a pair of SPI devices, and a pair of NI USB8452 DAQS, and a single machine that I'd like to do all my reading from. This seems like it shouldn't be a problem, but the second device is throwing an error when I call ni845xSpiStreamRead (specifically, error 0xFFFB6569, which StatusToString renders as "An unknown error has occurred"). The problem is only happening when I try to do a SPI stream read on the second device - either device by itself works fine.

The flow of the program is as follows:

 

  1. Discover all devices using ni845xFindDevices, and then subsequent calls of ni845xFindDeviceNext.
  2. Open every device using ni845xOpen.
  3. For every device, create a Configuration device using ni845xSpiConfigurationOpen. Set up that to contain all the appropriate values (clock phase, polarity).
  4. For every device paired with its Configuration device, perform a few ni845xSpiWriteRead operations to verify that they're working. This part succeeds.
  5. For every device, create a StreamConfiguratin device using ni845xSpiStreamConfigurationOpen. Set up those to contain the appropriate values and timing information.
  6. For every device, run ni845xSpiStreamStart, pairing it with its appropriate StreamConfiguration.
  7. Enter a while loop, and for each iteration of the loop, run ni845xSpiStreamRead, given a device, its StreamConfiguration, and its own previously-malloced chunk of memory to write to.

Step 7 is where the error appears.

What would be most straightforward (but also inconvenient) is if two devices cannot simultaneously stream. Offhand, though, I'm not sure why that would be the case; I understood the computer's role in streaming to be to pass a block of instructions to the DAQ, and the DAQ does all the heavy lifting, while the computer just occasionally requests data. In such a case, the number of devices doesn't seem like it would be important to the computer. Is that not the case? I've looked through the documentation, and not seen an answer one way or the other. (the documentation is clear that streaming mode only allows a DAQ to poll one device, but that's not what I'm asking)

So, here's the two questions:

 

  1. Can one computer read data from two DAQs that are both in streaming mode at the same time?
  2. Why, in my particular case, might the two DAQs not cooperate in streaming mode specifically?
0 Kudos
Message 1 of 2
(3,083 Views)
Solution
Accepted by topic author gesture

Embarassingly, I'm answering my own question again.

 

1) Two DAQs can run simultaneously in streaming mode. This may also be true for the n-DAQ case, but I don't know that.

2) 0xFFFB6569 appears to get thrown when you pass an invalid uInt8 pointer to ni845xSpiStreamRead.

 

Briefly, I was mallocing the size of the readFromDevice array based on the value of "DEVICES", and doing ni845xSpiStreamRead for (int i=0; i<devices; i++). DEVICES was hard-coded (set to 1), devices was written by the ni845xFindDevices (and was two in the two-device case, one in the one-device case).

 

This is a ridiculous mistake to make, but I'm leaving this here in case somebody else makes the same mistake and looks up that specific error code.

 

0 Kudos
Message 2 of 2
(3,065 Views)