This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Send Commands to Thingy trough USB-Port

Hey There,

I have one problem more. With my .cs Script I am opening a USB Port on my Raspberry, to communicate with my Nordic Thingy 91.

I can Read what the Nordic is sending to me, but if I tried to send a command, no result came back.

The .cs line is:

string command = "AT";

_serialPort.WriteLine(command);

As result I expect "OK" from my thingy  -

my Read() is a Thread. Therefore I should not miss a Line that the Thingy is sending to me, right?

My Baud Rate is 115200 and I set RTS = false and DTR = true.

In this img you can see my results, by communicating with the Thingy. - I have tried to send AT and AT+CEREG but no responding from the device.
So does anyone know what I can do to fix it?

Best Regards

Joseph

  • UPDATE:


    I've tried to convert my command into a byte[] and nothing changed.
    _serialPort.Write(command,0,command.Length);

  • Hi,

    How are the AT command terminated?

    Depending on which NCS version you are using, the at_host library (if that is what you are using) expects AT commands to be terminated with either a line feed ('\n') or carriage return ('\r').

    Best regards,

    Didrik

  • I use the at_client.hex file and tried to terminate the command with the following methods:

    -ReadLine(command);
    -serial.Write(Environment.NewLine());
    (eol is end of line statement LF / CR / \n )
    -serial.Write(eol, 0, eol.Length)

    If you have an Idea for another EOL-Statement, please let me know.

    Do I have to open the second Port with 1000000 baud rate? - Cause I only opened the first one with 115200.
    In Putty I can use only one port and I can send and receive data.

  • Jay.Son said:
    Do I have to open the second Port with 1000000 baud rate?

     That port is primarily used for taking modem traces. You should not need to open it if you are not taking a modem trace.

    What application are you running on the Thingy?

    Could you try to enable logging in the at_cmd and at_host libraries by adding the following lines in the prj.conf file of the project (if you are using SES to build the application, you must re-open to project for the changes to take effect)?

    CONFIG_LOG=y
    CONFIG_AT_CMD_LOG_LEVEL_DBG=y
    CONFIG_AT_HOST_LOG_LEVEL_DBG=y

    If it works as expected when you are using Putty, but not your script, then the error is probably in your script, or the serial library you are using.

Related