« Close

Datasheets and User Guides

App Notes

Software & Driver

 

5.2.14 - StreamData

After starting the stream, the data will be sent as available in the following format. Reads oldest data from buffer.

Table 5.2.14-1. StreamData Response

Response:  
Byte  
0 Checksum8
1 0xF9
2 4 + SamplesPerPacket
3 0xC0
4 Checksum16 (LSB)
5 Checksum16 (MSB)
6-9 TimeStamp
10 PacketCounter
11 Errorcode
12-13 Sample0
62 (max) Backlog
63 (max) 0x00
  • SamplesPerPacket: From StreamConfig function.
  • TimeStamp: Not currently implemented during normal operation, but after auto-recovery this reports the number of packets missed (1-65535).
  • PacketCounter: An 8-bit (0-255) counter that is incremented by one for each packet of data. Useful to make sure packets are in order and no packets are missing.
  • Sample#: Stream data is placed in a FIFO (first in first out) buffer, so Sample0 is the oldest data read from the buffer. The analog input reading is returned justified as a 16-bit value.
  • Backlog: When streaming, the processor acquires data at precise intervals, and transfers it to a FIFO buffer until it can be sent to the host. This value represents how much data is left in the buffer after this read. The value ranges from 0-255, where 256 would equal 100% full.

Stream mode on the U6 uses a feature called auto-recovery. If the stream buffer gets too full, the U6 will go into auto-recovery mode. In this mode, the U6 no longer stores new scans in the buffer, but rather new scans are discarded. Data already in the buffer will be sent until the buffer contains fewer samples than SamplesPerPacket, and every StreamData packet will have errorcode 59. Once the stream buffer contains less samples than SamplesPerPacket, the U6 will start to buffer new scans again. The next packet returned will have errorcode 60. This packet will have 1 dummy scan where each sample is 0xFFFF, this scan separates new data from any pre auto-recovery data. Note that the dummy scan could be at the beginning, middle, or end of this packet, and can span multiple packets. If the dummy scan spans multiple packets then the packet with error code 60 will contain the end of the dummy scan. Also, the TimeStamp parameter in this packet contains the number of scans that were discarded, allowing correct time to be calculated. The dummy scan counts as one of the missing scans included in the TimeStamp value.

5 comments

At the end of auto-recovery, does the Timestamp value contain the number of packets lost or the number of scans lost? (it says both on this page). Thanks.

The value returned in the time-stamp field is the number of scans that were missed

The description of Sample# says that differential readings are signed, and single-ended readings are unsigned. But in the description of Calibration (section 5.4), it says that "Binary readings are always unsigned integers." Which is correct? Thanks,

The binary data does not have an associated sign. It should be treated as unsigned.

If numchannels is 2 and samples per packet is 25, does the first streamdata message contain scans 1-12 and ai0 from scan 13 followed by the second streamdata message containing ai1 from scan 13 and scans 14-25?