<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27019/sending-ctrl-z-over-uart</link><description>Hi, I have a SIM800L GSM/GPRS module that I can successfully talk to via the UART on the nRF51. 
 I can tell it to dial numbers etc and that all works fine. 
 My problem is that to send an SMS, the final character (after inputting the message) needs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jun 2019 06:25:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27019/sending-ctrl-z-over-uart" /><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/191911?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 06:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c75ed25-45d3-4c8f-bde8-80e28a4df78c</guid><dc:creator>Dcrossd</dc:creator><description>&lt;p&gt;Are you able to get this working.&lt;/p&gt;
&lt;p&gt;What escape sequence did you use for Ctrl+z?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106040?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 07:40:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ce0d4af-4759-4db5-afb7-4ab1b6853373</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Do you send any termination characters after the Ctrl-z command? Usually when you type in something in a terminal and hit enter, the terminal also send a termination character like \n and/or \r (new line or carriage return). If you use a nRF52 and the usual UART drivers and libraries you will have to explicitly append these characters at the end. Have you confirmed whether this is the case and whether the GPS module expects such a character?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106039?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2017 18:39:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91506f28-6f61-46ff-a21d-1eab18a03b9f</guid><dc:creator>nada</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry but I have the same problem here, so I was wondering if you had any solutions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106038?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2015 09:34:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87cf3b69-ea7e-4edc-9a02-9135f1678ccc</guid><dc:creator>frijj2k</dc:creator><description>&lt;p&gt;Good thinking... I checked in the Hex view and 0x1A &lt;em&gt;IS&lt;/em&gt; getting sent so the problem is elsewhere....  My thinking is now that I need to wait for the success/error messages before sending the actual text message body...  Simply adding an nrf_delay_ms (YUK!) is not enough as the data is getting buffered and then sent in one burst...&lt;/p&gt;
&lt;p&gt;Just writing &lt;em&gt;properly&lt;/em&gt; some code to handle the responses and will let you know what happens...&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106037?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2015 18:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e22ee64-fa4e-4a90-81f4-4ff34152a8f3</guid><dc:creator>Andrew</dc:creator><description>&lt;p&gt;One thing with CoolTerm, you should be able to see the actual hex values of the ascii characters that are coming back.  In the view menu, switch it to hex and see what the real value of that (.) is.  This should also verify that the header command and tail of the command is terminated correctly.  asciitable.com is a good place to have bookmarked for all of the different ascii commands and their hex / decimal values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106036?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2015 11:01:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922f3b25-d890-4ad6-a238-007d814bf58a</guid><dc:creator>frijj2k</dc:creator><description>&lt;p&gt;Some more information (code)...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define CTRL_Z 26

void uart_putstring(const uint8_t * str) {
    uint32_t err_code
    uint8_t len = strlen((char *) str);
    for (uint8_t i = 0; i &amp;lt; len; i++) {
        err_code = app_uart_put(str[i]);
        APP_ERROR_CHECK(err_code);
    }
}

void dial_number(const uint8_t * number) {
    char cmd_string[255];
    cmd_string[0] = &amp;#39;\0&amp;#39;;
    sprintf(cmd_string, &amp;quot;ATD%s;\r&amp;quot;, number);    
    uart_putstring((uint8_t*)cmd_string);
}

void send_sms(const uint8_t * number, const uint8_t * message) {
    uint32_t err_code;
    char cmd_string[255];
    char msg_string[255];
    cmd_string[0] = &amp;#39;\0&amp;#39;;
    msg_string[0] = &amp;#39;\0&amp;#39;;
    
    //sprintf(cmd_string, &amp;quot;AT+CMGS=\&amp;quot;%s\&amp;quot;\r%s\032\r&amp;quot;, number, message);   // \032 = CTRL-Z
    //sprintf(cmd_string, &amp;quot;AT+CMGS=\&amp;quot;%s\&amp;quot;\r%s%c&amp;quot;, number, message, CTRL_Z);
    //sprintf(cmd_string, &amp;quot;AT+CMGS=\&amp;quot;%s\&amp;quot;\r%s&amp;quot;, number, message);
    
    sprintf(cmd_string, &amp;quot;AT+CMGS=\&amp;quot;%s\&amp;quot;\r&amp;quot;, number);
    sprintf(msg_string, &amp;quot;%s&amp;quot;, message);
    
    uart_putstring((uint8_t*)&amp;quot;AT+CMGF=1\r&amp;quot;);    // Set TEXT mode cmd
    uart_putstring((uint8_t*)cmd_string);       // Send to number cmd
    uart_putstring((uint8_t*)msg_string);       // Send actual message
    err_code = app_uart_put((uint8_t)0x1A);     // Send CTRL-Z to finish	    
    APP_ERROR_CHECK(err_code);
}

// USAGE...
dial_number((uint8_t *)&amp;quot;07123456789&amp;quot;);	// This works!
send_sms((uint8_t *)&amp;quot;+447123456789&amp;quot;, (uint8_t *)&amp;quot;This is a test message from SIM800L&amp;quot;);	// This sends all commands but final CTRL-Z isn&amp;#39;t received correctly by modem
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Please note, the original code only had cmd_string (no msg_string) but I split it up and added fixed delays to see if timing was a problem but that had no effect either...&lt;/p&gt;
&lt;p&gt;Hopefully somebody can shed some light on this...  (As you can see... I have tried many ways to send that CTRL-Z, all of which have not worked)  Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106034?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2015 08:30:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59206c16-1cc6-469d-ac06-e19bf41429e0</guid><dc:creator>frijj2k</dc:creator><description>&lt;p&gt;Thanks for your quick reply Andrew...  Yes I am using it in text mode ( AT+CMGF=1 )... Here&amp;#39;s what I am sending...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AT
AT+CMGF=1
AT+CMGS=&amp;quot;+447123456789&amp;quot;
This is a test message from SIM800L.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the full stop ( . ) added to the end in the terminal (Where CTRL-Z is sent)... Maybe this is just CoolTerm (OSX) showing this instead of the control character although it doesn&amp;#39;t do this when I type it direct into the terminal to the SIM800L via an FTDI cable... (That works just fine).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending CTRL-Z over UART</title><link>https://devzone.nordicsemi.com/thread/106035?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2015 00:47:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da1eb155-c220-459c-b111-1e4a91ccecdd</guid><dc:creator>Andrew</dc:creator><description>&lt;p&gt;Just looking at the command listing for that module, are you sure you are in text mode and not PDU mode?&lt;/p&gt;
&lt;p&gt;Also, looks like all AT commands need to terminate with  (0x0D), so I&amp;#39;m assuming the last bytes in an SMS command would be {0x1A, 0x0D}&lt;/p&gt;
&lt;p&gt;I&amp;#39;m no expert, but that is what I see after spending 5 minutes with the AT command sheet that seem like red flags.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>