The RTC driver topic

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Post the code and show me where it is too complex, we will find a solution.

I imagine that if you have a conversion function xyz(native, final) you can have multiple implementations:

Code: Select all

#if defined(STM32F1)
xyz(native, final) {
}
#elif defined(STM32F2_4)
xyz(native, final) {
}
#elif
....


It does not look complex just the code is into another module.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

It is not too complex. It just lays in slightly unexpected place. Any way, rev. 4020 contains finished ideas.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Barthess, when you have a little time could you review the ticket 3567597?

https://sourceforge.net/tracker/?func=d ... tid=995489

thanks,
Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

I have reviewed the ticket. Problem confirmed. I have merged fix to trunk and test it on STM32-103STK board.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Thanks.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Hi,

Barthess, there is another one, this time regarding RTCv2, could you examine it? ticket 3568626.

https://sourceforge.net/tracker/?func=d ... tid=995489

thanks,
Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

Accepted. I am working on it.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

Giovanni,
After investigating of bug i have found following:
1) this is serous bug able to cause unexpected issues and crushes.
2) localtime() returns pointer to statically allocated buffer with calculated result. In other
words, the function is not thread safe. I have changed it to localtime_r() analog.
Fixed in rev. 4694
UPDATE Tested on my custom board with F4x. I am not able to test it in F1x, could
any body test it on F1x?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: The RTC driver topic

Post by Giovanni »

Thanks,

I am worried about portability, localtime_r() is specific of newlib and we support other compilers. Probably we should study a solution with FAT time directly supported in the driver without any external dependency.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: The RTC driver topic

Post by barthess »

Create timestamp on device with hardware calendar is not a big problem, but for other devices we must create time conversion function. This does not look trivial for me. Probably some one has his own realization.
Post Reply