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-CC1310: Using Uart Task with TI 15.4 Sensor Example

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

Tool/software: Code Composer Studio

Hi!!! 

I am using the CC1310 LaunchPad with SimpleLink CC13x0 SDK 3.20.00.23 and TI 15.4-Stack Sensor Example.

I tried to add a Uart_read Task like this:


#define SERIAL_TASK_STACK_SIZE 900

static uint8_t serialTaskStack[SERIAL_TASK_STACK_SIZE];
Semaphore_Handle SerialSem;
uint8_t varTest;

Void SerialTaskFxn(UArg a0, UArg a1)
{
     while(1)
     {
         UART_read(Board_UART0, &varTest, 1);
         Semaphore_pend(SerialSem, BIOS_WAIT_FOREVER);
     }

}

void readCallback(UART_Handle handle, void *rxBuf, size_t size)
{
         Semaphore_post(SerialSem);
}

Void appTaskFxn(UArg a0, UArg a1)

{

         

Task_Params taskParams;
Semaphore_Params semParams;

        /*All example code remains*/

         /* Add code below */

Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
SerialSem = Semaphore_create(0, &semParams, NULL);


Task_Params_init(&taskParams);
taskParams.stack = &serialTaskStack;
taskParams.stackSize = SERIAL_TASK_STACK_SIZE;
taskParams.priority = 1;
Task_construct(&SerialTask, SerialTaskFxn, &taskParams, NULL);

while(1)
{
      Sensor_process();
}

}

The compilation works fine!!!  But when I tried to upload appears the follow mensage

 

Cortex_M3_0: GEL Output: Memory Map Initialization Complete.
Cortex_M3_0: GEL Output: Board Reset Complete.
Cortex_M3_0: Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 8.3.0.00003)
Cortex_M3_0: Trouble Halting Target CPU: (Error -2064 @ 0x0) Unable to read device status. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 8.3.0.00003)

I have already tried slowly Jtag clock, but didn't work also.

 

  • Try to use Flash Programmer 2 to do mass erase to your LAUNCHXL-CC1310 and test again.

  • I tried but didn't work, still the same message.

    I tried to upload the .hex file with the flash programming 2, and the upload works, but there is no UART communication, not even the default Sensor example messages.

  • If you test original sensor example again, does it work and see output on UART?

  • Yes, with the sensor example code original the uart output works fine

  • Hey Rodrigo,

    I didn't see any changes to the uartParams variable when the UART is initialized. Did you make those changes to include the readCallback function you added? Something along the lines of: 

    UartParams.readCallback  = UartReadCallback;

    The default values are located in the UART.h file in the sdk install directory.

  • Hi Ammar,

    Yes, I have done this uart inicialization. Following the Uart Inicialization code:

    UART_init();
    UART_Params_init(&uartParams);

    uartParams.baudRate = 115200;
    uartParams.readMode = UART_MODE_CALLBACK;
    uartParams.readCallback = &readCallback;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;


    UART_open(Board_UART0, &uartParams);

  • Al the comunication of the Sensor Example is with this function:

    void Board_Lcd_writeString(char *str, uint8_t line)
    {
        System_printf(str);
        System_printf("\r\n");
    }

    Is there any confliction??

  • Hey Rodrigo,

    First, I would suggest initializing the new task in main, and not inside another task function. The point of creating a new task is to make it not dependent on any other, and you can do that by moving the new task code to main().

    If you look at the UART_Read() api, you'll find the first input parameter is of UART_Handle type. You've passed in an index, not a handle. The UART_open() function returns the UART_Handle. Make sure the handle is not in use before attempting to access it, as this is good practice. See the change below:

    //define a global uart handle at the top of main.c
    UART_handle uartHandle;
    
    //main.c()
    //...
    UART_init();
    UART_Params_init(&uartParams);
    
    uartParams.baudRate = 115200;
    uartParams.readMode = UART_MODE_CALLBACK;
    uartParams.readCallback = &readCallback;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    
    uartHandle = UART_open(Board_UART0, &uartParams);
    //...
    
    //SerialTaskFxn()
    //...
    UART_read(uartHandle, &varTest, 1);
    //...
  • Hi Ammar,

    Thank's a lot for your help. I applied your suggestion and works perfectly.