I am suffering about Frequency of LPC 1343.

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

I am suffering about Frequency of LPC 1343.

763 Views
tanaka135
Contributor I

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.

Labels (6)
0 Kudos
Reply
1 Reply

598 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello, 

I highly recommend you to take a look to the examples that we provide with the LPCOpen. Here you  can see how all the configurations for the peripherals are made. You can download the LPCOpen for the LPC1343 from the next link: 

https://www.nxp.com/downloads/en/software/lpcopen_2_05_lpcxpresso_nxp_lpcxpresso_1343.zip 

Hope it helps!

Victor.

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply