Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
lila_young
Level 2
Level 2
50 sign-ins 10 replies posted 10 questions asked

Hello expert,

How can we set the baud rate to non-constant?

in my application, I need to change the UART baud rate according to some scenario. 

So the baud rate setting can not be constant.

But if I add the UART app and set a baud rate, it is constant. And it's generated by DAVE, if I change it manually, it will change back to "const" after next generate. it's kind of risk for me.

/*USIC channel configuration*/
const XMC_UART_CH_CONFIG_t UART_RS485_channel_config =
{
  .baudrate      = 9600U,
  .data_bits     = 8U,
  .frame_length  = 8U,
  .stop_bits     = 1U,
  .oversampling  = 16U,
  .parity_mode   = XMC_USIC_CH_PARITY_MODE_NONE
};

So is there a way to make baud rate changeable?

Thanks!

BR,

Lila

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
750 replies posted 250 solutions authored 500 replies posted

Hi, @lila_young ,

    If you use UART APP to config the baudrate, the codes will change each time you click 'generate code'. So you should use API to set the baudrate. 

    You can use 'XMC_UART_CH_Init(XMC_UART0_CH0, &config);' and 'XMC_UART_CH_SetBaudrate (XMC_UART0_CH0, 9600);'  to set the baudrate. Or you can refer to the example in the attachment. Hope this can help you.

BR,

Owen

View solution in original post

0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
Owen_Su
Moderator
Moderator
Moderator
750 replies posted 250 solutions authored 500 replies posted

Hi, @lila_young ,

    If you use UART APP to config the baudrate, the codes will change each time you click 'generate code'. So you should use API to set the baudrate. 

    You can use 'XMC_UART_CH_Init(XMC_UART0_CH0, &config);' and 'XMC_UART_CH_SetBaudrate (XMC_UART0_CH0, 9600);'  to set the baudrate. Or you can refer to the example in the attachment. Hope this can help you.

BR,

Owen

0 Likes
Owen_Su
Moderator
Moderator
Moderator
750 replies posted 250 solutions authored 500 replies posted

Hi, 

    This thread will be closed due to long time no reply, you can refer to my previous reply to learn about the relevant configurations about UART. You can create a new one if you have any other questions. Thanks for you understanding.

BR,

Owen

0 Likes