2020-01-05 10:30 PM
The RTC_BKPXR register is for recording power off status in our board, we make 10 boards, 4 boards works and 6 boards keep reset the RTC_BKPXR during power recycle, I check the Vbat, it is 2.91 Volt after power off which is correct.
I use TureStudio to debug the board with BKPXR reset issue, when I download the firmware, the RTC_BKPXR content are correct; when I run it, the HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR1) and HAL_RTCEx_BKUPWrite(&hrtc, RTC_BKP_DR1, RTC_SET_SIGNATURE) function works fine, the write and read data are correct; when I restart it, the PC point to main() and all the BKPXR reset to 0 (Good boards keep BKPXR the original value), I check the ISR.TAMP1F and TAMP2F, both are 0, that means no "tamper detection event" occur?
Two questions:
Attached the RTC registers during debugging.
Regards
Sam
2020-01-05 11:14 PM
> I check the Vbat, it is 2.91 Volt after power off which is correct
Are you sure? If this is a button Li cell such as CR2032, this may be indicator of battery-related problem. Measure the battery voltage *during* power cycle using an oscilloscope. Measure it *directly* on the VBAT pin. Check, if all VDD/GND pins are properly connected (including checking them physically for bad solder joints), including - or starting with - the VBAT and VDDA/VSSA pins.
Make sure PWR_CSR.BRE is set and software does not clear it anywhere spuriously.
For tamper pins see pin and ball definitions table in datasheet, pins marked RTC_TAMP1 and RTC_TAMP2 (PI8 and PC13); TAMP1 can be set to any of these two pins, see RTC chapter in RM. But, unless you've set for tamper event, this is not the cause of your problem.
JW
2020-01-05 11:47 PM
Thanks for your reply.
The Vbat is powered by superCap, it can last 5 days after power off(We test it), but the supercap is about 6 cm away from Vbat pin because this board is big,
is the noise causing it "lost power", I can put a 100nF capacitor close to Vbat pin.
PWR_CSR.BRE, I check by debugger, this bit is always 0. The code is generate by STM32Cube, which setting in Cube can enable this bit?
Our MCU package is LQFP100, PC13 is for RTC_TAMP1, but this pin is reconfigured to output, so this will be no tamper event.
REgards
Sam
2020-01-06 12:01 AM
> The Vbat is powered by superCap
I see, then the voltage you've measured is normal.
> is the noise causing it "lost power"
I don't think so.
> PWR_CSR.BRE, I check by debugger, this bit is always 0. The code is generate by STM32Cube, which setting in Cube can enable this bit?
Whoops sorry, this is related to the *backup RAM* not the *backup registers in RAM*, my bad.
At this point the only problem I can think of is the Backup domain reset, caused by some erratic code (which includes Cube/HAL) writing 1 into RCC_BDCR.BDRST. Maybe you want to avoid any Cube/HAL code, for purposes of handling the backup register, by writing your own code accessing directly registers.
JW