Skip to content

Conversation

@kevin-gillespie
Copy link
Contributor

@kevin-gillespie kevin-gillespie commented Dec 3, 2025

Description

Add pin configuration for RTC square wave output. Use a frequency counter to verify the RTC frequency. Adjust the trim values to get samples within crystal ppm specification.

Add IPO calibration function. Optionally leave the calibration procedure running to center the frequency. Each LSB of the trim value will be ~160 kHz.

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.

@github-actions github-actions bot added the MAX32657 Related to the MAX32655 (ME30) label Dec 3, 2025
{
static const int CAL_MS = 10;
/* IPO_FREQ / ERTCOCC_FREQ, integer divide, rounded */
static const int AUTOCAL2_DIV = (IPO_FREQ + (ERTCO_FREQ - 1)) / ERTCO_FREQ;
Copy link

@anubiradar-adi anubiradar-adi Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes out to 1526 if my math is correct, should it not be 3662? Even if 1526 was left shifted it would come out to 3052.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3662 and 3051 are based on different IPO frequencies. There is a typo in the documentation. 1526 = 50 MHz / 32768

image

Comment on lines +615 to +618
/* Leaving the calibration hardware running will result in a more accurate frequency on average.
* Trim trim settings will oscillate around the ideal frequency.
*/
MXC_FCR->autocal0 &= ~(MXC_F_FCR_AUTOCAL0_RUN);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any scenario where we might want a one-shot calibration and then shutdown the hardware, e.g. for power efficiency? If we want to leave the calibration hardware running, then should at least be documented in the header file for consumers, IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing the run bit here makes this a one-shot calibration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MAX32657 Related to the MAX32655 (ME30)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants