Created
November 6, 2018 03:45
-
-
Save CIPop/7bce468630953d6aa86867fff63deaa9 to your computer and use it in GitHub Desktop.
Powershell Baud Detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Output "Available COM ports: " | |
[System.IO.Ports.SerialPort]::getportnames() | |
$Global:portName = "COM5" | |
Function TryBaud($rate) | |
{ | |
$port= new-Object System.IO.Ports.SerialPort $Global:portName,$rate,None,8,one | |
$port.open() | |
$port.ReadTimeout = 1000 | |
$port.WriteLine("help") | |
try | |
{ | |
$s = $port.ReadLine() | |
Write-Output "String read: <<$s>>" | |
} | |
catch {} | |
$port.Close() | |
} | |
$baudRates = (110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 256000, 460800) | |
foreach ($r in $baudRates) | |
{ | |
Write-Output "Trying: $r" | |
TryBaud $r | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment