DSPRelated.com
Forums

McBSP as UART Receiving problem

Started by zees...@rocketmail.com December 27, 2011
I am working on code of McBSP as UART provided in SPRA633. It transmits well, but during reception first character is reecived correctly, second and onward characters are not received correctly.

I think after receiving first character processor is busy in processing of first character, when second and onwards character are received.

my code for receiving
void ProcessReceiveData(void)
{
int i;
unsigned char recv_char = 0;
short cnt = -1;
short recv_val;
unsigned short raw_data;
unsigned short *recvbufptr; /*receive buffer pointer*/
/* Point to the receive buffer */
recvbufptr = (unsigned short *)recvbuf;
/* Process all data in the Receive buffer */
for (i = 0; i < BUFFER_SIZE; i++)
{
recv_char = 0;
/* Process each UART frame */
for (cnt = -1; cnt < 10; cnt++)
{
if(cnt == -1 || cnt == 8 || cnt == 9)
{
/* Ignore Start and Stop bits */
*recvbufptr++;
}
else
{
/* Get 16-bit data from receive buffer */
raw_data = *recvbufptr;
recvbufptr++;
/* get the value of the majority of the bits */
recv_val = VoteLogic(raw_data);
/*put received bit into proper place */
recv_char += recv_val << cnt;
}
} /* end for cnt */
/* A full BYTE is decoded. Put in result: recv_msg[i] */
recv_msg[i] = recv_char;
} /* end for I */
} /* end ProcessReceiveData() function */
Regards,
Zeeshan

_____________________________________