Frequency check in SDK function CLOCK_SetupExtClocking()

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Frequency check in SDK function CLOCK_SetupExtClocking()

889件の閲覧回数
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!

タグ(1)
0 件の賞賛
2 返答(返信)

866件の閲覧回数
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 件の賞賛

888件の閲覧回数
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 件の賞賛