0

I want to update the firmware of my device via a script using picocom commands to send the file (ymodem protocol). When I start picocom manually, with the relevant parameters (as below), it works. E.g. I can send the command via the terminal to restart the device. It works.

picocom /dev/ttyACM0 -b 115200

However, when I put the same command in a bash script I get the error 'no such file or directoryACM0' when I run the script. The user has been added to the dialout and tty groups. So I am puzzled by the error. any suggestions would be helpful. I also tried minicom, but did not have much luck.

port is        : /dev/ttyACM0
flowcontrol    : none
baudrate is    : 115200
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

: No such file or directoryACM0

Here are a couple examples of the commands that I want to send:

command: #000C0074B0FFFF28!  
command: 1 
Fravadona
  • 13,917
  • 1
  • 23
  • 35
Archie
  • 153
  • 9
  • 1
    You have CRLF line endings in your script; you should use a text editor that enforces UNIX line endings – Fravadona May 11 '22 at 21:11
  • Yes, thanks. I enforced the UNIX line endings and now it reads the port. I still however cannot send commands once the terminal is ready. – Archie May 11 '22 at 21:17

1 Answers1

1

You can try sending the commands through picocom's stdin, but might have to translate explicitly the Ctrl‑key sequences if you need them. For example Ctrlq should be translated to 0x11 (see this table for the other sequences):

Update:

An example with the given commands and a here-document would be:

picocom /dev/ttyACM0 -b 115200 <<'EOF'
#000C0074B0FFFF28!
1
EOF
Fravadona
  • 13,917
  • 1
  • 23
  • 35
  • I've added a couple examples of the commands that I would like to send for updating the firmware. – Archie May 12 '22 at 11:47
  • 1
    I updated my answer; not sure if it'll work tough. – Fravadona May 12 '22 at 11:59
  • This is good. The first part works i.e. the HEX code restarts the device. So I lose the pico terminal and need to start another Pico term to send '1' followed by the firmware pkg file – Archie May 12 '22 at 12:17