RTC in TWR-Vybrid doesn't keep time

cancel
Showing results for 
Search instead for 
Did you mean: 

RTC in TWR-Vybrid doesn't keep time

1,853 Views
sandrobastos
Contributor IV

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 );

}

@bruno_c@freescale.com

Labels (3)
Tags (2)
36 Replies

300 Views
markwatson
Contributor III

Hi Sandro,

I do not see a resolution to this problem among the many posts here.  I am running MQX 4.1 on hardware with only 1.0 K in series with the battery and I am seeing the same problem that you described.  The Vybrids are the newer mask set so they are not drawing much current on VBAT (< 100 uA).  Did you ever solve this?


Thanks,


Mark

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Mark,

I did not work with rtc anymore. We are putting an external rtc in our hardware because the high current of vybrid rtc.

Phytec also uses an external rtc in their PCM052 SOM modules.

cheers,

Sandro

0 Kudos

300 Views
markwatson
Contributor III

Hi Sandro,

Thanks for getting back to me. I can actually live with the 50 uA draw of the RTC in this product if I can get it working reliably. The documentation in the RM is almost nonexistent.

Mark

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Mark,

No problem. The Freescale docs are not very friendly…

This level of current is too high for us – we are used to work with some few uA.

Best regards,

Sandro Y. G. Bastos

Motion Control

WEG Drives & Controls - Automacao Ltda.

Phone: +55-47-3276.7565

www.weg.net<http://www.weg.net/>;

De: MARK WATSON

Enviada em: quinta-feira, 11 de dezembro de 2014 16:10

Para: Sandro Ybaltur Gentilini Bastos

Assunto: Re: - RTC in TWR-Vybrid doesn't keep time

<https://community.freescale.com/>

RTC in TWR-Vybrid doesn't keep time

reply from MARK WATSON<https://community.freescale.com/people/markwatson?et=watches.email.thread> in Vybrid Processors - View the full discussion<https://community.freescale.com/message/461943?et=watches.email.thread#461943>

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Rene, it's been 2 weeks and nothing about this issue...where is the PDF I should download?

rendy

thanks...

0 Kudos

300 Views
rendy
NXP Employee
NXP Employee

Hi,

sorry for late reply. As I wrote ealier, this is a bug in MQX. Good news is that it will be corrected in 4.1.0 version which will be released at the end of February. If you need it earlier, please let me know. I could try to find out if there is some nonpublic release candidate available now.

Rene

300 Views
kubiznak_petr
Contributor V

Hi Rene,

I would actually appreciate a bugfix or MQX 4.1 prerelease if possible.

Also, can you please explain what is the difference between MQX and Linux in storing the time? Because while Linux remembers correct time, MQX does not read nor write it (MQX time handling does not change Linux time).

0 Kudos

300 Views
sandrobastos
Contributor IV

Ok Rene,

I can wait for the 4.1.0.

I was waiting for that download you adviced me: "Vybrid Security Reference Manual".

I entered you name and e-mail but didn't have any link of feedback regarding the download...

thanks,

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Rene,

I think it's a HW problem now. The RTC is keeping right time if the TWR isn't switched off. If the main supply is lost the RTC is reset to 01/01/1970, 00:00:00.

Yes, I have a 3V battery attached and the J1 is at position 2-3 (VBAT tied to Coin Cell).

regards,

sandro

rendy

0 Kudos

300 Views
naoumgitnik
Senior Contributor V

Dear Sandro,

Thanks for keeping us updated.

Actually, below is my reply dated December, 2013:

"It is caused by the known hardware issue ( https://community.freescale.com/message/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.”

Since then, the latest device revision got this issue fixed. I am afraid you are using a board bearing the older one.

Regards, Naoum Gitnik.

Rene Kolarik

Petr Kubizňák

Alejandro Lozano Lozano

0 Kudos

300 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Naoum,

Thanks for the information. I wonder if you can provide a suggestion of the value of the resistor.

Best Regards,

Alejandro

0 Kudos

300 Views
naoumgitnik
Senior Contributor V

Dear Alejandro,

The resistor value depends on the battery type used, and the Datasheet, in its "32 KHz Oscillator Specifications” section, provides guidance for that.

Regards, Naoum Gitnik.

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Naoum,

Yes, I remember your answer about the resistor - I've changed it but I didn't remember.

I'm using Rev.G of TWR Vybrid.

No problem - we intend to have our own hardware in a few weeks.

I only wanted to update the post, since with older MQX version, the time was lost even in a reset.

best regards,

sandro

0 Kudos

300 Views
naoumgitnik
Senior Contributor V

Thanks Sandro.

I see - it looks like it was both hardware- and software-related.

Regards, Naoum Gitnik.

300 Views
karina_valencia
NXP Apps Support
NXP Apps Support

rendy please  continue with the  follow up.

0 Kudos

300 Views
rendy
NXP Employee
NXP Employee

Hi Sandro,

this is a bug in the MQX RTC driver. It doesn't store the time to the correct (nonvolatile) place. The real time peripherial hardware is otherwise working correctly. Please consult Vybrid Security Reference Manual, you can request it here.

Rene

300 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi rendy,

Sorry to bother you.

Do you know what the problem was? I have a customer that is using MQX 4.0 and its project has advanced too much to migrate to MQX 4.1.

If I could know what the problem was, maybe I can provide a solution for the customer.

Best Regards,

Alejandro

0 Kudos

300 Views
sandrobastos
Contributor IV

Hi Rene,

I need you e-mail in order to fullfil the download form otherwise freescale doesn't allow me to make the download... ;-(

thanks

Freescale Salesperson/FAE Name:   
FAE Email Address:   
0 Kudos

300 Views
rendy
NXP Employee
NXP Employee

My email is: rene.kolarik@freescale.com

Please entry this to the first input box: Rene Kolarik (https://community.freescale.com/thread/316863)

300 Views
sandrobastos
Contributor IV

Hi Rene,

I didn't receive any notification about the download yet...could you help me?

thanks

0 Kudos