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.

CC2640R2F: UART Rx issue

Part Number: CC2640R2F

HI,

Below is the UART task created , aim is to receive Data from PC terminal but not able to receive.

Is there any thing missing in task creation ?

UART_createTask() is called from main routine.

 

/* Macros ---------------------------------------------------------------- */

 

#define UART_TASK_STACK_SIZE           400u

#define UART_TASK_PRIORITY                2u

#define RX_BUF_SIZE                                    20u

#define TX_BUF_SIZE                                    20u

 

/* Private functions ----------------------------------------------------- */

 

static Void UARTtaskFxn(UArg arg0, UArg arg1);

 

void UART_createTask(void);

/* Private variables ----------------------------------------------------- */

 

Char UARTTaskStack[ UART_TASK_STACK_SIZE ];

Task_Struct UARTStruct;

UART_Params UARTParam;

UART_Handle UART;

 

uint8_t aUARTRxBuf[RX_BUF_SIZE];

uint8_t aTxBuf[TX_BUF_SIZE];

 

 

 

unsigned char fRxData = 0;

 

/*********************************************************************

* @fn     UART_createTask

*/

 

void UART_createTask(void)

{

Task_Params taskParams;

 

// Configure task

Task_Params_init(&taskParams);

taskParams.stack = UARTTaskStack;

taskParams.stackSize = UART_TASK_STACK_SIZE;

taskParams.priority = UART_TASK_PRIORITY;

//taskParams.arg0 = 100000/Clock_tickPeriod;

Task_construct(&UARTStruct, UARTtaskFxn, &taskParams, NULL);

}

 

 

static void UARTtaskFxn(UArg arg0, UArg arg1)

{

UART_init();

// Create a UART with data processing off.

UART_Params_init( &UARTParam );

UARTParam.writeDataMode = UART_DATA_BINARY;

UARTParam.readDataMode = UART_DATA_BINARY;

UARTParam.readReturnMode = UART_RETURN_NEWLINE;

UARTParam.readEcho = UART_ECHO_OFF;

UARTParam.baudRate = 9600u;

UARTParam.readTimeout = 10000u;

UART = UART_open( Board_UART0, &UARTParam );

 

if ( UART == NULL )

{

   while ( 1 );

}

while( 1 )

{

   while (UART_read(UART, aUARTRxBuf, 1u ) > 0)  

     {

       fRxData = 1;

     }    

}

}

 

Regards,

Bhavin

  • Hello,

    The echo sample application should show you how to read data from a PC terminal, can you build and flash that to your board and verify that it is working?

    If you wish to disable the echoing feature you can remove the UART_write(uart, &input, 1); call from the main loop.

    This will help you to confirm your hardware setup.
  • Hi Sean,

    Thanks for reply.

    Issue is resolved, as it was contained hardware issue... CC2640R2F dev board that i am using in that i need to use DIO2 & 3 as UART so jumpers available on TXD and RXD need to remove that i didn't.

    Regards,
    Bhavin