Hi, I have a project where I need to interface with a device through a serial port at 2,250,000 baud but the CMSIS usart drive won't let me as it has too large an error.
Does anyone have any ideas how I can get over this?
Also the baud rate calculator for the LPC43xx formula in UM10503 rev 1.8 page 1115 seems wrong? With my system working at 230400 baud, my registers are:
plck = 12MHz DLM = 5 DLL = 0 DivAddVal = 5 MulVal = 8
baud = plck/(16 x (256 x DLM +DLL) +(1 + DivAddVal/MulVal))
According to this calc I get a 360baud? Does anyone have a correct formula or do I have something wrong.
I suspect you have the high/low order values mixed up, and your PCLK (Peripheral Clock) is 30 MHz not 12 MHz
That would make sense but I don't think so, unless the datasheet has the registers wrong.
0x400C2000 = 0x00000000 DLLSB 0x400C2004 = 0x00000005 DLMSB
Also single stepping (seems to) confirms 12Mhz.
PClk = GetClockFreq ((*usart->clk.base_clk >> 24) & 0x1F); PClk = 0xB71B00 = 12Mhz
I must be going mad!
And DLAB=1 ? And you're not looking at RBR/IER
At 12 MHz the max rate would be 750 Kbaud
Ah I see, shared registers so (I'm not going mad). Just came to the same conclusion on the 12Mhz, trying to find out where best to adjust it.
I was going to run it from PLL1 what do you think? At 180Mhz/2.25Mhx x16 = 5 that should give me a spot on baud rate.
I haven't used LPC's for about 3-4 years, things have changed quite a bit (including me).
Thanks a mill for you help!
I added this line of code and I have some nice transmissions going at 2.25Mbaud
/*---------------------------------------------------------------------------- Change USART 3 clock source *----------------------------------------------------------------------------*/
LPC_CGU->BASE_UART3_CLK = (0 << 0) | /* Disable Power-down */ (1 << 11) | /* Autoblock En */ (IDIVA_CLK_SEL << 24) ; /* Clock source */
Not using NXP/LPC parts, but would appear you can clock at up to 204 MHz, and USART would run at 1/16 of that.