- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi I am using CYBL10573-56LQXI. I have setup an UART with the SCB and I want to change the baudrate when the device is running. I have read the specification explaining how to configure the clock divider to setup the target baudrate, but I do not quite understand.
To change the badrate dynamically, I know I need to use an external clock for the UART. By following the example in the spec:
// Target buadrate = 115200, over-sampling = 16, HFCLK = 48MHz
To set the frequency of the UART clock source: UART Clock = 115200 x 16 = 1.8432MHz (So I write this in to the Clock source of the UART)
Then Divider = HFCLK / Uart Clock = 48M / 1.8432M = 26
Then I start the clock and UART by this:
UART_Clock_SetDividerValue(26); // I found the API will subtract the parameter by 1, so I do not subtract myself
UART_Clock_Enable();
UART_1_Start();
However I cannot get it work. I found that if I set the divider to 25:
UART_Clock_SetDividerValue(25);
Then it will work. Why?
Also, in this way I can only change the divider number, which cannot let me to change the buadrate dynamically, how can I change the baudrate to for example 19200 when the device is running?
Thank you.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post your code so we can check it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a PDF that will auto select baud rates. http://www.iaeme.com/MasterAdmin/UploadFolder/AUTOMATIC%20BAUD%20RATE%20DETECTION%20USING%20PROGRAMM...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The SCBs have got an initialization method using a data structure. You could change the appropiate item and re-initialize the UART.
Bob