nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
301 stars 136 forks source link

MIMXRT117x: Clock root divider setting cut off at 255. #80

Closed robert-hh closed 2 years ago

robert-hh commented 2 years ago

The function CLOCK_SetRootClockDiv() allows setting a divider for the clock. The divider is an 8 bit value. Suitable values at the register are 0-255 for a divider in the range 1-256. For convenience, the divider is provided in the function call, and the macro subtracts 1 before storing the value. However, a divider of 256 cannot be set, since the function parameter is declared as uint8_t.

static inline void CLOCK_SetRootClockDiv(clock_root_t root, uint8_t div)

Setting it to uint16_t or uint32_t fixes the problem.

mcuxsusan commented 2 years ago

Thanks for reporting the issue. Our developer is working on this.