ktm.martin
ktm.martin

Reputation: 15

Unable to understand AT Command Response

I am working with my MULTIBAND 900E 1800 WAVECOM MODEM. I have created a project using .Net C# to communicate with my modem by AT-Command. But I am not getting any Human readable response from the modem. The response is like that -

'P&ØPP&ØÐPØØPØØþRÏÐ ÿÔ'

I am unable to decode the response so that I can understand.

I have tried by changing the serial port Encoding using:

Using the different encoding the response gets changed but still in unreadable character.

Besides, I have tried by changing CSCS:

Using the different CSCS the response gets changed but still in unreadable character.

  port = new SerialPort(SERIAL_PORT_NAME)
  {
    BaudRate = 9600,
    DataBits = 8,
    Parity = Parity.None,
    StopBits = StopBits.One
  };
  port.Parity = Parity.None;
  port.ReadTimeout = 300;
  port.WriteTimeout = 300;
  //port.Encoding = Encoding.UTF8;
  //port.Encoding = Encoding.GetEncoding("ISO-8859-1");
  port.DtrEnable = true;
  port.RtsEnable = true;
  port.Open();

  //port.WriteLine("AT+CSCS=GSM");
  //response = port.ReadExisting();
  port.WriteLine("AT");
  response = port.ReadExisting();

If I write AT the modem should response OK. That's exactly happening while I am trying to test my modem using https://m2msupport.net/m2msupport/ussd-how-to-send-ussd-short-codes-with-at-command/. But each and every application or sample code I found that made using .Net have the same issue.

Upvotes: 1

Views: 321

Answers (1)

Roberto Caboni
Roberto Caboni

Reputation: 7490

As far as I understand you are able to send AT commands using a common terminal but you fail doing it programmatically.

My suggestion is the following checklist:

  1. Verify that the baudrate you are using is correct. 9600 is an uncommon baudrate. Usually 115200 is used
  2. Pay attention to HW flow control. In AT interfaces it is usually disabled. Anyway the settings in your program must match the ones in your modem

Verify (1) and (2) with your terminal before choosing your settings in code.

  1. AT commands are actually sent to the parser after <CR> char (ASCII 0x0D). Are you sure that WriteLine is terminated by <CR> and not <LF>? Probably using Port.Write("AT\r") would be a better choice.

Upvotes: 2

Related Questions