0

I'm trying to use a Conexant USB modem from a C program. The modem is located at /dev/ttyACM0.

In the source code I send the AT, then ATZ to reset the modem. I receive the response:

$ sudo ./modem.exe
Send 2: AT
Read 8: 0x41 0x8 0x20 0x8 0x54 0x8 0x20 0x8
Send 3: ATZ
Read 12: 0x41 0x8 0x20 0x8 0x54 0x8 0x20 0x8  0x5a 0x8 0x20 0x8

I'm having trouble with the response codes. Additionally, the codes don't appear to be documented at Hayes Command Set or in an old US Robotics manual I have.

What are the meaning of the response code?

1 Answer 1

1

Read 8: 0x41 0x8 0x20 0x8 0x54 0x8 0x20 0x8

Decoded: A [backspace] [space] [backspace] T [backspace] [space] [backspace]

Read 12: 0x41 0x8 0x20 0x8 0x54 0x8 0x20 0x8 0x5a 0x8 0x20 0x8

Decoded: A [backspace] [space] [backspace] T [backspace] [space] [backspace] Z [backspace] [space] [backspace]

It looks like the modem is echoing back what you're sending, but in a way that would cause a terminal emulator to delete the echoed characters from the screen.

The program response in your question indicates that your program is sending AT, then ATZ. But the source code in the pastebin would send AT, then E0, then ATZ. So it looks like the program you're running doesn't match the source code you're showing us.

Also note that there should be a carriage-return character ('\r' or ASCII 0x0d) at the end of each command you're sending, otherwise the command will be incomplete and the modem will not react to it.

And sending just "E0" alone is not a valid command: to disable the command echo, you'll need to send "ATE0\r" at the very least.

3
  • Thanks telcoM. Yeah, the paste probably does not match the question due to the fiddling. I'm not surprised it diverged from the question. I removed the EOLs when they did not seem to produce a correct result. What is the purpose of the unprintable characters, like backspace? Is that some sort of framing?
    – jww
    Feb 14, 2019 at 22:59
  • Think of it in terms of an old character-cell terminal: the backspace character would just move the cursor back one step, so the next character will overwrite the one that was sent just before the backspace. Either the modem is trying to be tricky, or more likely you did not have the termios settings fully initialized in raw mode in that attempt. (You might want to use cfmakeraw(&tty); instead of manually fiddling with the termios flags; less error-prone that way.)
    – telcoM
    Feb 14, 2019 at 23:05
  • Yeah, the \r fixed it. I'm getting back OK for AT and ATZ. AT+CID=? is returning ERROR, but AT+VCID=1 results in OK. Thanks again.
    – jww
    Feb 14, 2019 at 23:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .