Skip to content

FreeRTOS Clock Config Macros Unsuited to Support Apollo3 #8

Open
@oclyke

Description

@oclyke

Originally raised by a user of the SparkFun BSPs repo: FreeRTOS example code clock-rate error?

Many FreeRTOS example files use this FreeRTOSConfig.h preprocessor definition of clock speed:

#ifdef AM_PART_APOLLO2
    #define configCPU_CLOCK_HZ                  48000000UL
#else
    #define configCPU_CLOCK_HZ                  24000000UL
#endif

This suggests that the Apollo2 runs at 48 MHz and anything else runs at 24 MHz. Since the Apollo2, Apollo3, and possibly other future boards run at 48 MHz this could/would cause timing errors within FreeRTOS. A suggested fix is to replace all those definitions with this alternate which more accurately reflects the default clock settings for Ambiq Apollo MCUs:

#ifdef AM_PART_APOLLO
    #define configCPU_CLOCK_HZ                  24000000UL
#else
    #define configCPU_CLOCK_HZ                  48000000UL
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions