Writing on the same console as the CLI

monnoliv wrote on Wednesday, June 19, 2013:

I use FreeRTOS-CLI with success (channel is serial line). Now I want to write on the output from one of my task.
Is it possible? Or CLI has the exclusivity of the channel?



rtel wrote on Wednesday, June 19, 2013:

If you can guarantee that only one thing will try and access the serial line at the same time then you can do it.  Otherwise you will need to guard the serial port with a mutex.

Look at the file FreeRTOS-Plus\Demo\FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC\Examples\USB_CDC\CDCCommandConsole.c for an example.

In that file you will see xCDCMutex being used to ensure the command console has access to the (in this case) virtual COM port when it want to send, and a function called vOutputString() that can be called by other tasks to write to the same COM, again protected by the same xCDCMutex mutex.


monnoliv wrote on Friday, July 05, 2013:

Thank you Richard.