Skip to content

Instantly share code, notes, and snippets.

@hdznrrd
Created April 12, 2015 16:10
Show Gist options
  • Save hdznrrd/505cca085491b7d22d9a to your computer and use it in GitHub Desktop.
Save hdznrrd/505cca085491b7d22d9a to your computer and use it in GitHub Desktop.
use buspirate v2.go to figure out at which baud rate a UART device talking AT commands communicates
#!/bin/sh
# use buspirate v2.go to figure out at which baud rate a UART device talking AT commands communicates
# 2015 hadez@infuanfu.de
# device is powercycled for each try
DEV=/dev/ttyUSB0
echo "#" >$DEV #reset
sleep 1
for baud in 1 2 3 4 5 6 7 8 9; do
echo "m 3 $baud 1 1 1 2" >$DEV; sleep 0.1
for newline in "0x0d 0x0a" "0x0a"; do
echo "W" >$DEV; sleep 0.1
echo "{" >$DEV; sleep 2 # enter live read; wait for powerup
echo "\"AT\" $newline" >$DEV; sleep 2
echo "}" >$DEV; sleep 0.1
echo "w" >$DEV; sleep 0.5
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment