# FreeRTOS Plus CLI，A Fatal Error Ocured 

**URL:** <https://forums.freertos.org/t/freertos-plus-cli-a-fatal-error-ocured/6552>\
**Category:** Kernel\
**Created:** [May 2, 2017, 7:54am UTC](https://forums.freertos.org/t/freertos-plus-cli-a-fatal-error-ocured/6552 "2017-05-02T07:54:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 2, 2017, 7:54am UTC](https://forums.freertos.org/t/freertos-plus-cli-a-fatal-error-ocured/6552/1 "2017-05-02T07:54:15Z")

</div>

**[huangqilong119](https://sourceforge.net/u/huangqilong119/)** wrote on [Tuesday, May 02, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/fb7ab098/#ced1):

Hello,

I want to recommend you fix the freertos source code about CLI  
When I used the ‘FreeRTOS Plus CLI’ source code, ‘UARTCommandConsole.c’ to compile. After Linking and download to STM32 platfrom. A fatal error ocured.  
When I reset the STM32, the welcome information was shown normally via the serial port. However, when I send something to the STM32 via ‘XSHELL’, the STM32 has not any response. Then I pause the debug, I found my program point is always jump to ‘HardFault\_Handler’. Many tries, I found that, at the first beginning, the program is run normally, and once sending something, it was halt!  
Then I check the source code, I found that, at the function ‘`static void prvUARTCommandConsoleTask( void pvParameters )`’, there is a call ‘`xSemaphoreTake( xTxMutex, cmdMAXMUTEX_WAIT )`’, the error is there.

> Because the mutex semaphore ‘`xTxMutex`’ is though defined, it was not created before taking and giving. So it’s the fatal error to cause the OS halt. If you want to fix it, just add a line` 'xTxMutex = xSemaphoreCreateMutex();'`. And Don’t forget change the definetion ‘`#define configUSE_MUTEXES 1`’ in ‘FreeRTOS.h’

Best Regards,

2.May.2017

Edward

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [May 2, 2017, 2:26pm UTC](https://forums.freertos.org/t/freertos-plus-cli-a-fatal-error-ocured/6552/2 "2017-05-02T14:26:11Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, May 02, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/fb7ab098/#ced1/9cbe):

The mutex is created in vUARTCommandConsoleStart().
