LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED

Summary

Requires LJM 1.2000 or later

LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is a numerical readable and writable LJM library configuration which sets how LJM handles auto-recovery when the first channel is not firmware-protected from returning 0xFFFF as a valid data value.

The constant LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED can be used interchangeably with the string "LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED".

    Values

    0 (default) - Error detection is enabled:

    If auto-recovery happens and the first channel is not firmware-protected from returning 0xFFFF (see list below), stream will be stopped and LJM_eStreamRead will return the error LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320).

    1 - Error detection is disabled:

    LJM assumes the user has configured the first stream channel to not return 0xFFFF. However, if auto-recovery occurs and the first stream channel returns 0xFFFF, LJM may insert dummy scans in the wrong location in stream.

    How to Eliminate LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (Errorcode 1320)

    There are three ways to get rid of LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED.

    1. Easiest solution: Set the first channel in stream to a channel that never returns 0xFFFF. See the list of channels that never return 0xFFFF, below. Simply do this, and you don't need to concern yourself with anything on this page.
    2. Make sure auto-recovery never happens. See these options for reducing auto-recovery.
    3. If you must use a channel that is capable of returning 0xFFFF as the first channel, you should take precautions to make sure it won't return 0xFFFF (by jumpering 1 digital input to GND, for example). Then, set LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED = 1. If you can't guarantee the first channel will never return 0xFFFF, you can still set LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED = 1, but dummy scans may be inserted by LJM at the wrong place.

    Channels that never return 0xFFFF during stream:

    • Analog inputs (AIN0, AIN1, ...)
    • FIO_STATE
    • EIO_STATE
    • CIO_STATE
    • MIO_STATE
    • EIO_CIO_STATE
    • CIO_MIO_STATE

    Individual DIO registers like DIO2 also will never return 0xFFFF, but _STATE registers should be used instead because they're generally more efficient for communication bandwidth. LJM versions 1.2100 and prior mistakenly do not treat individual DIO registers as if they never return 0xFFFF.

    Channels capable of returning 0xFFFF include:

    • FIO_EIO_STATE
    • DIO#(0:22)_EF_READ_A
    • DIO#(0:22)_EF_READ_A_AND_RESET
    • DIO#(0:22)_EF_READ_B
    • CORE_TIMER
    • SYSTEM_TIMER_20HZ
    • STREAM_DATA_CAPTURE_16

    Details

    Setting a new LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED value will not affect stream sessions that are already in progress.

    Rationale

      The lowlevel streaming protocol uses one or more 0xFFFF values to indicate a gap in stream data. Such a gap happens because the device scan buffer ran out of space. LJM adds dummy scans to fill this gap. Some channels return 0xFFFF as a valid data value, so LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320) happens when three conditions are true:

      • Auto-recovery happens (the device scan buffer ran out of space)
      • The first channel is not firmware-protected from returning 0xFFFF
      • LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is 0

      When those conditions are true, LJME_DIGITAL_AUTO_RECOVERY_ERROR_DETECTED (errorcode 1320) is returned because dummy scans could be inserted at the wrong spot in the stream data.

      Relevant Functions

      To read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_ReadLibraryConfigS.

      To write LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.

      Example

      [C/C++] Read LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED then set it to 1.

      char ErrorString[LJM_MAX_NAME_SIZE];
      double value;
      
      int LJMError = LJM_ReadLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, &value);
      if (LJMError != 0) {
          LJM_ErrorToString(LJMError, ErrorString);
          printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
      }
      printf("The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is %.00f\n", value);
      
      value = 1;
      printf("Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to %.00f\n", value);
      LJMError = LJM_WriteLibraryConfigS(LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED, value);
      if (LJMError != 0) {
          LJM_ErrorToString(LJMError, ErrorString);
          printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
      }

      Output:

      The default for LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED is 0
      Setting LJM_STREAM_DIGITAL_AUTO_RECOVERY_ERROR_DETECTION_DISABLED to 1
      
      

      For more LJM configurations, see Library Configuration Functions.