Hi,
I'm working with TWR-VF65GS10 and IAR, using MQX.
My code sets a time and then I comment the code and start my program again (reset). When I read the RTC back, it has came back to 01-01-1970, 0h.
I already changed the J1 to position 2-3 (Vbat comes from battery) and, obviously, put the battery.
Could anyone share any solution? Thanks....
My code is as follow (taken from this forum):
void setTimeFromDate(uint_32 year, uint_32 month, uint_32 day, uint_32 hour,
uint_32 minute, uint_32 second, uint_32 millisec){
TIME_STRUCT MQX_time;
DATE_STRUCT DateStruct;
RTC_TIME_STRUCT RTC_time;
DateStruct.YEAR = (uint_16)year;
DateStruct.MONTH = (uint_16)month;
DateStruct.DAY = (uint_16)day;
DateStruct.HOUR = (uint_16)hour;
DateStruct.MINUTE = (uint_16)minute;
DateStruct.SECOND = (uint_16)second;
DateStruct.MILLISEC = (uint_16)millisec;
_time_from_date(&DateStruct, &MQX_time);//Convierte la fecha a tiempo MQX
_rtc_time_from_mqx_time (&MQX_time, &RTC_time);
_rtc_set_time (&RTC_time);
}
void getDateFromTime() {
TIME_STRUCT MQX_time;
DATE_STRUCT DateStruct;
RTC_TIME_STRUCT RTC_time;
_rtc_get_time (&RTC_time);
_rtc_time_to_mqx_time ( &RTC_time, &MQX_time);
_time_to_date(&MQX_time, &DateStruct );
}
Dear Sandro,
It is caused by the known hardware issue (https://community.freescale.com/message/343277#343277) and the fact that there is a resistor connected in series with the battery.
With the current too high the voltage on the Vybrid VBAT rail appears to be too low to retain the RTC data, thus, to run such tests on your board, you will have to lower the resistor value.
The new Vybrid revision has this issue fixed so that the new board builds will not have such a problem.
Regards, Naoum Gitnik.
Hi Naoum,
I'll make the correction but I'm not sure that is the real problem. When I'm doing the tests, the power of the TWR is not disconnected, I just restart the program and the time is reset. It seems to me to be a software issue.
thank you and regards...
Dear Sandro,
I am just curious if your code works properly, i.e. the RTC time is stored with the J1 shunt staying all the time in the default (1-2) position...
Regards, Naoum Gitnik.
Hi Naoum,
No the time isn't kept even with 3.3V direct (J1 = 1-2). That's why I think it might be a sw issue.
Regards,
Dear Sandro,
If this piece of information were provided from the very beginning, a few days would be saved...
juangutierrez, may you comment on the topic-starter's code and/or compare it to what we have, please?
Thanks in advance, Naoum Gitnik.
juangutierrez do you have an update on this case?
Sorry, I have been busy with other issues. I have not had chance to check this one.
Juan,
Please provide estimated due date to have an update.
Well, I don't think I have a chance to check it this week.
And I'm out next week until January 1st.
I can start checking after the holidays.
Hi Juan,
No problem, we'll be back at January 13.
Thank you
juangutierrez please continue with the follow up.
I'll take it.
Hi Sandro,
Did you try to transfer systime to hardware clock :
hwclock --systohc
then read again
hwclock
Emmanuel
Hi Emmanuel,
I'm sorry but I didn't understand:
hwclock --systohc
It's supposed to be put in my code? How? Is it a linker command?
Remember I'm using MQX.
thanks...
Hi Sandro,
Sorry, I didn't see you worked with MQX.....
No problem Nouchi. Cheers...