AnsweredAssumed Answered

MQX not starting when VBAT is not fully charged

Question asked by Jesper Evertsson on Oct 31, 2016
Latest reply on Nov 7, 2016 by Cutworth Wang

Hi, we recently discovered a problem with our products. When we try to start them after they've been lying around without power for a while nothing happens at first and we have to break the power and restart them for it to work. We figured it had something to do with the VBAT being discharged and we are pretty sure that's the case. To force the error while being able to debug the code we disabled the capacitor to make sure the VBAT never gets charged. Then while stepping through the code we believe the problem arises in the function __pe_initialize_hardware() in the file bsp_cm.c. When we get to the line;

 

if ((RTC_CR & RTC_CR_OSCE_MASK) == 0u)

 

the code just stops executing, so I assume there is some problem with reading the RTC registers when the VBAT is not yet fully charged. Since the VBAT will be fully charged rather soon it would be better if the code could just reread the RTC registers until it gets the wanted the result but we are not sure how to accomplish this. Would it be possible to check the status of the VBAT before trying to read the RTC registers and just place that in a while loop to wait for the VBAT to become charged before continuing?

Outcomes