#!/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 #=========================================================================== if [ "$#" -ne 2 ]; then echo "错误:此脚本需要且仅需要2个参数, 作为COM口号和波特率。" exit 1 # 使用非零状态码退出表示异常 fi stty -F $1 speed $2 cs8 -parenb -cstopb raw -echo -echoe -echok -echoctl -echoke echo -e "RESET!" > $1 #说明: #speed 串口波特率 #cs8 数据位8位 #parenb 无校验 #cstopb 停止位1位 #查看串口设置: stty -a -F /dev/ttyUSB0