<?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>NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26388/nrf-cli-cannot-handle-long-arguments</link><description>I am trying to pass a base64 encoded string as an argument to a CLI command over UART. It seems like the longest length command I can send is 258 bytes long. How can I pass in longer strings (1024 bytes long)? I set the UART RX buffer size to 2048. I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 31 Oct 2017 19:54:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26388/nrf-cli-cannot-handle-long-arguments" /><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103846?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2017 19:54:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08077994-bbd5-4c58-a585-a9db6953ddfa</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;Awesome, thanks so much for sharing that. It is working really well when flow control is turned on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103845?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2017 11:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cfc4b55-2b6b-4505-885d-899070c31385</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;I confirm there is a problem with memory handling in ring_buffer implementation. We have a fix for that and it shall be available in comming SDK14.2.&lt;/p&gt;
&lt;p&gt;Unfortunately current UART driver will not mange such fast and big transsmissions. During UART Rx interrupt process we can loose some data or data reception synchronization (data will be badly interpreted).
We have proof of concept for new UART driver but it will be released in Q1-Q2 next year.&lt;/p&gt;
&lt;p&gt;I have an approval to share it here on devzone. It is fixing memory problem and it is handling your scenario of usage. I just tested it and it was working correctly. &lt;strong&gt;As I mentioned we are still working on it so we do not give any guaranty - it shall be treated as PROTOTYPE.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here you have a hex file you can use as your playground (cmd buffer size set to 3000):&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0160.nrf52832_5F00_xxaa.hex"&gt;nrf52832_xxaa.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To port it to your code:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I assume you are using SDK14.0.0&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace cli example (sdk\nrf5\examples\peripheral\cli) in SDK14.0.0 with below one: (I attached only GCC project):
&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/cli.7z"&gt;cli.7z&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update SDK with attached changes: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/SDK-update.7z"&gt;SDK update.7z&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103844?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 23:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c51f86b3-12e9-47bc-961a-b756c57026fe</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;I am able to send long commands now but I cannot send them fast enough. I want to send 683 bytes every 16 ms. I can successfully send that amount of data from the tx out of nRF but can&amp;#39;t achieve the same rate in the Rx direction via the NRF_CLI-- the app either crashes with a memory management hard fault or there are dropped characters leading to undetected commands. Any ideas?&lt;/p&gt;
&lt;p&gt;For more background, I am using a SILabs USB-UART chip, the CP2102/9 at a baudrate of 926100 and even parity. I have not been using hardware or software flow control.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103843?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 17:39:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cacd3d32-99d8-4ea5-a9bc-36af6218cc7e</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;Thanks! I think that worked. What&amp;#39;s the problem you foresee with flow control?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103842?ContentTypeID=1</link><pubDate>Sun, 29 Oct 2017 17:18:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:489d8c0e-c851-4490-bf24-209d0179b366</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Please modify file: nrf_cli_types.h:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef uint8_t nrf_cli_cmd_len_t;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;change to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef uint16_t nrf_cli_cmd_len_t;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However if you will use a script to send commands you will face a problem with flow control... :/&lt;/p&gt;
&lt;p&gt;I tested string containing ~2039 characters. It worked perfectly with RTT and some characters were lost when using UART.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103837?ContentTypeID=1</link><pubDate>Sun, 29 Oct 2017 15:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3eb2a990-c9e4-44d0-9190-42aa19484015</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;It is set to 2048.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103839?ContentTypeID=1</link><pubDate>Sun, 29 Oct 2017 09:38:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fded74a5-fb5a-475d-99d7-5ea108e881ab</guid><dc:creator>jakub</dc:creator><description>&lt;p&gt;When you use macro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLI_UART_DEF(m_cli_uart_transport, 0, 64, 16);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What size do you set for the last parameter? It is Rx buffer size. I have also encountered some problems when it was too small. It shall be power of 2 or multiple of 8... I don&amp;#39;t remember now. Just increase it like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLI_UART_DEF(m_cli_uart_transport, 0, 64, 1024);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103841?ContentTypeID=1</link><pubDate>Sat, 28 Oct 2017 23:42:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99f50303-4b01-46a9-a430-c5264b89309f</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;I am using pyserial to build and send the command. I also see the issue when I type a long command via terminal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103838?ContentTypeID=1</link><pubDate>Sat, 28 Oct 2017 21:13:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7e137c3-99c5-444c-ba11-8d0233fbdbe0</guid><dc:creator>jakub</dc:creator><description>&lt;p&gt;are you using a python sricpt you or you are wring a long command &amp;quot;by hand&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103840?ContentTypeID=1</link><pubDate>Sat, 28 Oct 2017 16:49:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63912806-49ef-4507-8841-d250a1b46625</guid><dc:creator>abhipray</dc:creator><description>&lt;p&gt;I have verified that my NRF_CLI_CMD_BUFF_SIZE is set to 1024 characters. I checked via gdb that cmd_buff is of length 1024 but only gets filled up to 258 characters-- the proceeding values are nulls and the remainder of the argument is treated as a second command&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF CLI cannot handle long arguments</title><link>https://devzone.nordicsemi.com/thread/103836?ContentTypeID=1</link><pubDate>Sat, 28 Oct 2017 08:50:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36b53c29-2727-4034-857d-dfa2c400b51b</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;By default command accepted by CLI can have 128 characters. You can change this in sdk config: NRF_CLI_CMD_BUFF_SIZE. This is size of static buffer so it will impact your RAM usage especially that this buffer is doubled.&lt;/p&gt;
&lt;p&gt;In addition by default CLI assumes that command will not take more than 12 arguments. CLI will treat argument 12 and all following as one. You can change it as well in sdk config: NRF_CLI_ARGC_MAX.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>