This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS UART Only recive one time

Hello,
I've compiled CMSIS RTE UART example for STM32F103 board.
UART Send is ok. but receiving is performed just for one time. it doesn't respond to other incoming bytes.
Here is my UART code.

#include "Driver_USART.h"
#include "cmsis_os.h"                   /* ARM::CMSIS:RTOS:Keil RTX */
#include <stdio.h>
#include <string.h>

void myUART_Thread(void const * argument);
osThreadId tid_myUART_Thread;
osThreadDef(myUART_Thread, osPriorityNormal, 1, 0);        // thread object

extern ARM_DRIVER_USART Driver_USART1;
int Init_Thread_UART (void) {

  tid_myUART_Thread = osThreadCreate(osThread(myUART_Thread), NULL);
  if (!tid_myUART_Thread) return(-1);

  return(0);
}
void myUSART_callback(uint32_t event)
{
        uint32_t mask=ARM_USART_EVENT_RECEIVE_COMPLETE|
                      ARM_USART_EVENT_TRANSFER_COMPLETE |
                      ARM_USART_EVENT_SEND_COMPLETE     |
                      ARM_USART_EVENT_TX_COMPLETE       ;
if (event & mask) {
    /* Success: Wakeup Thread */
    osSignalSet(tid_myUART_Thread, 0x01);
  }
  if (event & ARM_USART_EVENT_RX_TIMEOUT) {
    __breakpoint(0);  /* Error: Call debugger or replace with custom error handling */
  }
  if (event & (ARM_USART_EVENT_RX_OVERFLOW | ARM_USART_EVENT_TX_UNDERFLOW)) {
    __breakpoint(0);  /* Error: Call debugger or replace with custom error handling */
  }

}

void myUART_Thread(const void* args)
{
        static ARM_DRIVER_USART * USARTdrv=&Driver_USART1;
        ARM_DRIVER_VERSION version;
        ARM_USART_CAPABILITIES drv_capabilities;
        char cmd[3]={0};
        #ifdef DEBUG
          version = USARTdrv->GetVersion();
    if (version.api < 0x200)   /* requires at minimum API version 2.00 or higher */
    {                          /* error handling */
        return;
    }
    drv_capabilities = USARTdrv->GetCapabilities();
    if (drv_capabilities.event_tx_complete == 0)
    {                          /* error handling */
        return;
    }
  #endif
                USARTdrv->Initialize(myUSART_callback);
        USARTdrv->PowerControl(ARM_POWER_FULL);
USARTdrv->Control(ARM_USART_MODE_ASYNCHRONOUS |

                  ARM_USART_DATA_BITS_8 |

                  ARM_USART_PARITY_NONE |

                  ARM_USART_STOP_BITS_1 |
                  ARM_USART_FLOW_CONTROL_NONE,9600);
USARTdrv->Control(ARM_USART_CONTROL_TX,1);
USARTdrv->Control(ARM_USART_CONTROL_RX,1);
                ////
USARTdrv->Send("\nHello Javad",12);


while(1)
{
   USARTdrv->Receive(cmd,sizeof(cmd)/sizeof(cmd[0]))
    {
        if (strcmp(cmd,"A\r\n")==0)
        {
            USARTdrv->Send("Hello Javad",12);
            osSignalWait(0x01, osWaitForever);
        }
     }
        osSignalWait(0x01,osWaitForever);
}
}