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-CC2640R2: UART SEND AND ECHO

Part Number: LAUNCHXL-CC2640R2

Hello,

I'm using the LAUNCHXL-CC2640R2  to generate a PWM signal on one of its digital ports , the signal should start when I send  a message "ACTIVATE_PWM:\r\n" VIA UART ( using dochlight scripting).then I should recieve

like "PWM_ON\r\n" . I am using the example provided in TI resource explorer 'uartecho' . the problem is that I could not empty the buffer from the function described in UART.h in the same project (extern int_fast32_t

UART_read(UART_Handle handle, void *buffer, size_t size);   I want to send a message via dochlight followed by carriage return or line feed wich enables a PWM signal and stops the output when I send an other message

"PWM_STOP\r\n" 

I managed to trigger a signal on the message sent (returns"PWM_ON" an stops on the other message but i can't get a feed back like "PWM disabled" via UART  and the code is messy  and not how it should be  and i think it's

due to the buffer being full and unable  to empty with the new TRAME coming in 

  • Hello Nadhir,

    UART_read empties the buffer, and you can also use the UART_control commands to flush the RX FIFO (UARTCC26X2_CMD_RX_FIFO_FLUSH) or determine how many bytes are left to read in the buffer (UART_CMD_GETRXCOUNT).  How are you initializing your UART TI Driver parameters?  Based on your description, I would imagine a readDataMode of UART_DATA_TEXT and readReturnMode of UART_RETURN_NEWLINE.  This way you could avoid having to wait until the buffer is filled before returning, thus assisting with the different lengths of your PWM commands transmitted through UART.  Just make the buffer sufficiently large enough to cover any instance of your commands.

    Regards,
    Ryan