5 posts / 0 new
Last post
YuanhangWu
Offline
Last seen:4 years 10 months ago
Expert
Joined:2015-03-25 08:19
BAUDRATE CHANGE

Hi all,

UART_BAUDRATE_115K2 is the value 9.
How to get the value 9?
16M crystal,115200 baudrate ,vaule is 9,wyh?
And is I wan to set the BAUDRATE is 9600,the BAUDRATE set value is 9*(115200/9600) =108?

Keywords:
Device:
MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Yuanhang,

Hi Yuanhang,

I am not sure if i undestand your question, but if you want to set your baudrate in 9600 you should set the UART_BAUDRATE_9K6. Please check the uart.h file

Thanks MT_dialog

YuanhangWu
Offline
Last seen:4 years 10 months ago
Expert
Joined:2015-03-25 08:19
Hi MT_dialog,

Hi MT_dialog,
This is uart.h file define 9600, there is no value after UART_BAUDRATE_9K6 ?

/// Divider for 921600 bits/s
//#define UART_BAUDRATE_921K6 tbd
/// Divider for 460800 bits/s
//#define UART_BAUDRATE_460K8 tbd
/// Divider for 230400 bits/s
//#define UART_BAUDRATE_230K4 tbd2
/// Divider for 115200 bits/s
#define UART_BAUDRATE_115K2 9 // 9 is according 115200 in stead of 4
/// Divider for 57600 bits/s
//#define UART_BAUDRATE_57K6 tbd
/// Divider for 38400 bits/s
//#define UART_BAUDRATE_38K4 tbd
/// Divider for 28800 bits/s
//#define UART_BAUDRATE_28K8 tbd
/// Divider for 19200 bits/s
//#define UART_BAUDRATE_19K2 tbd
/// Divider for 9600 bits/s
//#define UART_BAUDRATE_9K6 tbd

thanks.

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
Joined:2015-06-08 11:34
Hi YuanhangWu,

Hi YuanhangWu,

What is the example project and the SDK you are working on. There should be the definitions and the corresponding calculations right beside each define.

/// Divider for 115200 bits/s
#define UART_BAUDRATE_115K2 9 // = 16000000 / (16 * 115200), actual baud rate = 111111.111, error = -3.549%
/// Divider for 57600 bits/s
#定义UART_BAUDRATE_57K6 17 / / = 16000000 / (16* 57600), actual baud rate = 58823.529, error = 2.124%
/// Divider for 38400 bits/s
#define UART_BAUDRATE_38K4 26 // = 16000000 / (16 * 38400), actual baud rate = 38461.538, error = 0.16%
/// Divider for 28800 bits/s
#define UART_BAUDRATE_28K8 35 // = 16000000 / (16 * 28800), actual baud rate = 28571.429, error = -0.794%
/// Divider for 19200 bits/s
#define UART_BAUDRATE_19K2 52 // = 16000000 / (16 * 19200), actual baud rate = 19230.769, error = 0.16%
/// Divider for 9600 bits/s
#define UART_BAUDRATE_9K6 104 // = 16000000 / (16 * 9600), actual baud rate = 9615.385, error = 0.16%
/// Divider for 2400 bits/s
#define UART_BAUDRATE_2K4 417 // = 16000000 / (16 * 2400), actual baud rate = 2398.082, error = -0.08%

Thanks MT_dialog

YuanhangWu
Offline
Last seen:4 years 10 months ago
Expert
Joined:2015-03-25 08:19
thanks Thanks MT_dialog.

thanks Thanks MT_dialog.

Topic locked