Frequency check in SDK function CLOCK_SetupExtClocking()

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

Frequency check in SDK function CLOCK_SetupExtClocking()

837 Views
dougpaulsen
Contributor IV

Actually, the hardware guy found this and challenged me on it, and I think he's right.

Working with MCUXpresso 11.3.0 and the LPC55S16 SDK, the function CLOCK_SetupExtClocking() in fsl_clock.c reads:

status_t CLOCK_SetupExtClocking(uint32_t iFreq)
{
    if (iFreq >= 32000000U)
    {
       return kStatus_Fail;
    }
    ....

Since the maximum external clock is 32 MHz, this function will fail if one happens to be so unlucky as to have such a buzzer attached. For better or worse, the automatically generated call to CLOCK_SetupExtClocking() in function BOARD_BootClock<whatever you've got setup>() doesn't test the return value so code execution continues merrily on its way.

Shouldn't the parameter iFreq test be one of ">", rather than the current ">="?

Fortunately our board happens to use a 16 MHz on XTAL32M, but we were surprised when intentionally erroneously setting the XTAL32M to 32 MHz in the config tool DIDN'T end up with slow timers, etc.

Thanks for your thoughts!

Tags (1)
0 Kudos
2 Replies

814 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @dougpaulsen

I also think this is a bug in the SDK and suggested change should be implemented. I'll let know the SDK team about this issue.

Thanks a lot for your feedback.

Best Regards,

Alexis Andalon

0 Kudos

836 Views
dougpaulsen
Contributor IV

Sorry!  Forgot to identify the referenced code as from SDK_2.x_LPCXpresso55S16 version 2.9.0(435-2021-01-15) ...

0 Kudos