Not applicable
Jul 11, 2016
02:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2016
02:52 AM
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
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
- Tags:
- IFX
3 Replies
Attachments are accessible only for community members.
Jul 11, 2016
03:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2016
03:26 AM
Not applicable
Jul 11, 2016
04:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2016
04:02 AM
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
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
Jul 11, 2016
11:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2016
11:23 AM
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.
#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.