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.

RTOS/CC2640: Structure of the UART task

Part Number: CC2640


Tool/software: TI-RTOS

CC2640 4x4 custom board, ble_sdk_2_02_01_18, CCS 6.2, XDS200 debugger.

The application uses a BLE enabled UART task. The uart driver is used in read

callback mode and reads bytes one at a time.

The read callback of the uart is used to post a semaphore to ICall from the

uart task. When a read callback happens, the bytes need to be assembled to 

receive the complete incoming message. This is one added piece of processing

in the read callback ISR.

The write to the uart is done outside the read callback, in the task context.

There are two structures being considered for the uart task. I have pasted the

psuedocode below. Is the task structure from psuedocode 1 more stable than

pseudocode 2? I appreciate comments/feedback.

Thanks,

Priya

UART task

 

Psuedocode 1

 

ReadCallback function

Read one uart byte

Post ICall semaphore

Construct the receive message

                Continue reading the uart

 

Construct receive message function

               When full message is constructed, post semaphore to write to uart

//extra semaphore to reduce processing on callback ISR

 

Uart task function

For(;;){

                                ICallwait

                                Pend on uart write semaphore

Write to uart

               }

 

Pseudocode 2

 

ReadCallback function

Read one uart byte

Construct the receive message

                Continue reading the uart

 

Construct receive message function

               When full message is constructed, post semaphore to ICall

Uart task function

For(;;){

                                ICallwait

Write to uart

               }