LJME_RECONNECT_FAILED
When LJM detects that a device has not responded to a communication attempt within the expected timeframe, it attempts to reconnect to the device. If the reconnection is successful, the operation is retried. If the reconnection fails, the LJME_RECONNECT_FAILED
error is returned.
Make sure the LJM timeout is adequate
Reading multiple high resolution AINs can be split up
Analog input readings with high resolution indices result in longer sample times, so if you are using a function like eReadNames to read multiple AINs high resolution indices, you need to split those reads up or increase LJM's given SEND_RECEIVE_TIMEOUT_MS config. It is generally safe to read a single AIN at a time, no matter what resolution index is set. The appropriate timeout can be calculated according to the length of time for each AIN sample as given by a Datasheet appendix, for example.
Use the most reliable connection type possible
USB is most reliable, while Ethernet and WiFi connections are less reliable due to inherent network complications. WiFi is less reliable than Ethernet due to possible interference.
Use an appropriate send/receive timeout
LJM's default SEND_RECEIVE_TIMEOUT_MS
configs balance reliability and speed of error detection. For networks with high latency or for failure-intolerant operations, use a longer timeout to increase reliability.
Retry upon failure
Real-world device communication is prone to errors. Though LJM internally retries failed operations once, you may need to retry by calling the same function that returned LJME_RECONNECT_FAILED
with the same parameters. Doing so is usually appropriate for programs that only loop on reading a given set of registers but is generally not appropriate for writes to or reads from buffer registers.
Determine which device to reconnect to, in case of failure
Reconnection will, by default, reconnect a handle according to the same connection type and the same serial number that it was initially opened with, and always to the same device type. For more details, see the following LJM configurations:
Reconnection notification
Use LJM_RegisterDeviceReconnectCallback to get notified when reconnection occurs.