简体   繁体   English

与 Bronkhorst 质量流量传感器通信 - 设备没有序列号?

[英]Communicating with a Bronkhorst Mass Flow Sensor - Device has no serial number?

I'm trying to communicate with a few scientific measurement devices in our lab and came across a strange issue.我正在尝试与我们实验室中的一些科学测量设备进行交流,并遇到了一个奇怪的问题。 We use Bronkhorst Mass Flow Readers to measure the amount of helium gas running through our lines.我们使用Bronkhorst 质量流量读数器来测量流经我们生产线的氦气量。

NOTE --- I'm running my code through git bash on a Windows 10 machine.注意--- 我在 Windows 10 机器上通过 git bash 运行我的代码。 The hardware is connected via an RS232 cable.硬件通过 RS232 电缆连接。 I have not tested this on Linux, but I can if necessary for troubleshooting.我还没有在 Linux 上对此进行测试,但如果有必要,我可以进行故障排除。 We are forced to use Windows 10 because of a different piece of hardware.由于硬件不同,我们被迫使用 Windows 10。 If Linux ultimately works, I'll need to find a Windows 10 solution anyway.如果 Linux 最终有效,无论如何我都需要找到 Windows 10 解决方案。

In an attempt to write a class to automate the COM port determination, I found that these devices don't output a serial number.在尝试编写 class 来自动确定 COM 端口时,我发现这些设备没有 output 序列号。 The below code shows what I'm doing, I'll provide more detail momentarily.下面的代码显示了我正在做的事情,我将立即提供更多详细信息。

import serial
from serial.tools import list_ports
import pandas as pd


def identify_devices():

    a = list_ports.comports()
    df = pd.DataFrame()
    df['com_port'] = [port.name for port in a]
    df['vendor_id'] = [port.vid for port in a]
    df['product_id'] = [port.pid for port in a]
    df['serial_number'] = [port.serial_number for port in a]
    df['description'] = [port.description for port in a]
    df['location'] = [port.location for port in a]
    df['manufacturer'] = [port.manufacturer for port in a]
    df['product'] = [port.product for port in a]
    df['interface'] = [port.interface for port in a]
    df['hwid'] = [port.hwid for port in a]

    return df

There's a lot more to the code, but it essentially boils down to this.代码还有很多内容,但基本上可以归结为这一点。 The output is as follows. output如下。

In [18]: identify_devices()
Out[18]:
  com_port  vendor_id  product_id serial_number                              description location           manufacturer product interface                                     hwid
0     COM4     1027.0     24577.0      FTSTT5NA                   USB Serial Port (COM4)     None                   FTDI    None      None       USB VID:PID=0403:6001 SER=FTSTT5NA
1     COM1        NaN         NaN          None               Communications Port (COM1)     None  (Standard port types)    None      None                           ACPI\PNP0501\1
2     COM6     1027.0     24577.0     FTXEF0AHA                   USB Serial Port (COM6)     None                   FTDI    None      None      USB VID:PID=0403:6001 SER=FTXEF0AHA
3     COM5     1659.0      8963.0                Prolific USB-to-Serial Comm Port (COM5)      1-8               Prolific    None      None  USB VID:PID=067B:2303 SER= LOCATION=1-8

COM5 above is the device I'm interested in. I was expecting a serial number similar to the ones in COM4 and COM6 to populate that field, but instead it's empty.上面的COM5是我感兴趣的设备。我期待一个类似于COM4COM6中的序列号来填充该字段,但它是空的。 I've tried looking into the RS232 cable to see if it's blocking the serial number somehow, but I came up empty-handed.我试过查看 RS232 电缆,看看它是否以某种方式阻止了序列号,但我空手而归。

I've tested this with multiple Bronkhorst devices and 3 different RS232 cables, they all produce the same issue.我已经用多个 Bronkhorst 设备和 3 条不同的 RS232 电缆对此进行了测试,它们都产生了相同的问题。 I can't imagine the devices do not have serial numbers.我无法想象这些设备没有序列号。

I'm looking for a solution or some direction on where to go from here.我正在寻找从这里到 go 的解决方案或方向。 Please let me know if there are questions or if clarifications are needed, thank you.如果有问题或需要澄清,请告诉我,谢谢。



EDIT:编辑:

I checked out the device manager in Windows and found the correct serial information for the COM4 device hidden in the parent property.我检查了 Windows 中的设备管理器,发现隐藏在parent属性中的 COM4 设备的正确序列信息。 Navigating to that same location in the Bronkhorst device manager, I find that the layout is a bit different.导航到 Bronkhorst 设备管理器中的同一位置,我发现布局有点不同。 See the picture below.见下图。

What are the differences here?这里有什么区别? Can pyserial look for items in the ROOT_HUB30 path? pyserial 可以在ROOT_HUB30路径中查找项目吗?

在此处输入图像描述

I can't imagine the devices do not have serial numbers.我无法想象这些设备没有序列号。

Sorry, you did hit the jackpot with those Prolific chips.抱歉,你确实用这些多产的筹码中了大奖。 Apparently, they ship with no serial number written.显然,他们发货时没有写序列号。 Older devices did not even have a spot to write a unique serial number (see here ).较旧的设备甚至没有地方写唯一的序列号(见这里)。

If you are lucky your chips will be of the newer sort and you should be able to write a serial number yourself using Prolific's tool .如果幸运的话,您的芯片将是较新的类型,您应该能够使用 Prolific 的工具自己编写序列号。

If that's not a solution for you (I'm thinking maybe those are client's products and you'd have to ask for their permission) maybe you can tweak pyserial to swallow and clean those numbers (whatever they are) you are getting.如果这不是您的解决方案(我在想这些可能是客户的产品,您必须征得他们的许可),也许您可以调整 pyserial 以吞下并清理您得到的那些数字(无论它们是什么)。

If you look at the code that should not be very difficult...如果你看一下应该不是很难的代码......

I used to have some of these Prolific bridges but unfortunately, I could not find any of them so all of the above is just hearsay.我曾经有一些这样多产的桥梁,但不幸的是,我找不到它们中的任何一个,所以以上所有内容都只是道听途说。 Anyway, I hope you find it helpful.无论如何,我希望你觉得它有帮助。

EDIT: I got hold of one Prolific bridge but unfortunately, this one was of the older 2303HXA type.编辑:我得到了一个多产的桥,但不幸的是,这个是较旧的 2303HXA 类型。 There is no OTP memory or even an EEPROM so writing the serial number is out of the question (there is no place to write it to).没有 OTP memory 甚至没有 EEPROM,所以写序列号是不可能的(没有地方可以写它)。

But I can confirm the same behavior you got on Windows (I even got a warning informing me that the device has been phased out and not supported since 2012).但我可以确认您在 Windows 上遇到的相同行为(我什至收到警告,通知我该设备自 2012 年以来已被淘汰且不受支持)。 On Linux, there is no serial number anywhere either.在 Linux 上,任何地方也没有序列号。

I've also noticed that if you want to write to the newer chips you will need to supply the port with 6.5V instead of the normal 5V you get from the USB (Prolific offers an adaptor but I guess it should not be difficult to DIY it).我还注意到,如果您想写入较新的芯片,则需要为端口提供 6.5V 而不是从 USB 获得的普通 5V(Prolific 提供了一个适配器,但我想 DIY 应该不难它)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM