lpcware

problem with receiving By USART

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by omid_aramoon on Sat Jan 09 01:25:32 MST 2016
Hi everybody.

I am trying to connect a sm630 fingerprint module to a keil mcb4357 board using USART. I am using CMSIS USART driver for this purpose.
The problem is that when receiving i just get to receive the last byte sent by the fingerprint module.i have no idea why this happens but i have tried a couple supposed solutions but none of them work.for example :
i used a thread to receive data from the beginning of my code to make sure it won't  miss any sent data which didn't really work!! Actually,this thread made a little improvement though!! i could receive 3 byte out of 16 sent bytes instead of just receiving one last byte.

i know that the baud rate and every thing is alright.

Here are the code i use for receiving and stuff:

The thread code :

void myUART_Thread(const void* args)
{
     int cast ;
    char test ;
    char temp ;
  

    while(1){

Driver_USART3.Receive(&temp, 1);          
osSignalWait(0x01, osWaitForever);
data[offset] = temp ;
offset++;
               offset =(offset)%256 ;

}
}

USART Configuration code and stuff:

----------------------------------------------------------------------------------------------------------------------------------------
void myUSART_callback(uint32_t event)
{             
    switch (event)
    {
    case ARM_USART_EVENT_RECEIVE_COMPLETE:
    case ARM_USART_EVENT_TRANSFER_COMPLETE:
    case ARM_USART_EVENT_SEND_COMPLETE:
    case ARM_USART_EVENT_TX_COMPLETE:
osSignalSet(m_Thread_id, 0x01);
break;

    case ARM_USART_EVENT_RX_TIMEOUT:
         __breakpoint(0); 
        break;

    case ARM_USART_EVENT_RX_OVERFLOW:
    case ARM_USART_EVENT_TX_UNDERFLOW:

        __breakpoint(0); 
        break;
    }
}

--------------------------------------------------------------------------------------------------------------------------------
void Conf_UART(){

volatile int32_t status , send_status;

  
    Driver_USART3.Initialize(myUSART_callback);
   
    Driver_USART3.PowerControl(ARM_POWER_FULL);
  
Driver_USART3.Control (ARM_USART_ABORT_SEND, 0);
Driver_USART3.Control (ARM_USART_ABORT_RECEIVE, 0);
               status = Driver_USART3.Control(ARM_USART_MODE_ASYNCHRONOUS |
                      ARM_USART_DATA_BITS_8 |
                      ARM_USART_PARITY_NONE |
                      ARM_USART_STOP_BITS_2 |
                      ARM_USART_FLOW_CONTROL_NONE, 57600);
    
  
    Driver_USART3.Control (ARM_USART_CONTROL_TX, 1);
    Driver_USART3.Control (ARM_USART_CONTROL_RX, 1);

      

}

Can anybody help me?

Outcomes