<?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>RTT Shell is limited to 16 characters using telnet</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110262/rtt-shell-is-limited-to-16-characters-using-telnet</link><description>Hello 
 I am using the RTT shell on an nrf9160, by using telnet on a linux machine. I use telnet localhost 19021 , as recommended by Nordic. 
 When I try issuing especially long commands to the device, it only receives the first 15 characters (+1 for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Apr 2024 11:36:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110262/rtt-shell-is-limited-to-16-characters-using-telnet" /><item><title>RE: RTT Shell is limited to 16 characters using telnet</title><link>https://devzone.nordicsemi.com/thread/478955?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2024 11:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37bb6063-a1de-42d2-a742-12a55d29323c</guid><dc:creator>Fridtjof</dc:creator><description>&lt;p&gt;Small correction: the relevant KConfig option is&amp;nbsp;&lt;code&gt;&lt;span&gt;CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT Shell is limited to 16 characters using telnet</title><link>https://devzone.nordicsemi.com/thread/478943?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2024 11:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:effe1b72-3750-49ba-9350-0079d02638a8</guid><dc:creator>Fridtjof</dc:creator><description>&lt;p&gt;I figured it out&lt;/p&gt;
&lt;p&gt;The problem is that telnet by default is in line mode, and only sends characters to the shell when you press enter. The RTT shell has a KConfig option called&amp;nbsp;&lt;span&gt;&lt;code&gt;CONFIG_SHELL_BACKEND_SERIAL_ASYNC_RX_BUFFER_SIZE&lt;/code&gt; which I think sets how many characters the shell can receive in very quick succession. This means that in line mode, where telnet sends the whole command very quickly, the shell will only capture the first 16 bytes.&lt;/span&gt;&amp;nbsp;Line mode also screws with control characters like ^C and TAB.&lt;/p&gt;
&lt;p&gt;The trick is to enter char mode by typing &lt;code&gt;ctrl-]&lt;/code&gt;&amp;nbsp;(telnet&amp;#39;s escape code&lt;span&gt;) followed by the command&amp;nbsp;&lt;code&gt;mode char&lt;/code&gt;. This will make telnet send every character you type immediately.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So how can you make telnet automatically start in character mode? You can&amp;#39;t. But you can use screen to do it for you. So we create a detached screen (-dm) running telnet, send in the raw characters ^]mode char followed by enter (\015), then attach ti the screen. We can kill this screen with ctrl-a k y, or detach with ctrl-a d.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;screen -dmS rttshell telnet localhost 19021; screen -S rttshell -X stuff &amp;#39;^]mode char&amp;#39;`echo -ne &amp;#39;\015&amp;#39;`; screen -rS rttshell&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hope this helps someone.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;br /&gt;Fridtjof&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>