Different UART speeds

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Different UART speeds

842 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tarakan on Fri Mar 04 01:54:40 MST 2016
Setting different speeds simultaneously for UART ports are clear. Settings 115200, 9600 and 19200bps seamlessly. When setting substandard 100000bps (needs camremote of Sony) it's simultaneous setting speed 115200 unattainable. I use internal oscillator on 12MHz. Any idea how to simultaneously set 100 and 115.2kbps? Thenks
Labels (1)
0 Kudos
6 Replies

593 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

593 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tarakan on Sat Mar 05 08:04:35 MST 2016
Thanks DF9DQ. Great tip. Another degree of freedom fits. I agree. Oversampling 8 is more than enough.  This problem is resolved. Thank you very much.
0 Kudos

593 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Sat Mar 05 05:57:37 MST 2016
Interesting, the LPC82x supports setting oversampling from 5 to 16 (the LPC81x doesn't).
Unfortunately the OP didn't tell us which one he uses.
0 Kudos

593 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DF9DQ on Sat Mar 05 04:25:05 MST 2016
The USART's offer the oversampling ratio OSR as an additional degree of freedom. Default is 16x oversampling, but slightly smaller values are no problem as long as the peer device has a reasonable baud rate accuracy.

Assuming a 12 MHz main clock, you get 12M/100k = 120, 12M/115k2 = 104.17, 12M/9k6 = 1250
104.17 = 8 * 13 (104, 0.16% error)
120 = 8 * 15 (no error)
1250 = 8 * 12 * 13 (1248, 0.16% error)

Leave the UART fractional generator disabled.
UARTCLKDIV = 1
USART0: OSR = 12, BRG = 7
USART1: OSR = 14, BRG = 7
USART2: OSR = 12, BRG = 95

Moving the common factor 8 to UARTCLKDIV may yield slightly lower power consumption.

0 Kudos

593 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tarakan on Sat Mar 05 00:20:55 MST 2016
Thanks for the tip. I tried 24 and 30 MHz. Current speed 100 and 115.2 kbps not work. Improvement was to speed 9600bps. It was really physically 9600 and no 10000bps  such as at a speed MCU 12MHz. (At the current rate 100kbps on the second channel.)
Speed is adjusted as follows:
Chip_Clock_SetUSARTNBaseClockRate((115200 * 16), true);
Chip_UART_SetBaud(LPC_USART0, 115200);
Chip_UART_SetBaud(LPC_USART1, 100000);
Chip_UART_SetBaud(LPC_USART2, 9600);
0 Kudos

593 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Fri Mar 04 03:37:17 MST 2016
Use a 24MHz system clock.
0 Kudos