UART on U3-HV via Python bricking device | LabJack
 

UART on U3-HV via Python bricking device

3 posts / 0 new
Last post
Antopaz
Antopaz's picture
UART on U3-HV via Python bricking device

Hello.

I am trying to establish UART communications via the LabJack U3-HV, but for some reason the device becomes unresponsive after sending it a write command.

My CODE is below:
import u3
d = u3.U3()
d.getCalibrationData()
d.asynchConfig(DesiredBaud=9600)
tx_msg =  list('a'.encode())
d.asynchTX(tx_msg)

And below the error message.

Traceback (most recent call last):

  File "<ipython-input-1-61c7e65e4f8f>", line 77, in <module>
    d.asynchTX(tx_msg)

  File "C:\Users\jan.treiber\anaconda3\lib\site-packages\u3.py", line 1435, in asynchTX
    result = self._writeRead(command, 10, [0xF8, 0x02, 0x15])

  File "C:\Users\jan.treiber\anaconda3\lib\site-packages\LabJackPython.py", line 555, in _writeRead
    self._checkCommandBytes(result, commandBytes)

  File "C:\Users\jan.treiber\anaconda3\lib\site-packages\LabJackPython.py", line 535, in _checkCommandBytes
    raise LabJackException("Got a zero length packet.")

LabJackException: Got a zero length packet.

Further Info:

After receiving this error I cannot get anything back from the device, e.g. print(d.configU3()) will return the same error as above.
This is with the device not connected with any pins, but the same happens if I loop FIO4 to FIO5 as Tx and Rx.

Digging into it, it would appear that the device becomes unresponsive after the write statement in the self._writeRead function. 
https://github.com/labjack/LabJackPython/blob/1ccdd45268e021515227a5f7c6...

After "bricking" the device with above code I have to unplug and reconnect the device to get any response from it (I have tried to reset, but since it is unresponsive it is likely not receiving any of the commands I am sending after the initial error).

Here is also my Python / Labjack version information:

Python 3.8.3
LabJackPython 2.0.4

Labjack Information:
'FirmwareVersion': '1.00',
 'BootloaderVersion': '0.27',
 'HardwareVersion': '1.30',
 'SerialNumber': 320080343,
 'ProductID': 3,
 'LocalID': 1,
 'TimerCounterMask': 64,
 'FIOAnalog': 15,
 'FIODirection': 0,
 'FIOState': 0,
 'EIOAnalog': 0,
 'EIODirection': 0,
 'EIOState': 0,
 'CIODirection': 0,
 'CIOState': 0,
 'DAC1Enable': 0,
 'DAC0': 0,
 'DAC1': 0,
 'TimerClockConfig': 2,
 'TimerClockDivisor': 256,
 'CompatibilityOptions': 0,
 'VersionInfo': 18,
 'DeviceName': 'U3-HV'

 

Can anyone help / advice / point me in the right direction?

Many thanks.

 

LabJack Support
labjack support's picture
I would recommend upgrading

I would recommend upgrading your firmware to 1.46 using LJSelfUpgrade, then test again. If that does not resolve the issue please verify the device can be opened and controlled in LJControlPanel:

https://labjack.com/support/firmware/u3

Antopaz
Antopaz's picture
Thank you very much.

Thank you very much. Upgrading the firmware has resolved the issue.