ão é possível abrir a porta UART no Windows IoT com Raspberry Pi 3
Eu tenho nulo na porta serial depois de abrir o SerialDevice em C # no Windows IoT Core 10 em execução no Raspberry Pi 3.
Aqui está o código:
string aqs = SerialDevice.GetDeviceSelector();
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(aqs);
List<DeviceInformation> list = devices.ToList();
DeviceInformation di = list.First();
serialPort = await SerialDevice.FromIdAsync(di.Id);
serialPort
énull
.
di.Id
é igual a:Id "\\\\?\\ACPI#BCM2836#0#{86e0d1e0-8089-11d0-9ce4-08003e301f73}" string
list.Count
equal1
Aqui estão dois registros de/api/devicemanager/devices
GET
solicitação relacionada aUART
:
{
"Class": "Ports",
"Description": "BCM283x Mini UART Serial Device",
"ID": "ACPI\\BCM2836\\0",
"Manufacturer": "Microsoft",
"ParentID": "ACPI_HAL\\PNP0C08\\0",
"ProblemCode": 0,
"StatusCode": 25182218
},
{
"Class": "System",
"Description": "ARM PL011 UART Device Driver",
"ID": "ACPI\\BCM2837\\4",
"Manufacturer": "Microsoft",
"ParentID": "ACPI_HAL\\PNP0C08\\0",
"ProblemCode": 0,
"StatusCode": 25165834
},
Tentei tanto colocar um curto-circuito em Rx quanto Tx e não em curto-circuito, ele não funciona ...
ATUALIZA
Se eu dividir o ID fornecido, tenhoInvalid data
exceção.
string aqs = SerialDevice.GetDeviceSelector();
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(aqs);
List<DeviceInformation> list = devices.ToList();
DeviceInformation di = list.First();
string id = "{86e0d1e0-8089-11d0-9ce4-08003e301f73}";
try { serialPort = await SerialDevice.FromIdAsync(id); } catch(Exception e) { Debug.WriteLine(e.Message); }
id = "\\\\?\\ACPI#BCM2836#0#";
try { serialPort = await SerialDevice.FromIdAsync(id); } catch(Exception e) { Debug.WriteLine(e.Message); }
id = di.Id;
try { serialPort = await SerialDevice.FromIdAsync(id); } catch(Exception e) { Debug.WriteLine(e.Message); }
if (serialPort == null) { Debug.WriteLine("No device"); return; }
A saída
Exception lançada: 'System.Exception' no mscorlib.ni.dll
Os dados são inválidos. (Exceção de HRESULT: 0x8007000D)
Os dados são inválidos. (Exceção de HRESULT: 0x8007000D)
No device