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.

CCS/LAUNCHXL-CC1352R1: OAD Menu not visible on the Terminal

Part Number: LAUNCHXL-CC1352R1

Tool/software: Code Composer Studio

Hi,

I am trying to run the TI 15.4-Stack - Over the Air Download (OAD) SLA Lab.

Hardware: LAUNCHXL-CC1352R1
SDK version: 4.20.01.04
Running Ubuntu 20.04 as the Linux Host.

But it seems that I cannot enter the OAD menu to enter the commands on the terminal.

I am running the example collector app given in the SDK with a fresh CoProcessor Application imported to CCS from the SDK.

I tried commenting out the IS_HEADLESS symbol in ~/ti/ti154stack_linux_x64_4_20_00_05/example/collector/Makefile, as follows.

...
HERE=$(shell pwd)
CFLAGS += -include ${HERE}/ti_154stack_features.h
CFLAGS += -DAUTO_START
CFLAGS += -DNV_RESTORE
CFLAGS += -DPROCESS_JS
#CFLAGS += -DFCS_TYPE16
#CFLAGS += -DIS_HEADLESS
#CFLAGS += -DTIRTOS_IN_ROM
CFLAGS += -DOAD_BLOCK_SIZE=128 # change this to 64 when building the colector for 2.4GHz Band
CFLAGS += -DNV_LINUX
CFLAGS += -DNVOCMP_NVPAGES=4
CFLAGS += -I.
CFLAGS += -Icommon/
CFLAGS += -I${COMPONENTS_HOME}/common/inc
CFLAGS += -I${COMPONENTS_HOME}/nv/inc
CFLAGS += -I${COMPONENTS_HOME}/api/inc
CFLAGS += -I${SDK_HOME}
...


I did a make clean, make host after altering the Makefile.

But all I see is,

:~/ti/ti154stack_linux_x64_4_20_00_05/example/collector$ ./host_collector collector.cfg

TI Collector
Nwk: Started
   0.079: Transport: 3
   0.079:   Product: 1
   0.079:     Major: 2
   0.079:     Minor: 2
   0.080:     Maint: 0
Info: Channel 0


The terminal window does not accept any key entries. Nor can I see the "cmd:" prompt.

What am I missing here? Could't find much from E2E's old posts too. 




PS: There is now way I could change the CFLAGS += -DIS_HEADLESS using the Prebuilt binaries even though this SLA Lab ignores mentioning it.

  • Hey Tharanga,

    The prebults should have the isHEADLESS flag commented by default which is why it is not mentioned.

    I see that you are using version 20.04, do you mind testing this out on ubuntu 18? 

    Regards,

    AB

  • Hi ,

    Well the thing is I do not have access to Ubuntu 18 right now.

    My execution steps aren't wrong, are they?

    This is with the prebuilts.I remember it was like this when I was running prebuilts & modified examples on Ubuntu 18 before upgrading to 20.

    Are there any other settings I have to change other than the Makefile to get the "cmd" prompt?

    Does the "cmd" prompt appear only after connecting a sensor?

  • Hi ,

    Digging a bit further down in the Collector Source code, I realized the following.

    Execution flow is as like below.

    In collector_thread() --> Collector_process() --> Csf_processEvents()

    Here,
    if IS_HEADLESS is commented on the Makefile,

    Goes to getConsoleCmd(). 

    In getConsoleCmd I obsereved that,

    getchar() always returns -1 upon execution of host_collector. Thereafter, the key strokes are not accepted either.

    Thus, this line is never printed.

    Board_Lcd_printf(DisplayLine_cmd, "cmd: %s", cmd);

    But,
     if I do this on the terminal,

    echo "o" | ./host_collector

    it accepts the command 'o' and prints,

    Info: PermitJoin-ON

    Why does the terminal key inputs are not detected here? Please let me know if you need further info. Still on Ununtu 20.04

  • There will be a fix for this on the next sdk update, which is why I was asking about v 18.04 (the version that our documentation states our SDK works with).

    Nevertheless, it seems like there is an issue with noncanonical input mode using getchar. Whenever getchar is called in noncanonical mode without anything buffered in stdin, it returns EOF when it should return 0. This means subsequent calls to getchar get locked to returning EOF no matter if there is buffered stdin input.

    This can be fixed by forcing canonical mode, but that results in not being able to see input character by character.

    another quick fix can be to add:

        else
        {
            clearerr(stdin);
        }

    after the if statement that is after getchar().

    Regards,

    AB

  • Hi ,

    Adding the else {} block didn't seem to work well. As you said not being able to see multiple input characters on the same line can be confusing.

    Thus one of my colleagues came up with this workaround, which seem to work well. I am posting it here for everyones' benefit.

    Instead of reading the input command from the Terminal, is is read from a file.

    Step 1:
    In file csf_linux.c, replace  getConsoleCmd() with getCmdFromFile()

    void Csf_processEvents(void)
    { ...
    
      /* Replace getConsoleCmd() with getCmdFromFile() */
      //cmdBuff = getConsoleCmd();
        cmdBuff = getCmdFromFile(); 
    
        if(1 == ResetRspNeeded) //Onchip case
        {...
    
    ...
    }

    Step 2:

    Define the function getCmdFromFile() and the prototype.

    char* getCmdFromFile();
    char* getCmdFromFile()
    {
       FILE *fp;
       char *buffer = malloc (sizeof (char) * 256);
       memset(buffer, 0, 256);
       fp = fopen("cmd.txt", "r"); // read mode
       fgets(buffer, 256, fp);
       fp=freopen(NULL,"w",fp);
       fputs("",fp);
       fclose(fp);
       return buffer;
    }

    Step 3:

    Run collector app as usual on the terminal after a make clean, make host.

    :~/ti/ti154stack_linux_x64_4_20_00_05/example/collector$ ./host_collector collector.cfg 
    

    Step 4:

    On a new terminal window, at the same directory, you can run your OAD commands ike this.

    :~/ti/ti154stack_linux_x64_4_20_00_05/example/collector$ echo "o" > cmd.txt

    Just replace 'o' with,

    sxx: Select a device. Example 's1'| 's0x1234'
    o:   Toggle the permit join
    l:   List devices
    b:   Send a board type request to the selected device
    t:   Send an LED toggle request to selected device
    v:   Send a version request to selected device
    u:   Send FW update request to selected device (Off-Chip OAD)
    w:   Send FW update request to selected device (On-Chip OAD)
    d:   Send disassociation request to selected device
    fxx: Set FW file from configured OAD FW dir. Example 'f sensor_mac_oad_cc13x2lp_app.bin'

    I tried this for OAD image delivery and it worked! You can have multiple characters as the input too.

    :~/ti/ti154stack_linux_x64_4_20_00_05/example/collector$ echo "s1" > cmd.txt