多个USB到RS485 FTDI设备ID
Multiple USB to RS485 FTDI Device ID
我需要一些帮助。我正在编程C /CX中的Win 10应用程序。我将两个USB用于RS485设备,这两种设备都具有相同的VID号。在过去的日子里,我可以写一些软件,并使用良好的旧粘液等连接到端口等。
我现在正在关注此处的示例串行示例,该样本使用该方法收集设备信息,因此在寻找连接的设备时,我在可用设备列表中看到的内容如下。
? ftdibus#vid_0403 pid_6001
这两个设备具有相同的VID和PID。这导致我是电缆连接到正确的USB设备的问题。我认为我的应用程序正在尝试同时连接到两个设备?有人对我如何解决这一障碍有任何想法吗?
void MainPage::Get_Serial_Devices() {
cancellationTokenSource_Port1 = new Concurrency::cancellation_token_source();
cancellationTokenSource_Port2 = new Concurrency::cancellation_token_source();
// THIS USES ASYNCRONOUS OPERATION. GET A LIST OF SERIAL DEVICES AND POPULATE THE COMBO BOX
Concurrency::create_task(ListAvailablePortsAsync()).then([this](DeviceInformationCollection^ serialDeviceCollectioin)
{
// serialDeviceCollection CONTAINS ALL SERIAL DEVICES FOUND, COPY INTO _deviceCollection
DeviceInformationCollection^ _deviceCollection = serialDeviceCollectioin;
// CLEAR EXISTING DEVICES FOR OUR OBJECT COLLECTION
_availableDevices->Clear();
// FOR EVERY DEVICE IN _deviceCollection
for (auto &&device : _deviceCollection) {
if (device->Name->Equals("USB-RS485 Cable")) {
// CREATE A NEW DEVICE TYPE AND APPEND TO OUR OBJECT COLLECTION
_availableDevices->Append(ref new Device(device->Id, device));
Total_Ports++;
this->DeviceLists->Items->Append(device->Id);
}
}
});
void MainPage::ConnectButton_Click(Object^ sender, RoutedEventArgs^ e) {
if (Port1_Connected == false) {
// CAST INDEX TO CORRELATING Device IN _availableDevices
Device^ selectedDevice = static_cast<Device^>(_availableDevices->GetAt(Port_1_ID));
// GET THE DEVICE INFO
DeviceInformation^ entry = selectedDevice->DeviceInfo;
Concurrency::create_task(ConnectToSerialDeviceAsync_Port1(entry, cancellationTokenSource_Port1->get_token())).then([this]( ) {
Get_Echo();
Waiting_For_Ack = true;
});
}
Concurrency::task<void> MainPage::ConnectToSerialDeviceAsync_Port1(DeviceInformation^ device, Concurrency::cancellation_token cancellationToken) {
// CREATE A LINKED TOKEN WHICH IS CANCELLED WHEN THE PROVIDED TOKEN IS CANCELLED
auto childTokenSource = Concurrency::cancellation_token_source::create_linked_source(cancellationToken);
// GET THE TOKEN
auto childToken = childTokenSource.get_token();
// CONNECT TO ARDUINO TASK
return Concurrency::create_task(SerialDevice::FromIdAsync(device->Id), childToken).then([this](SerialDevice^ serial_device) {
try {
_serialPort_Port1 = serial_device;
TimeSpan _timeOut; _timeOut.Duration = 10;
// CONFIGURE SERIAL PORT SETTINGS
_serialPort_Port1->WriteTimeout = _timeOut;
_serialPort_Port1->ReadTimeout = _timeOut;
_serialPort_Port1->BaudRate = 57600;
_serialPort_Port1->Parity = Windows::Devices::SerialCommunication::SerialParity::None;
_serialPort_Port1->StopBits = Windows::Devices::SerialCommunication::SerialStopBitCount::One;
_serialPort_Port1->DataBits = 8;
_serialPort_Port1->Handshake = Windows::Devices::SerialCommunication::SerialHandshake::None;
// CREATE OUR DATA READER OBJECT
_dataReaderObject_Port1 = ref new DataReader(_serialPort_Port1->InputStream);
_dataReaderObject_Port1->InputStreamOptions = InputStreamOptions::None;
// CREATE OUR DATA WRITE OBJECT
_dataWriterObject_Port1 = ref new DataWriter(_serialPort_Port1->OutputStream);
this->ConnectButton->IsEnabled = false;
this->DisconnectButton->IsEnabled = true;
// KICK OF THE SERIAL PORT LISTENING PROCESS
Listen_Port1();
}
catch (Platform::Exception^ ex) {
this->Error_Window->Text = (ex->Message);
CloseDevice(PORT_1);
}
});
ft_prog是一个免费的EEPROM编程实用程序,可与FTDI设备一起使用。它用于修改存储FTDI设备描述符以自定义设计的EEPROM内容。
可以在此处下载完整的ft_prog用户指南。
相关文章:
- 正在查找文档以获得PS4平台的C++中的设备信息
- 指向设备对象成员的指针
- VSOMEIP-2个设备之间的通信(TCP/UDP)不工作
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 是否可以使用winusb同时与多个相同的usb设备进行通信
- 从函数角度看ID到文件路径的内部与外部映射
- 通过组合不同的类型来创建唯一的id
- STM32使用HAL库的外部闪存读取设备ID
- 多个USB到RS485 FTDI设备ID
- 如何在 Windows 进程回调中断开连接时获取设备信息(硬件 ID)
- 如何在 WinCE 设备上供应商和产品 ID
- 按 ID 排列的音频设备名称(waveout c++)
- 如何在给定设备实例ID的情况下可靠快速地获取网卡的MAC地址
- 如何在Windows上的Qt中获取USB设备的供应商ID和PID
- 在OpenCV方法VideoCapture.open()中使用设备名称而不是ID
- 为什么 Arduino Micro(USB 设备)的供应商 ID 和产品 ID 在 Linux 和 Windows 中有所不同?
- 检查给定设备 ID 是否存在 Windows 驱动程序
- 如何从SERVICE_CONTROL_DEVICEEVENT中检测设备id
- 来自c++ /CX的设备唯一id
- Windows C++:获取驱动程序设备ID