LPC845 SDK 2.8.0 - CLOCK_GetFroFreq - possible bug

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

LPC845 SDK 2.8.0 - CLOCK_GetFroFreq - possible bug

637 Views
JDFAE
NXP Employee
NXP Employee

 

The LPC845 Users Manual shows FRO_DIRECT as Bit17 in the FROOSCCTRL Register but the CLOCK_GetFroFreq code looks like it's checking Bits 1:0.

JDFAE_0-1601318813391.jpeg

JDFAE_1-1601319081762.png

 

0 Kudos
2 Replies

604 Views
JDFAE
NXP Employee
NXP Employee

I will send this information to the customer and provide feedback when I receive it.

0 Kudos

630 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, JDFAE,

I have checked the code, I think the code of uint32_t CLOCK_GetFreq(clock_name_t clockName) is correct that checking the SYSCON->FROOSCCTRL[1:0] to determine the FRO clock source.

Although the SYSCON->FROOSCCTRL[16:0] are RESERVED in the UM11029.pdf, but they are changed with different FRO oscillator frqeuency, they do make sense.

Based on LPCXpresso845MAX board, I have tested the following code and check the SYSCON->FROOSCCTRL value, this is the result:

1)case 1

POWER_DisablePD(kPDRUNCFG_PD_FRO_OUT); /*!< Ensure FRO is on */
POWER_DisablePD(kPDRUNCFG_PD_FRO); /*!< Ensure FRO is on */
__asm("nop");

Result after running:

SYSCON->FROOSCCTRL=0x16B75 in Debugger, in other words, the default is 24MHz FRO, SYSCON->FROOSCCTRL[1:0]=01 in binary.

 

2)Case2


CLOCK_SetFroOscFreq(kCLOCK_FroOscOut30M); /*!< Set up FRO freq */
__asm("nop");

Result after running:

SYSCON->FROOSCCTRL=0x16BBA in Debugger, in other words, the FRO is 30MHz FRO, SYSCON->FROOSCCTRL[1:0]=10 in binary.

 

3)case3
CLOCK_SetFroOscFreq(kCLOCK_FroOscOut18M);
__asm("nop");

Result after running:

SYSCON->FROOSCCTRL=0x16B98 in Debugger, in other words, the FRO is 18MHz FRO, SYSCON->FROOSCCTRL[1:0]=00 in binary.

Hope it can help you

BR

XiangJun Rong

The source code to test FRO:

void BOARD_BootClockFRO30M(void)
{
/*!< Set up the clock sources */
/*!< Set up FRO */
POWER_DisablePD(kPDRUNCFG_PD_FRO_OUT); /*!< Ensure FRO is on */
POWER_DisablePD(kPDRUNCFG_PD_FRO); /*!< Ensure FRO is on */
__asm("nop"); //set break point, check the SYSCON->FROOSCCTRL reg
CLOCK_SetFroOscFreq(kCLOCK_FroOscOut30M); /*!< Set up FRO freq */
__asm("nop");
CLOCK_SetFroOscFreq(kCLOCK_FroOscOut18M);
__asm("nop");
CLOCK_SetFroOutClkSrc(kCLOCK_FroSrcFroOsc); /*!< Set FRO clock source */
POWER_DisablePD(kPDRUNCFG_PD_SYSOSC); /*!< Ensure Main osc is on */
CLOCK_InitSysOsc(12000000U); /*!< Set main osc freq */
CLOCK_SetMainClkSrc(kCLOCK_MainClkSrcFro); /*!< select fro for main clock */
CLOCK_SetCoreSysClkDiv(1U);
/*!< Set SystemCoreClock variable. */
SystemCoreClock = BOARD_BOOTCLOCKFRO30M_CORE_CLOCK;
}

 

0 Kudos