External RTC clock mod requires apollo 3 register change. How?

I’m replacing the 32.768KHz crystal in the RTC with a very stable clock, following the recommendations given here:

https://support.ambiq.com/hc/en-us/arti … pollo-MCUs.

In addition to some hardware mods, it requires changing the register XTALGENCTRL value to 0, but do not know how. I am using the OLA Artemis board.

It looks like that address is “ADDRESS: 0x40020124” - I’d think you just call that register and write 0x00 in its place?

You might also post this as a request on the ambiq page linked above

TS- thank you. Yes, that is what needs to be done. Just do not know how to do it in the arduino environment. I looked at HAL use in the open log artemis code, but did not see any that I could use.

Response from Gary, Ambiq Micro tech support: (Thank you, it worked!!)

To write to the register we recommend using the following CMSIS register access method.

For example

uint32_t val = MCUCTRL->XTALGENCTRL; // Read the XTALGENCTRL register

MCUCTRL->XTALGENCTRL_b.XTALBIASTRIM = 0;