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

DAVE™ Forum Discussions

Not applicable
Hi Guys,

i have two problems with UART and the XMC2Go.
I use the on-board XMC4200 as UART-to-USB-Bridge and HTerm as serial terminal on PC.

First Problem is that i cant set the UART Baud Rate to 1000 Baud. There is no error or exception, but the serial
terminal receives no messages from the µC, and the µC receives nothing from the serial terminal.
I tried using the general UART app settings and the UART_SetBaudrate() function to set the baudrate to 1000, but
none of it worked. The return value from UART_SetBaudrate() is UART_STATUS_SUCCESS, but there is no communication.
Based on the App description and Datasheet, it should be possible to set the baudrate down to 200 baud, but i cant find the
way to dot that. How can i do this, or is this not possible with the XMC2Go?

Second problem is, that (if i set the baudrate to 19200, where communication is possible) i don't get an UART receive interrupt (EndofReceive)
if i delete the UART_StartReceiveIRQ(&UART_0, rec_data, sizeof(rec_data)) function in the main function. Unfortunately i cant find a useful
description of this function, so i don't really know what happens in there. Problem is, that a global variable is necessary to use
the receive interrupt, what i want to avoid. So can anybody tell my, why i have to use the UART_StartReceiveIRQ() function, or if there's
another way to get an UART receive interrupt.

This is my Code:


#include
#include
#include

uint8_t rec_data[1];
int main(void)
{
long int i;

DAVE_Init(); //Initialization of DAVE APPs

UART_STATUS_t x = UART_SetBaudrate(&UART_0, 1000, 16);

UART_SetBaudrate(&UART_0, 1000, 16);

UART_StartReceiveIRQ(&UART_0, rec_data, sizeof(rec_data));

while(1U)
{
}

return 1;
}

void EndofReceive()//Callback function for "End of receive" event.
{
int Test;
UART_StartReceiveIRQ(&UART_0, rec_data, sizeof(rec_data));
Test = (int) rec_data[0];
rec_data[0] = (uint8_t) tolower(Test);
UART_Transmit(&UART_0, rec_data, sizeof(rec_data));
}


And this are my UART Settings:
2224.attach

2225.attach

2226.attach

Thank you in advance for your help,

Timo
0 Likes
0 Replies