diff --git a/examples/infineon/infineon-xmc7200/hal.h b/examples/infineon/infineon-xmc7200/hal.h index 7bf9db50317..976aaa8090f 100644 --- a/examples/infineon/infineon-xmc7200/hal.h +++ b/examples/infineon/infineon-xmc7200/hal.h @@ -137,11 +137,15 @@ static inline void uart_init(volatile CySCB_Type *uart, unsigned long baud) { if (div == 0) div = 1; frac = SYS_FREQUENCY % (baud * ovs); frac = (frac * 100) / (baud * ovs); - PERI_PCLK->GR[1].DIV_CMD = (3 << PERI_PCLK_GR_DIV_CMD_TYPE_SEL_Pos); + PERI_PCLK->GR[1].DIV_CMD = (3 << PERI_PCLK_GR_DIV_CMD_TYPE_SEL_Pos) | + PERI_PCLK_GR_DIV_CMD_PA_DIV_SEL_Msk | + PERI_PCLK_GR_DIV_CMD_PA_TYPE_SEL_Msk; PERI_PCLK->GR[1].DIV_CMD |= PERI_PCLK_GR_DIV_CMD_DISABLE_Msk; // disable divider PERI_PCLK->GR[1].DIV_24_5_CTL[0] = (((uint8_t) (div - 1)) << PERI_PCLK_GR_DIV_24_5_CTL_INT24_DIV_Pos) | (frac << PERI_PCLK_GR_DIV_24_5_CTL_FRAC5_DIV_Pos); - PERI_PCLK->GR[1].DIV_CMD = (3 << PERI_PCLK_GR_DIV_CMD_TYPE_SEL_Pos); + PERI_PCLK->GR[1].DIV_CMD = (3 << PERI_PCLK_GR_DIV_CMD_TYPE_SEL_Pos) | + PERI_PCLK_GR_DIV_CMD_PA_DIV_SEL_Msk | + PERI_PCLK_GR_DIV_CMD_PA_TYPE_SEL_Msk;; PERI_PCLK->GR[1].DIV_CMD |= PERI_PCLK_GR_DIV_CMD_ENABLE_Msk; // enable divider PERI_PCLK->GR[1].CLOCK_CTL[PCLK_SCB3_CLOCK & 0xff] = 3 << PERI_PCLK_GR_CLOCK_CTL_TYPE_SEL_Pos; // connect SCB3 to div_24_5_ctl[0] @@ -159,9 +163,8 @@ static inline void uart_init(volatile CySCB_Type *uart, unsigned long baud) { static inline void uart_write_byte(volatile CySCB_Type *uart, uint8_t byte) { (void) byte; (void) uart; - //while((uart->INTR_TX & SCB_INTR_TX_EMPTY_Msk) == 0) spin(1); + while((uart->INTR_TX & SCB_INTR_TX_EMPTY_Msk) == 0) spin(1); uart->TX_FIFO_WR = byte; - spin(1000); } static inline void uart_write_buf(volatile CySCB_Type *uart, char *buf, size_t len) { diff --git a/examples/infineon/infineon-xmc7200/main.c b/examples/infineon/infineon-xmc7200/main.c index 880c2d6d0cb..5b22c5da6c9 100644 --- a/examples/infineon/infineon-xmc7200/main.c +++ b/examples/infineon/infineon-xmc7200/main.c @@ -35,8 +35,7 @@ int main(void) { now = mg_millis(); gpio_toggle(LED2); - // for now, write only a character to UART every second - uart_write_byte(UART_DEBUG, 'a'); + uart_write_buf(UART_DEBUG, "hello\n", 6); } }