Hello
I humbly apologize for my poor English as i am still a beginner.
I am suffering about Frequency of LPC 1343.
Currently I am creating a function to communicate with PC with UART,
I set Frequency to 72 MHz, but it is 12 MHz.
Since the frequency calculation did not match even when I2C was set,
I think that the setting of MainClock is incorrect.
Please let me know if you have anything wrong or advice.
Calculating BaudRate is done like this.
BaudRate = PCLK /(16*(256*U0DLM+U0DLL)*(1+DivAddval/MULVAL)
BaudRate = 57600
PCLK = 12MHz = 12000000Hz
U0DLM = 0
U0DLL = 13
DivAddval = 0
MULVAL = 1
Actually, when PCLK is 72 MHz, U 0 DLL = 78,
Since PCLK is 12 MHz, U 0 DLL = 13 must be set.
Also,There was no problem with UART communication when U0DLL = 13.
The UART setting is like this.
LPC_IOCON -> PIO1_6 = 0x1;
LPC_IOCON -> PIO1_7 = 0x1;
LPC_SYSCON -> UARTCLKDIV = 0x1; //UART_PCLK = CCLK
LPC_SYSCON -> SYSAHBCLKCTRL |= 1 << 12; //UART CLOCK Enable
LPC_UART -> LCR = 3 | 1 << 7; //UART Line Control Register
LPC_UART -> DLL = 13; //UART Divisor Latch LSB Register
LPC_UART -> DLM = 0; //UART Divisor Latch MSB Register
LPC_UART -> FCR |= 1 << 0 | 1 << 1 | 1 << 2; //UART FIFO Control Register
LPC_UART -> FDR = 1 << 4 | 0; //UART Fractional Divider Register
LPC_UART -> LCR &= ~(1 << 7);
MainClock setting is done as follows
LPC_SYSCON -> SYSPLLCLKSEL = 0x1; //System PLL Clock source select register :System oscilator
LPC_SYSCON -> SYSPLLCLKUEN = 0x0; //PLL clock source update enable register
LPC_SYSCON -> SYSPLLCLKUEN = 0x1;
LPC_SYSCON -> SYSAHBCLKDIV = 0x01; //PCLK = 72Mhz/SYSAHBCLKDIV
LPC_SYSCON -> SYSPLLCTRL = 0x25; //Base Clock 72MHz
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Thank you for answering my questions !
Your comment is very useful information.
I understood how to set it up thanks to you, so I will try various things.