This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Change CDC_ACM UART baud rate in runtime

Hi,

I would like to change the CDC_ACM UART (CDC_ACM_0) baud rate in runtime mode on nRF5340, but it seems to be not working. Below is my code snippet:

const struct device *uart;
int ret;

uart = device_get_binding("CDC_ACM_0");

ret = uart_line_ctrl_set(uart, UART_LINE_CTRL_BAUD_RATE, 230400);
if(ret) {
    printk("ERR: can't set UART baudrate! (%d)\n", ret);
}

The return value is 0 (no error), but the baud rate is not changing. 

Am I missing something? Or the functionality is not implemented/supported/limited to some particular speeds?

I'm using NCS 1.6.99 and nRF5340DK 1.0.0.

Best regards,

Mateusz

Parents Reply Children
Related