This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC1352P: 15.4 OAD Example - Host Application Provides No Command Prompt

Part Number: LAUNCHXL-CC1352P
Other Parts Discussed in Thread: CC1352P

Following the instructions in the OAD example found here, I ran ./host_collector collector.cfg on a Linux host PC running Ubuntu 20.04 with a 1352P1 LaunchPad loaded with the co-processor image connected. I then connected a second 1352P1 LaunchPad loaded with the bim_off_chip and sensor_oad_offchip_secure images, then connected to it via serial terminal and issued an "Associate" command. When switching back to the terminal on the Linux host, though, I find that it never produces the command input prompt required to follow the rest of the example, as shown below.

Am I missing any steps or is there some other issue going on here?

  • Hi Michael,

    Did you give it the "o" command?

    (Task 3, step 7: The coprocessor has a number of commands, to open the 15.4 Gateway network, in the terminal, type the command o and press enter.)

    Cheers,

    Marie H.

  • Hi Marie,

    The problem here is that there is no command prompt into which I can type the command 'o'. From the screenshot in the instructions it appears that there should be a CMD: prompt, but this never appears after starting the application. I tried typing 'o' and pressing enter without the prompt, but that doesn't appear to do anything.

    Thanks,

    Michael

  • Hi Michael,

    You can just write directly in the terminal window. There is no print back, so just press o and enter.

    Cheers,

    Marie H.

  • Yes, I understand in theory I can enter my command in the terminal window, but when I run the application, I get what is shown in the screenshot attached to my original question, where the cursor below Info: Channel 0 blinks, but does not accept any input. When I type 'o' it does not appear on the screen, and when I hit enter after typing 'o', nothing happens.

    Can you clarify, when you say "There is no print back," do you mean that in the currently released version of the SDK, there is no Cmd: prompt displayed, or simply that when a command is entered, there is no further feedback? Either way, I'm still stuck.

  • Any chance you'll be able to look into this issue further?

  • Hi Michael,

    When you type 'o' you won't be able to see it on the screen. After you press enter it should display 'CMD: o'.

    Are you running on a linux machine or are you using a virtual environment?

    Cheers,

    Marie H.

  • Hi Maire,

    As I mentioned above, I have tried entering the command and pressing enter, but nothing happens.

    The host PC is a Linux machine, not a virtual environment.

  • Hi Michael,

    I'm not sure what's wrong. For debug purposes, can yu try following the simpleLink Academy lab on Linux GW and see if you have the same error with the coprocessor example?

    https://dev.ti.com/tirex/explore/node?node=AIpEfnGDfOZ6k-P9SF11iA__pTTHBmu__LATEST

    Cheers,

    Marie H.

  • Raw terminal capture doesn't work as implemented in csf_linux.c on Ubuntu 20.

    I made the following change to make it work (it needs to be cleaned up, but will get you by in the meantime). You can also comment out the call to initConsoleCmd().

  • Oops, forgot to mention you need this include as well.

    #include <fcntl.h>

  • Hi Michael,

    Thank you for posting.

    I don't see the image (looks like a broken image), can you try posting as a code snippet instead?

    Cheers,

    Marie H.

  • Hi Michael,

    Thank you for posting.

    I don't see the image (looks like a broken image), can you try posting as a code snippet instead?

    Cheers,

    Marie H.

  • Hi, side-by-side diff:

    char* getConsoleCmd(void)                                   |  char* getConsoleCmd(void)
      {                                                           |  {
          static bool cmdComplete = false;                        |      static bool cmdComplete = false;
          static char cmd[256] = {0};                             |      static char cmd[256] = {0};
          static int ch;                                          |      static int ch;
      ------------------------------------------------------------|      char buf[1] = {0};
          static uint8_t cmdIdx = 0;                              |      static uint8_t cmdIdx = 0;
                                                                  |  ---------------------------------------------------------------------------------------------------------------------------------
          if(cmdComplete)                                         |      if(cmdComplete)
          {                                                       |      {
              memset(cmd, 0, 256);                                |          memset(cmd, 0, 256);
              cmdIdx = 0;                                         |          cmdIdx = 0;
              cmdComplete = false;                                |          cmdComplete = false;
          }                                                       |      }
                                                                  |
          /* read a character from the stdin stream without blocki|      /* read a character from the stdin stream without blocking */
          /*   returns EOF (-1) if no character is available */   |      /*   returns EOF (-1) if no character is available */
          ch = getchar();                                         |
                                                                  |      fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) | O_NONBLOCK);
          if(ch != -1)                                            |      read(STDIN_FILENO, buf, 1);
      ------------------------------------------------------------|      ch = (int)*buf;
      ------------------------------------------------------------|      if(ch)

  • Before I saw your reply, I eventually switched to using a Beagle Bone Black running TI's Linux image as the host. The TI image, project Arago, is Arch-based and it was still having the same problem of not recognizing any command input. That being the case, even if it's true that there's a conflict with Ubuntu 20.04 and the stdin capture implemented here, it seems that there might be something else going on as well.

    After doing some more digging, I noticed something a bit confusing about the Gateway Linux SDK versioning. I had been using 3.30.01.02, released 16 Apr 2021, but then I saw on the previous releases page that the "previous" version was 4.40.00.03, released on 26 Feb 2021. Marie, or mh, do either of you know what's going on here? Was there a problem with v4 releases that caused a roll-back in the SDK?

    I tried running through this demo using version 4.40.00.03 and it worked as described in the example documentation.

    Here is the 3.30.01.02 version of the function in in the non-working demo:

    char* getConsoleCmd(void)
    {
        static bool cmdComplete = false;
        static char cmd[256] = {0};
        static int ch;
        static uint8_t cmdIdx = 0;
    
        if(cmdComplete)
        {
            memset(cmd, 0, 256);
            cmdIdx = 0;
            cmdComplete = false;
        }
    
        /* read a character from the stdin stream without blocking */
        /*   returns EOF (-1) if no character is available */
        ch = getchar();
    
        if(ch != -1)
        {
             /* Discard non-ascii characters except new lines */
            if(ch == 0xa || (ch >= 0x20 && ch < 0x7F))
            {
                cmd[cmdIdx] = ch;
            }
    
            Board_Lcd_printf(DisplayLine_cmd, "cmd: %s", cmd);
            /* cmdIdx will wrap around for the 256Byte buffer */
            if(cmd[cmdIdx] == 0xa)
            {
                cmdComplete = true;
            }
            else
            {
                cmdIdx++;
            }
        }
    
        if(cmdComplete)
        {
            Board_Lcd_printf(DisplayLine_cmd, "CMD: %s", cmd);
            LOG_printf(LOG_APPSRV_MSG_CONTENT, "CMD: %s\n", cmd);
    
            return cmd;
        }
        else
        {
            return 0;
        }
    }

    ...and here is the 4.40.00.03 working version of the function in question:

    void getConsoleCmd(void)
    {
        static bool cmdComplete = false;
        static char cmd[256] = {0};
        static int ch;
        static uint8_t cmdIdx = 0;
    
        if(cmdComplete || feof(stdin) || ferror(stdin))
        {
            memset(cmd, 0, 256);
            cmdIdx = 0;
            cmdComplete = false;
    
            if (feof(stdin) || ferror(stdin))
            {
                clearerr(stdin);
            }
        }
    
        /* Block until new input is read from stdin */
        ch = getchar();
    
        /* Discard non-ascii characters except new lines. Note however special
         * charcaters like HOME, END, arrow keys, etc will still be read into the
         * buffer via its ASCII CSI sequence. Additional input handling will need
         * to be added later to parse and accept/reject those type of input values. 
         */
        if(ch >= 0x20 && ch < 0x7F)
        {
            cmd[cmdIdx] = ch;
            cmdIdx < 254 ? ++cmdIdx : 254; // +1 for NULL storage
        }
        else if(ch == ASCII_DEL)
        {
            if (cmd[cmdIdx] == ASCII_NULL)
            {
                cmdIdx > 0 ? --cmdIdx : 0;
            }
    
            cmd[cmdIdx] = ASCII_NULL;
        }
        else if(ch == ASCII_LINEFEED)
        {
            cmdComplete = true;
        }
    
        Board_Lcd_printf(DisplayLine_cmd, "cmd: %s", cmd);
    
        if(cmdComplete)
        {
            LOG_printf(LOG_APPSRV_MSG_CONTENT, "cmd: %s\n", cmd);
    
            while(Csf_events & CSF_KEY_EVENT)
            {
                // Block if there is unprocessed input by the collector thread
            }
            processCommand(cmd);
        }
    }

    They both use the getchar() function, but the v4 works on the BBB, but v3 does not. Because "cmd:" is never displayed, it seems like 

    Board_Lcd_printf(DisplayLine_cmd, "cmd: %s", cmd) is never reached in the 3.30.01.02 version, which would only make sense if either
    1.  getConsoleCmd() is never called
    2. ch always evaluates to -1
    Option 2 seems unlikely, but I don't have time to debug any upstream things that might be causing option 1.
    I guess my main question now is, since I've found that the example works with version 4.40.00.03, is there any reason I should not use this over version 3.30.01.02? 
  • Hi Michael,

    The version numbers relate to the device support:

    - Version 3.30.x support CC13x0 devices.

    - Version 4.40 supports CC13x2 devices. In your case I recommend you use this version.

    Cheers,

    Marie H.

  • Ah, this was the problem then, as I was originally using the 3.30 version with a CC1352P LaunchPad. I haven't seen this distinction made anywhere on the TI site. In the CC13x2 Linux Gateway SimpleLink Academy examples (Project Zero & OAD) the "Software" sections specifies the use of "TI 15.4-Stack Linux Gateway SDK 2.2.0 or later" without mentioning any difference between 3.30.x and 4.40.x versions and links to the main Gateway Linux SDK download page, which also does not mention that different versions are needed for the 13x0 and 13x2 devices and defaults (at this moment) to the 3.30.x version.

  • Hi Michael,

    Sorry about the confusion. 

    I'll add a note in the SimpleLink Academy lab.

    Cheers,

    Marie H.