hi my dear friends:
recently I used the mpc5748g's UART, but there had some problems with me.details are as follows:
1. when i use the function UART_SendData() to send some data, it is always obliterated data,although the send data which is fixed data.
2. when i set the BaudRate 4800 or 9600 it's not obliterated data, but use BaudRate 115200 it will obliterated data.
3. this is the rx1Callback function, at the main function initialize the UART_ReceiveData(&uart1_instance, buffer, 10),it used to open receive interrupt and in the rx1Callback function to send data.
In conclusion thank you for reading this question,if you can give me some suggest, i will be very grateful.
void rx1Callback(void *driverState, uart_event_t event, void *userData)
{
/* Unused parameters */
(void)driverState;
(void)userData;
bufhead = bufend = buffer; // bufhead and bufend are pointer
status =UART_GetTransmitStatus(&uart1_instance, &bytesRemaining);
if((event == UART_EVENT_RX_FULL) && (bufend-bufhead) < 10) // i set once send or receive 10byte
{
bufend ++;
UART_SetRxBuffer(&uart1_instance, buffer, 10);
}
if(status != STATUS_BUSY )
{
UART_SendData(&uart1_instance, buffer, 10);
}
UART_ReceiveData(&uart1_instance, buffer, 10);
}
Hi,
what should be a purpose of your code? After 10 bytes are received send those 10 bytes back?
A pointer usage is also little bit unclear. What is the size of data to be received in burst?
A RX callback is called after required number of bytes are received.
BR, Petr