XMC 2Go UART receive problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,
I'm trying to send hex data array from XMC 4500 relax lite to XMC 2Go, but i still found problem on receiver.

The received data on XMC 2Go is different with data that i sent with XMC 4500

this code on XMC 4500 relax lite

uint8_t init_data[11]={0xFF,0x01,0x1E,0x18,0x40,0xFF,0x06,0x99,0x00,0x0A,0x0A};

int main(void)
{
DAVE_STATUS_t status;

status = DAVE_Init(); /* Initialization of DAVE APPs */


UART_Transmit(&UART_0, init_data, sizeof(init_data));

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
}
}
void end_transmit()
{
delay(100000);
UART_Transmit(&UART_0, init_data, sizeof(init_data));

}



and this code on XMC 2Go

void delay(long unsigned int z)
{
while(z--)
{
__NOP();
}
}

int main(void)
{
DAVE_STATUS_t status;
uint8_t a[11],rec_data[11];
uint8_t i;

status = DAVE_Init(); /* Initialization of DAVE APPs */


/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
UART_Receive(&UART_0, rec_data,sizeof(rec_data));
for(i=0;i<11;i++)
{
a=rec_data;
}


UART_Transmit(&UART_1, a, sizeof(a));
delay(100000);


}
}


Data that receive by XMC 2Go i send to hyperterminal on PC to monitor data. And i got this
1711.attach

anybody can help me?

How to make the first data received same with first data sent?
whats wrong with my code?

i use Dave 4.1.4, using baudrate 9600

thanks
0 Likes
3 Replies
chismo
Employee
Employee
First like received
Hello,

In your test setup, is the receiver ready when the first frame is sent by the transmitter? Otherwise, the UART could wrongly detect any 1 to 0 transition from within a frame as the start bit and subsequent data can become corrupted.

If the above is okay, then I would expect that at least, the very first set of 11 frames is correct.
Subsequent sets depends on whether the transmitter is able to wait till the XMC2Go has echoed the data to the hyperterminal, before repeating the transmit sequence.

Regards,
Min Wei
0 Likes
Not applicable
Hai

yes, i made the receiver's ready from the first frame.

anyway, i have solved my problem, i disable RX Fifo on xmc 2go.

but my next question, can i make my xmc 2go reset by an APP?
because when i combine the receiver code with data process code, the next frame received doesn't match with sender frame data.

If i can reset xmc 2go, i think the frame data will match.

Thanks 😄
0 Likes
chismo
Employee
Employee
First like received
Hello,

To do a system reset in an XMC device is very simple and do not require an APP.
You just need to call the CMSIS function NVIC_SystemReset with the line:

NVIC_SystemReset();


Regards,
Min Wei
0 Likes