Oct 02, 2018
10:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 02, 2018
10:11 AM
5 Replies
Oct 08, 2018
08:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 08, 2018
08:29 AM
HI...
here is the basic UART project that transmits the message on the terminal. Would also like to highlight that this example is exactly the same as one provided inside of XMCLib package under XMC4500 series/UART/UART_TRANSMIT example. I´ve just changed the LED define while it´s connected to different pin.
Best regards,
Deni
here is the basic UART project that transmits the message on the terminal. Would also like to highlight that this example is exactly the same as one provided inside of XMCLib package under XMC4500 series/UART/UART_TRANSMIT example. I´ve just changed the LED define while it´s connected to different pin.
#include
#include
#define TICKS_PER_SECOND 1000
#define TICKS_WAIT 1000
const uint8_t message[] = "Hello world!!\n";
#define LED1 P2_1
#define UART_TX P1_5
#define UART_RX P1_4
XMC_GPIO_CONFIG_t uart_tx =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_GPIO_CONFIG_t uart_rx =
{
.mode = XMC_GPIO_MODE_INPUT_TRISTATE
};
XMC_GPIO_CONFIG_t led =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 115200U
};
void SysTick_Handler(void)
{
static uint32_t ticks = 0;
uint32_t index;
ticks++;
if (ticks == TICKS_WAIT)
{
XMC_GPIO_ToggleOutput(LED1);
for (index = 0; index < sizeof(message) - 1; index++)
{
XMC_UART_CH_Transmit(XMC_UART0_CH0, message[index]);
}
ticks = 0;
}
}
int main(void)
{
XMC_UART_CH_Init(XMC_UART0_CH0, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART0_CH0, XMC_UART_CH_INPUT_RXD, USIC0_C0_DX0_P1_4);
XMC_UART_CH_Start(XMC_UART0_CH0);
XMC_GPIO_Init(UART_TX,&uart_tx);
XMC_GPIO_Init(UART_RX,&uart_rx);
XMC_GPIO_Init(LED1,&led);
/* Send a message via UART periodically */
SysTick_Config(SystemCoreClock / TICKS_PER_SECOND);
while(1)
{
/* Infinite loop */
}
}
Best regards,
Deni
Oct 09, 2018
08:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 09, 2018
08:03 AM
Hello,
Thanks for your reply. So I have indeed been playing around with the XMC 4500's UART examples and changing the pin configurations. While I can get the code to build and compile, I don't see anything on my serial communication terminal. The way that I have configured the pins is by looking at the Distance2Go radar (device I am using) and XMC 4200 microcontroller data sheets. I have used Pins 0_0 as the UART RX and P0_1 as the UART TX. Any further ideas?
#include
#include
const uint8_t message[] = "Hello world!!\n";
#define UART_TX P0_1
#define UART_RX P0_0
XMC_GPIO_CONFIG_t uart_tx =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_GPIO_CONFIG_t uart_rx =
{
.mode = XMC_GPIO_MODE_INPUT_TRISTATE
};
XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 115200U
};
int main(void)
{
XMC_UART_CH_Init(XMC_UART0_CH0, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART1_CH1, XMC_UART_CH_INPUT_RXD, USIC1_C1_DX0_P0_0);
XMC_UART_CH_Start(XMC_UART0_CH0);
XMC_GPIO_Init(UART_TX,&uart_tx);
XMC_GPIO_Init(UART_RX,&uart_rx);
uint32_t index;
/* Send a message via UART periodically */
for (index = 0; index < sizeof(message) - 1; index++)
{
XMC_UART_CH_Transmit(XMC_UART1_CH1, message[index]);
}
}
Thanks for your reply. So I have indeed been playing around with the XMC 4500's UART examples and changing the pin configurations. While I can get the code to build and compile, I don't see anything on my serial communication terminal. The way that I have configured the pins is by looking at the Distance2Go radar (device I am using) and XMC 4200 microcontroller data sheets. I have used Pins 0_0 as the UART RX and P0_1 as the UART TX. Any further ideas?
#include
#include
const uint8_t message[] = "Hello world!!\n";
#define UART_TX P0_1
#define UART_RX P0_0
XMC_GPIO_CONFIG_t uart_tx =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_GPIO_CONFIG_t uart_rx =
{
.mode = XMC_GPIO_MODE_INPUT_TRISTATE
};
XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 115200U
};
int main(void)
{
XMC_UART_CH_Init(XMC_UART0_CH0, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART1_CH1, XMC_UART_CH_INPUT_RXD, USIC1_C1_DX0_P0_0);
XMC_UART_CH_Start(XMC_UART0_CH0);
XMC_GPIO_Init(UART_TX,&uart_tx);
XMC_GPIO_Init(UART_RX,&uart_rx);
uint32_t index;
/* Send a message via UART periodically */
for (index = 0; index < sizeof(message) - 1; index++)
{
XMC_UART_CH_Transmit(XMC_UART1_CH1, message[index]);
}
}
Oct 10, 2018
02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 10, 2018
02:14 AM
Hi,
have a look at the XMC4100/4200 Data sheet and check the Port I/O Function Table where you can find connection of each pin with the peripherals...it looks like this for the selected pins:
And here you can see that pins P0.0 and P0.1 are connected to a USIC module 1 channel 1 (USIC1C1). So inside of the main function you should initialize and start different channel.
Fix that and see how it goes...other configuration looks fine.
Best regards,
Deni
have a look at the XMC4100/4200 Data sheet and check the Port I/O Function Table where you can find connection of each pin with the peripherals...it looks like this for the selected pins:
And here you can see that pins P0.0 and P0.1 are connected to a USIC module 1 channel 1 (USIC1C1). So inside of the main function you should initialize and start different channel.
Fix that and see how it goes...other configuration looks fine.
Best regards,
Deni
Nov 04, 2018
10:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 04, 2018
10:08 PM
#include
#include
const uint8_t message[] = "Hello world!!\n";
#define UART_TX P0_1
#define UART_RX P0_0
/*UART Cofiguration*/
XMC_GPIO_CONFIG_t uart_tx =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_GPIO_CONFIG_t uart_rx =
{
.mode = XMC_GPIO_MODE_INPUT_TRISTATE
};
XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 115200U
};
int main()
{
/*UART Initialization*/
XMC_UART_CH_Init(XMC_UART1_CH0, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART1_CH1, XMC_UART_CH_INPUT_RXD, USIC1_C1_DX0_P0_0);
XMC_UART_CH_Start(XMC_UART1_CH0);
XMC_GPIO_Init(UART_TX,&uart_tx);
XMC_GPIO_Init(UART_RX,&uart_rx);
uint32_t index;
for (index = 0; index < sizeof(message) - 1; index++)
{
XMC_UART_CH_Transmit(XMC_UART1_CH1, message[index]);
}
}
Still not able to see serial data. I used XMC_UART1_CH1 because from the data sheet P0.0 and P0.1 is connected to U1C1 from the data sheet.
#include
const uint8_t message[] = "Hello world!!\n";
#define UART_TX P0_1
#define UART_RX P0_0
/*UART Cofiguration*/
XMC_GPIO_CONFIG_t uart_tx =
{
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM
};
XMC_GPIO_CONFIG_t uart_rx =
{
.mode = XMC_GPIO_MODE_INPUT_TRISTATE
};
XMC_UART_CH_CONFIG_t uart_config =
{
.data_bits = 8U,
.stop_bits = 1U,
.baudrate = 115200U
};
int main()
{
/*UART Initialization*/
XMC_UART_CH_Init(XMC_UART1_CH0, &uart_config);
XMC_UART_CH_SetInputSource(XMC_UART1_CH1, XMC_UART_CH_INPUT_RXD, USIC1_C1_DX0_P0_0);
XMC_UART_CH_Start(XMC_UART1_CH0);
XMC_GPIO_Init(UART_TX,&uart_tx);
XMC_GPIO_Init(UART_RX,&uart_rx);
uint32_t index;
for (index = 0; index < sizeof(message) - 1; index++)
{
XMC_UART_CH_Transmit(XMC_UART1_CH1, message[index]);
}
}
Still not able to see serial data. I used XMC_UART1_CH1 because from the data sheet P0.0 and P0.1 is connected to U1C1 from the data sheet.
Jun 02, 2022
01:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 02, 2022
01:21 AM