Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

UART on pins P0.6/P0.7 using XMC1100

$
0
0
Hello

I tried to get the UART working on Pins P0.6 / P0.7 but with no success. Same code is working for USIC0.C0 on Pins P2.0 /P2.6.
I think, the hardware of the board but nothing happens on output pin P0.6.

According to the datasheet, the initialization steps should be ok, but it seems there is something missing...

Best regards and thank you for your hints

Geri


Code:

void InitUartC0C1(void)
{
  #define UART_RX P0_7
  #define UART_TX P0_6

  /* UART configuration */
  const XMC_UART_CH_CONFIG_t uart_config = {
    .baudrate  = 115200,
    .data_bits = 8U,
    .parity_mode = XMC_USIC_CH_PARITY_MODE_NONE,
    .stop_bits = 1U
  };

  XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config);
  XMC_UART_CH_SetInputSource(XMC_UART0_CH1,
  XMC_UART_CH_INPUT_RXD,USIC0_C1_DX1_P0_7);

  /* Start UART channel */
  XMC_UART_CH_Start(XMC_UART0_CH1);

  /* GPIO configuration */
  const XMC_GPIO_CONFIG_t rx_conf = {
    .mode = XMC_GPIO_MODE_INPUT_TRISTATE,
    .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD
  };
  const XMC_GPIO_CONFIG_t tx_conf = {
    .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7,
    .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH
  };

  /* Configure GPIO,  */
  XMC_GPIO_Init(UART_TX,&tx_conf);          /* UART TX */
  XMC_GPIO_Init(UART_RX,&rx_conf);          /* UART RX */
}

void main(void)
{
  InitUartC0C1();
  while(1)
  {
    XMC_UART_CH_Transmit(XMC_UART0_CH1, 0x12);
  }
}


Viewing all articles
Browse latest Browse all 9892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>