<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How can I use the CLI - Can&#x27;t get any commands to run]]></title><description><![CDATA[<p>Hello,</p>
<p>I'm trying to inject some aux data in using the debug port, I've CLI #defined'ed in main.c, and I get the &quot;i0&gt;&quot; carrot on the serial interface, but I can't get it to respond to any commands.</p>
<pre><code>//Command table
// {char *name, tShellCallback callback, uint32_t callbackData, const *help }
const tCommand gCommands[] =
{
  {&quot;ver&quot;,      &amp;CmdVersion,                0, &quot;Display firmware version&quot;},
  {&quot;raccel&quot;,   &amp;CmdReadAccelerometer,      0, &quot;Read accelerometer&quot;},
  {&quot;rgyro&quot;,    &amp;CmdReadGyro,               0, &quot;Read Gyro&quot;},
  {&quot;rmag&quot;,     &amp;CmdReadMagnetometer,       0, &quot;Read magnetometer&quot;},
//  {&quot;rGPS&quot;,     &amp;CmdGpsRead, 0,  &quot;Read current GPS value&quot; },
  COMMAND_TABLE_END  //MUST BE LAST!!!
};
</code></pre>
<p>The CLI will echo all my chars, and send a &quot;bell&quot; when i exceed buff size.   I just can't get it to process any command, clearly I'm missing something.</p>
<p>Seems like I should just type &quot;ver&quot; and get something like &quot;OpenIMU300ZA 5020-3885-01 1.0.22 SN:1808400XXX&quot; out.</p>
<p>What terminates a command?</p>
<p>Thanks!</p>
]]></description><link>https://forum.aceinna.com//topic/91/how-can-i-use-the-cli-can-t-get-any-commands-to-run</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 15:49:10 GMT</lastBuildDate><atom:link href="https://forum.aceinna.com//topic/91.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Sep 2019 15:37:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How can I use the CLI - Can&#x27;t get any commands to run on Fri, 20 Sep 2019 15:37:45 GMT]]></title><description><![CDATA[<p>Hello,</p>
<p>I'm trying to inject some aux data in using the debug port, I've CLI #defined'ed in main.c, and I get the &quot;i0&gt;&quot; carrot on the serial interface, but I can't get it to respond to any commands.</p>
<pre><code>//Command table
// {char *name, tShellCallback callback, uint32_t callbackData, const *help }
const tCommand gCommands[] =
{
  {&quot;ver&quot;,      &amp;CmdVersion,                0, &quot;Display firmware version&quot;},
  {&quot;raccel&quot;,   &amp;CmdReadAccelerometer,      0, &quot;Read accelerometer&quot;},
  {&quot;rgyro&quot;,    &amp;CmdReadGyro,               0, &quot;Read Gyro&quot;},
  {&quot;rmag&quot;,     &amp;CmdReadMagnetometer,       0, &quot;Read magnetometer&quot;},
//  {&quot;rGPS&quot;,     &amp;CmdGpsRead, 0,  &quot;Read current GPS value&quot; },
  COMMAND_TABLE_END  //MUST BE LAST!!!
};
</code></pre>
<p>The CLI will echo all my chars, and send a &quot;bell&quot; when i exceed buff size.   I just can't get it to process any command, clearly I'm missing something.</p>
<p>Seems like I should just type &quot;ver&quot; and get something like &quot;OpenIMU300ZA 5020-3885-01 1.0.22 SN:1808400XXX&quot; out.</p>
<p>What terminates a command?</p>
<p>Thanks!</p>
]]></description><link>https://forum.aceinna.com//post/351</link><guid isPermaLink="true">https://forum.aceinna.com//post/351</guid><dc:creator><![CDATA[Adam Jackson]]></dc:creator><pubDate>Fri, 20 Sep 2019 15:37:45 GMT</pubDate></item><item><title><![CDATA[Reply to How can I use the CLI - Can&#x27;t get any commands to run on Mon, 23 Sep 2019 09:01:57 GMT]]></title><description><![CDATA[<p>I had the same problem, after looking at the code I thinks it's design is only for Windows with cr/lf and I am using linux terminal that only sends cr.  I think it might be better for it to detect cr as end of line not LF.</p>
<p>Regardless  of that I don't see how the code ever worked  properly, as the static uint32_t index = 0; and cmdlinde are never reset after am initial command line execution.</p>
<p>I added   bzero(&amp;gCmdLine[0], sizeof(gCmdLine); index = 0  in  (commandline.c)</p>
<p>If you don't reset the above then it will only ever run one command.</p>
<p>void CmdLineLookup(tCommand const *cmd_table)<br />
{<br />
static uint32_t index = 0;</p>
<pre><code>if (DebugSerialReadLine((uint8_t*) gCmdLine, &amp;index, 80)) {
    strrep(gCmdLine, '\r', 0);
    strrep(gCmdLine, '\n', 0);
    if (gCmdLine[0]) {//don't process empty string
        //Ignore lines that start with # character
        if (gCmdLine[0] != '#') {
            _ExecLine(cmd_table);
            
        }
    }
    bzero(&amp;gCmdLine[0], sizeof(gCmdLine)); // Add this
    index = 0; // And this
    CmdPrintPrompt();

} // else wait until prompt is ready
</code></pre>
<p>}</p>
<p>Also comment the following in Debug_usart.c as it is stripping out the cr so it will never find the end of line to and never return true from DebugSerialReadLine()</p>
<p>int DebugSerialReadLine(uint8_t  *buf, uint32_t *index, uint32_t len)<br />
{<br />
uint8_t c = 0, lf = 0;<br />
int num;</p>
<pre><code>while (c != _LF){
    num = uart_read(debugSerialChan, &amp;c, 1);
    if(num &lt;= 0){
        break;
    }
  
    if (_TAB == c) {
        c = _SPACE;
    }
    
    /*if (_CR == c) {  // comment this out
        continue;
    }*/
</code></pre>
<p>Regards,</p>
<p>Simon</p>
]]></description><link>https://forum.aceinna.com//post/352</link><guid isPermaLink="true">https://forum.aceinna.com//post/352</guid><dc:creator><![CDATA[simon-rob]]></dc:creator><pubDate>Mon, 23 Sep 2019 09:01:57 GMT</pubDate></item></channel></rss>