Tx_Thread_MsgQueue Application Description

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX message queue APIs. It demonstrates how to send and receive messages between threads using ThreadX message queue APIs. In addition, it shows how to use the event chaining feature. The main entry function tx_application_define() is then called by ThreadX during kernel start, at this stage, the application creates 3 threads with different priorities and 2 message queues :

tx_app_thread puts the message TOGGLE_LED on MsgQueueOne each 200 ms.

MsgSenderThreadTwo puts the message TOGGLE_LED on MsgQueueTwo each 500 ms.

MsgReceiverThread listen on both message queues :

Expected success behavior

GREEN_LED toggles and following messages are printed to the serial port if the application is running successfully.

 - MsgReceiverThread_Entry: MsgQueueOne is available
 - MsgReceiverThread_Entry: MsgQueueTwo is available

Error behaviors

On failure, an error message is printed to the serial port.

Assumptions if any

None

Known limitations

None

Notes

To optimize the application footprint, the following ThreadX configuration options should be enabled in the tx_user.h file:

#define TX_DISABLE_PREEMPTION_THRESHOLD

#define TX_DISABLE_NOTIFY_CALLBACKS

#define TX_DISABLE_REDUNDANT_CLEARING

#define TX_DISABLE_STACK_FILLING

#define TX_NOT_INTERRUPTABLE

#define TX_TIMER_PROCESS_IN_ISR

#define TX_DISABLE_ERROR_CHECKING

ThreadX usage hints

Keywords

RTOS, ThreadX, Threading, Message Queue, Event chaining

Hardware and Software environment

How to use it ?

In order to make the program work, you must do the following: