14.7.3.1.6 Function rtc_count_frequency_correction()

Calibrate for too-slow or too-fast oscillator.

enum status_code rtc_count_frequency_correction( struct rtc_module *const module, const int8_t value)

When used, the RTC will compensate for an inaccurate oscillator. The RTC module will add or subtract cycles from the RTC prescaler to adjust the frequency in approximately 1 PPM steps. The provided correction value should be between 0 and 127, allowing for a maximum 127 PPM correction.

If no correction is needed, set value to zero.

Note: Can only be used when the RTC is operated in 1Hz.
Table 14-14. Parameters
Data directionParameter nameDescription

[in, out]

module

Pointer to the software instance struct

[in]

value

Ranging from -127 to 127 used for the correction

Returns

Status of the calibration procedure.

Table 14-15. Return Values
Return valueDescription

STATUS_OK

If calibration was executed correctly

STATUS_ERR_INVALID_ARG

If invalid argument(s) were provided