Content originally posted in LPCWare by cfgardiner on Wed Jan 07 09:40:05 MST 2015
Hi,
I am developing a customer project based on the LPC1837. Using the lpcopen functions, I cannot determine the clockrate of the APB clocks driving the UART0 or SSP1 peripherals:
I have tried:
// uart0Rate = Chip_Clock_GetRate(CLK_APB0_UART0);
uart0Rate = Chip_Clock_GetBaseClocktHz(CLK_BASE_UART0);
ssp1Rate = Chip_Clock_GetRate(CLK_APB2_SSP1);
The value return is always zero.
I have the following setup which derives a 48 MHz base clock from the USB0 PLL:
Chip_Clock_SetDivider(CLK_IDIV_A, CLKIN_USBPLL, 2);
Chip_Clock_SetDivider(CLK_IDIV_B, CLKIN_IDIVA, 5);
Chip_Clock_SetDivider(CLK_IDIV_C, CLKIN_IDIVA, 5);
Chip_Clock_SetBaseClock(CLK_BASE_UART0, CLKIN_IDIVB, true, false);
Chip_Clock_SetBaseClock(CLK_BASE_UART1, CLKIN_IDIVB, true, false);
Chip_Clock_SetBaseClock(CLK_BASE_SSP1, CLKIN_IDIVC, true, false);
Chip_Clock_SetBaseClock(CLK_BASE_OUT, CLKIN_IDIVB, true, false);
I have verified that this works with a scope so it seems purely be an lpcopen software issue. If I feed the output from DIVA, DIVB or DIVC to CLKOUT[0] I measure the expected clock rates.
Thanks,
Charles