This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sending SMS using at_client example

Should it be possible to send SMS with the at_client example, and is there any special requirements to do so?

This is the AT commands setup procedure I've used:

AT+CFUN=1
OK
AT+CPIN="1234"
OK
AT+CNUM
+CNUM: ,"+47123456789",145
OK
AT+CEREG?
+CEREG: 0,5,"0AF1","02055515",7
OK
AT+CNMI=3,2,0,1
OK

After this I can receieve SMS. But if I try to send one, the following happens:

AT+CMGS=17<CR>0691746435990511000A91742904694700000B04F4F29C0E<SUB>
ERROR

It looks like I get the ERROR as soon as the carriage return is sent

AT+CMGS=17<CR>
ERROR
Parents
  • I was able to get sending of SMS to work.

    It does not appear to work with the iBasis SIM card that came with the DK. But I was able to use my own SIM card (this might not work for everyone since LTE-M might not be supported)

    I could not use the at_client example, as the AT+CMGS command isn't supported over a UART terminal to at_client, if I understand correctly.

    If I write the AT commands directly from C firmware, it works.

    This is the sequence of AT commands I used:

    > AT+CPIN="1234"
    OK
    > AT+CFUN?
    +CFUN: 4
    OK
    > AT+CFUN=1
    OK
    > AT+CFUN?
    +CFUN: 1
    OK
    Sleeping...
    > AT+CNUM
    +CNUM: ,"+47123456789",145
    OK
    > AT+CEREG?
    +CEREG: 0,2,"0AF1","02055515",7
    OK
    > AT+CNMI=3,2,0,1
    OK
    > AT+CMGS=27<CR>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<SUB>
    +CMGS: 99
    OK
    


    It was important to add a sleep function before sending CPIN, and after sending CFUN=1

    I used the following example for how to send simple AT commands from C firmware code:

    https://github.com/Rallare/fw-nrfconnect-nrf2/blob/nrf9160_samples/samples/nrf9160/simple_at/src/main.c

    (I used k_sleep(10000) to sleep before CPIN and after CFUN=1)

    I used this tool to generate the AT+CMGS command:
    http://rednaxela.net/pdu.php

    In the C code the string for the CMGS command looks like this:

    "AT+CMGS=YY\rXXXX\x1A"

    Where YY is the length (from the first line from the PDU generator) and XXXX is the hexidecimal code (from the second line from the generator)

Reply
  • I was able to get sending of SMS to work.

    It does not appear to work with the iBasis SIM card that came with the DK. But I was able to use my own SIM card (this might not work for everyone since LTE-M might not be supported)

    I could not use the at_client example, as the AT+CMGS command isn't supported over a UART terminal to at_client, if I understand correctly.

    If I write the AT commands directly from C firmware, it works.

    This is the sequence of AT commands I used:

    > AT+CPIN="1234"
    OK
    > AT+CFUN?
    +CFUN: 4
    OK
    > AT+CFUN=1
    OK
    > AT+CFUN?
    +CFUN: 1
    OK
    Sleeping...
    > AT+CNUM
    +CNUM: ,"+47123456789",145
    OK
    > AT+CEREG?
    +CEREG: 0,2,"0AF1","02055515",7
    OK
    > AT+CNMI=3,2,0,1
    OK
    > AT+CMGS=27<CR>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<SUB>
    +CMGS: 99
    OK
    


    It was important to add a sleep function before sending CPIN, and after sending CFUN=1

    I used the following example for how to send simple AT commands from C firmware code:

    https://github.com/Rallare/fw-nrfconnect-nrf2/blob/nrf9160_samples/samples/nrf9160/simple_at/src/main.c

    (I used k_sleep(10000) to sleep before CPIN and after CFUN=1)

    I used this tool to generate the AT+CMGS command:
    http://rednaxela.net/pdu.php

    In the C code the string for the CMGS command looks like this:

    "AT+CMGS=YY\rXXXX\x1A"

    Where YY is the length (from the first line from the PDU generator) and XXXX is the hexidecimal code (from the second line from the generator)

Children
  • Hello ,

    I tried what you are recommending here and it worked!

    Thank you for sharing. That is some very useful information.

    A+

    Frank

  • Hello,

    I am using simple_at program to send sms. But it is not working. Commands like AT+CFUN?, AT+CFUN=1,  AT+CEREG? are working, but when i use AT+CMGS command, folllowing output comes. I am not able to send sms. I am using  iBasis SIM card that came with the DK. when i give AT+CPIN="1234" it shows error.

    Please help me with this.

  • Hello,

    I am trying to follow the same things recommended by but I am not able to send sms from iBASIS sim or my sim card as well. using AT+CMGS command always shows error or it is timed out. Can you please help me with this? I tried both programs (at_client and simple_at). But nothing works.

Related