XMC4400 UART not working after SCU clock configuration

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

cross mob
User19299
Level 2
Level 2
First solution authored
Hello,

I have used UART before successfully without the SCU clock configuration. To implement CCU8 functions, I had to implement the SCU clock configuration. When I enable this SCU clock configuration, the UART is not sending messages that are receivable/readable. Here is the configuration:

device: XMC4400 F100k512(Drive Card Rev. 1.0): https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc4400_dc_v1/?redirId=130502

#include "xmc_scu.h"
#include "xmc_uart.h"
#include "xmc_gpio.h"
//initializing the clock functional block
const XMC_SCU_CLOCK_CONFIG_t SCU_clock_config ={
.syspll_config.n_div = 80U,
.syspll_config.p_div = 2U,
.syspll_config.k_div = 4U,
.syspll_config.mode = XMC_SCU_CLOCK_SYSPLL_MODE_DISABLED,
.syspll_config.clksrc = XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP,
.enable_oschp = 1U,
.enable_osculp = 0U,
.calibration_mode = XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_FACTORY,
.fstdby_clksrc = XMC_SCU_HIB_STDBYCLKSRC_OSI,
.fsys_clksrc = XMC_SCU_CLOCK_SYSCLKSRC_PLL,
.fsys_clkdiv = 1U,
.fcpu_clkdiv = 1U,
.fccu_clkdiv = 1U,
.fperipheral_clkdiv = 1U
};
/* uart config */
const XMC_UART_CH_CONFIG_t UART_0_channel_config = {
.baudrate = 19200U,
.data_bits = 16U,
.frame_length = 8U,
.stop_bits = 1U,
.oversampling = 16U,
.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE
};
/* GPIO config */
// GPIO config used by the uart OUT pin
const XMC_GPIO_CONFIG_t DIGITAL_IO_0_conf0 = {
.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1, //hardware controlled, see XMC_4400-DS page 27 at the pin page for pin 5.1
.output_level= XMC_GPIO_OUTPUT_LEVEL_LOW,
.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE
};
// GPIO config used by the uart IN pin
const XMC_GPIO_CONFIG_t DIGITAL_IO_0_conf1 = {
.mode = XMC_GPIO_MODE_INPUT_TRISTATE,
};



/* uart functions */
void uart_init( XMC_USIC_CH_t *const uart_channel){
/* initialize the UART: void XMC_UART_CH_Init(XMC_USIC_CH_t *const channel, const XMC_UART_CH_CONFIG_t *const config);
* example:
* XMC_UART_CH_Init(XMC_UART0_CH0, &UART_0_channel_config);
* */
/* USIC channel configuration
* configured in full duplex mode with 19200 baud
* */
XMC_UART_CH_Init(uart_channel, &UART_0_channel_config);
XMC_UART_CH_SetInputSource(uart_channel, XMC_UART_CH_INPUT_RXD, 3U);
XMC_UART_CH_Start(uart_channel);

XMC_GPIO_Init(XMC_GPIO_PORT5, 1U, &DIGITAL_IO_0_conf0); //output pin uart
XMC_GPIO_Init(XMC_GPIO_PORT5, 0U, &DIGITAL_IO_0_conf1); //input pin uart
}
void transmit( XMC_USIC_CH_t *const channel, uint8_t buffer[], uint8_t size){
for (uint8_t index = 0; index < size-1 ; index ++){
XMC_UART_CH_Transmit(channel, buffer[index]);
}
}
int main(void)
{
/* init of UART0,CH0 */
XMC_USIC_CH_t *uart_channel = XMC_UART0_CH0;
uart_init(uart_channel);
XMC_SCU_CLOCK_Init(&SCU_clock_config); //if I don't init the SCU with this configuration, then the UART works just fine
uint8_t message[] = "message";
while(1U){
transmit(uart_channel, message, (uint8_t) sizeof(message)); // is actually sent in an interrupt every 100ms
*sleep for some time*
}
}


So my question:
Q1:
what configuration of my SCU clock interferes with the UART peripheral ? I see, that I fixed the .fperipheral_clkdiv to match the external crystal clock.
I tried commenting out this line, but that didn't fix the issue.

Q2:
I used the n_div etc. from a Infineon example: Infineon-CCU8-XMC1000_XMC4000-AP32288-AN-v01_01-EN.pdf see page 44/50 at caption 3.2.5

I couldn't find any documentation as to where these parameters (n_div, p_div, ...) are derived from. Could you explain or send a document, please?
0 Likes
1 Solution
User19299
Level 2
Level 2
First solution authored
I resolved Q1, the problem was the initialization process. I initialized the SCU clock after initializing the UART, which lead to a conflict.

View solution in original post

0 Likes
1 Reply
User19299
Level 2
Level 2
First solution authored
I resolved Q1, the problem was the initialization process. I initialized the SCU clock after initializing the UART, which lead to a conflict.
0 Likes