I'm trying to use AN4759 to understand how to configure the RTC alarm for fractional seconds. As an example, I want to trigger an alarm every, say, 10.5 seconds.
Pages 13 and 14 make reference to something that appears to be reference code, but neither the Cube code nor the X-CUBE-RTC code seem to have examples that look like what the application note is asking me to do.
I have tried to make the Cube code here:
do what the app note is asking (I've attached my main.c for reference - it's the only code from the example I've changed other than to use the LSE instead of LSI), but I only appear to be getting integer-second triggers of the alarm. As an example, if I do set my alarm for 10.5 seconds, I appear to be getting alternating 10- and 11-second triggers. It's like on average my trigger is every 10.5 seconds, not individual events. So something is happening, but not what I think should be.
You'll note that I've set salarmstructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL, which doesn't seem right, but even if I set it to RTC_ALARMSUBSECONDMASK_NONE it makes no difference - the behavior appears to be the same. Given my prescaler setting of 255 for the LSE, I'd expect to set this to RTC_ALARMSUBSECONDMASK_SS14_8, but that doesn't do anything different either.
Any help would be appreciated.