uart_temp/reset_mcu.sh

34 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2024-07-15 00:48:18 +08:00
#!/bin/bash
#===========================================================================
# Organization : Individual developer
# Filename : reset_mcu.sh
# Author : Feng Bohan
# Create Time : 02:51:28 2024-07-14
# Last Modified: 00:17:44 2024-07-15
# Abstract :
#--------------------------------------------------------------------------
# Description:
#
#--------------------------------------------------------------------------
# Modification History:
#--------------------------------------------------------------------------
# Rev Date Who Description
# --- ---- --- -----------
# 0.0.01 2024-07-14 Feng Bohan initial version
#===========================================================================
2024-07-15 01:34:57 +08:00
if [ "$#" -ne 2 ]; then
echo "错误此脚本需要且仅需要2个参数, 作为COM口号和波特率。"
2024-07-15 01:01:03 +08:00
exit 1 # 使用非零状态码退出表示异常
fi
2024-07-15 01:34:57 +08:00
stty -F $1 speed $2 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke
2024-07-15 00:48:18 +08:00
2024-07-15 01:01:03 +08:00
echo -e "RESET!" > $1
2024-07-15 00:48:18 +08:00
#说明:
#speed 串口波特率
#cs8 数据位8位
#parenb 无校验
#cstopb 停止位1位
#查看串口设置: stty -a -F /dev/ttyUSB0