Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
Not applicable
Hi,

I want to transmit data from XMC1100 boot kit to PC via micro USB. In the datasheet it says that there is a virtual COM port in XMC1100 boot kit, but I don't know how to use it and also could not find any example.
I tried DAVE UART example, but it does not work.

Can someone help me with some example codes please.
Thanks,
Bien
0 Likes
3 Replies
lock attach
Attachments are accessible only for community members.
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

You can download this PC software call "Docklight" and set the require baud rate. Attached is an example which sends ADC information to the PC using XMC1300.
0 Likes
Not applicable
Hi Travis
I tried to integrate the above sample code into XMC1100, but still I do not see anything via my HyperTerminal. I created a UART module using DAVE-APP with the same setting as in the sample code.
My code as follow:


uint8_t data[] = "Testing";
int main(void)
{
DAVE_STATUS_t status;

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

if(status == DAVE_STATUS_FAILURE)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler */
XMC_DEBUG(("DAVE Apps initialization failed with status %d\n", status));
while(1U)
{
}
}

while(1U)
{
UART_Transmit(&UART_0, data, sizeof(data) - 1);
}

return 1;
}

Thanks,
Bien
0 Likes
RValascho
Employee
Employee
5 sign-ins First like received 5 questions asked
I would guess Travis's example works well, but I'm going to offer a different spin on the topic. You can define XMC_DEBUG_ENABLE as TRUE. this ties the printf() new lib commands to your application (xmc_common.h). So now, newlib functions _write and _read are usable. You can configure a UART app to tie to the these commands. Just bring in a UART app and configure to pins P1.3 (XMC Rx) and P1.2 (XMC Tx). So your code looks like the following:

#include

#define XMC_DEBUG_ENABLE TRUE

/* This adds the stdio "putchar/printf" functions to transmit */
int _write(int file, uint8_t *buf, int nbytes)
{
if(UART_Transmit(&UART_0, buf, nbytes) == UART_STATUS_SUCCESS) {
while(UART_0.runtime->tx_busy) {
}
}
return nbytes;
}

/* This adds the stdio "getchar" functions to receive from UART_0 */
int _read(int file, uint8_t *buf, int nbytes)
{
if(UART_Receive(&UART_0, buf, nbytes) != UART_STATUS_SUCCESS) {
while(UART_0.runtime->rx_busy)
{
}
}
return nbytes;
}

Note that the code above waits for the UART buffer to run empty (runtime->tx_busy is a command that could add long latency), so you could drive this as interrrupt based feedback or no feedback at all. With the addition of the UART configuration, just add the app and configure baud rate and pins, you now have printf. Make sure your PC terminal aligns to the baud rate of the UART app settings.
0 Likes