USB Modem is echoing back wrong characters

后端 未结 2 1701
感动是毒
感动是毒 2021-01-20 04:06

I have a USB modem connected on port ttyACM0. When I open an application like Minicom and try to send it some commands, the echo back is not always what I type. For exampl

相关标签:
2条回答
  • 2021-01-20 04:32

    Try using

    sudo screen /dev/ttyS0 9600
    

    and see if you get the same behavior.

    0 讨论(0)
  • 2021-01-20 04:39

    Looking at your serial port settings, the most likely culprit here is -istrip. According to the man page, -istrip will strip off the upper bit of the bytes that come back.

    Given that you have a lot of other serial port settings, you may be having weird issues with the driver as well. I don't know what settings minicom uses and how exactly to set them up(I generally use GTKTerm), but my experience has been the settings that GTKTerm uses will always work and avoid any odd characters in the input/output.

    The settings that GTKTerm uses are the same as the following stty line:

    stty -F /dev/ttyS0 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
    

    As for not returning any data when you send the command, have you tried making sure that you are sending \r\n at the end of your command? There's also the possibility that one of the serial port settings that you are using is translating a CR/NL combination. If all the port settings are set correctly, the modem should respond back when you do something like the following:

    cat /dev/ttyACM0 &
    /bin/echo -n -e "AT\r\n" > /dev/ttyACM0
    

    (the modem should respond OK\r\n)

    0 讨论(0)
提交回复
热议问题