Closed melucas closed 6 years ago
Hello Michael!
No I never tried my library with a DUE R3...
From what I'm seeing (and I'm out of my place and can't make experiments right now...) it seems that the base issue is that UNIX_OFFSET is not defined in the context and all the rest can just be a chain of errors triggered by that.
IIRC UNIX_OFFSET is defined in time.h (#include <time.h>
which is part of the AVC standard libraries, out of my library...) and it might be that for your particular architecture/IDE version that include is missing.
Can you please check and let me know which IDE version are you using? The minimum version required is 1.6.10
Cheers!
Hi Sergio,
I'm using the Windows version of the IDE. It is 1.8.5. I have also tried building from Visual Studio 2017 with the vMicro extension. Much nicer to use.
I found this Post. The post suggested downloading Time.zip
That did not help. It replaced
Thanks, Michael
The "good" time.h is the one you should have in C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\time.h
and the "T" in there is definitely a lowercase "t", although I'm unsure that is making a difference in a case-insensitive OS/file-system, like Windows.
My feeling is that you might have other (incompatible) libraries installed that prevent the correct include file to be loaded: I'm not seeing a message about time.h being missing, so I'm quite confident a wrong one is loaded instead because UNIX_OFFSET is definitely defined in the good one...
Hi Sergio,
Searched and found only one time.h file and it was right where you said it should be. Same compile errors. I'm missing some sort of config setting or something telling the complier where time.h lives.
Any other suggestions?
Thanks, Michael
Found the forum. Last post. Might be an anti-virus problem. I will try disabling that tomorrow and try a build.
Michael, I'm afraid the problem is deeper: I just realized that Arduino DUE is based on the ARM32 architecture, not the Atmel AVR architecture, and that explains why the AVR time.h library is not loaded.
You might try using Michael Margolis/Paul Stoffregen's TimeLib, a.k.a. Time library and see if it compiles for ARM32.
For handling the RTC chip you might still try using my library and the SetTimeUX() and GetTimeUX() methods but you should add a #define UNIX_OFFSET 946684800
in your sketch: If this will work I will release a fix for defining that constant when the AVR library is unavailable.
Please keep me informed: I don't have a DUE so I cannot make tests myself...
P.S.: I can't guarantee my examples will ever work with the DUE or any other non AVR architecture: non-AVR standard C time libraries (time.h) might be incomplete (we had such an issue before for the ESP8266 whose time.h is lacking several functions) and there might be differences in the time epoch (AVR use 2000-01-01T00:00:00Z
while other more Unix-compliant libraries generally use 1970-01-01T00:00:00Z
) and hence the need for using the SetTimeUX() and GetTimeUX() methods.
Sadly, no, that did not solve the problem.
I made the following changes to the Alarms & Temperature Example after adding the TimeLib library to my IDE.
// We NEED the standard C time library...
//#include
Getting new compile issues. Looks like a difference in how the original Time and new updated Time work. ComplieErrors2.txt
I don't think you should load both time.h
and TimeLib.h
when using PaulStoffregen's library...
In the meanwhile I'm trying to make my example compile for the DUE (I cannot run it as I don't have the hardware) by making some mods and introducing a new include (timeStub.h
) defining the missing entities.
I've published an experimental branch for that, here: https://github.com/smz/Arduino-RTCtime/tree/ArduinoDUE and you can try starting from that...
With it I'm still getting compile time errors which essentially are of two kinds:
set_zone()
and isotime()
standard C time functions which apparently are missing in PaulStoffregen's implementation. Those are limitation of that library which does not implement the full Std. C time standard and there is nothing I can do about that: you must work your way around those limitations or find a more complete library working for the DUE. I'm not aware of any...In my library I also load Arduino.h
: pardon my ignorance, but is it correct to load it when using the DUE board?
Have you seen that in PaulStoffregen's library there is an example specific for the DUE board (https://github.com/PaulStoffregen/Time/tree/master/examples/TimeArduinoDue)?
I tried you new branch, and got the attached compile
ComplieErrors3.txt errors.
Yes, I tried the TimeArduinoDue example, but it also has complied errors. It complains about #include
I'm pretty new to the Arduino boards. My back ground is VB and C#.
So far, it looks like the Wire library is loading. I have over versions of the RTC libraries working. The problem is none of them have the combined Clock, Temperature and SD card methods built into them.
Thanks, Michael
Ok, fixed my compile issues TimeArduinoDue example. Pulled the latest version of the library and recopied it to my libraries folder.
From the errors you're now getting it seems that the new include file I created (timeStub.h) is not loaded, while it should as I've added this to RtcDS3231.h:
#include <Arduino.h>
#ifdef __AVR__
#include <time.h>
#else
#include <timeStub.h>
#endif
When compiling for the DUE __AVR__
it is not defined and thus timeStub.h
is loaded, where, amongst other things, UNIX_OFFEST is defined...
I'm puzzled...
Did you check in and push the (timeStub.h) file? I don't see it in the source I just pulled.
Yes!
Do you have any sketch with I2C compiling/working for the DUE?
Duh! Helps if you switch to the right branch after cloning!
New compile errors attached. ComplieErrors4.txt
Yes, working sketch attached. Used a hacked version of the library attached.
Yeap, switching branch sometimes help! :smiley:
It is really late here in Europe and I'm about going to sleep so you will not hear from me till tomorrow...
What I'm fixing myself now is the I2C errror:
C:\Users\mlucas\Documents\Arduino\libraries\RTCtime\examples\DS3231_Alarms_and_Temperature\DS3231_Alarms_and_Temperature.ino: At global scope:
DS3231_Alarms_and_Temperature:100: error: 'RtcDS3231<TwoWire> Rtc' redeclared as different kind of symbol
RtcDS3231<myWire> Rtc(I2C);
but I'm seeing other stuff which I think must be fixed... I have to check the compatibility of the tm
structure normally used in Std. C library with the one used by PaulStoffregen...
Thanks for tha skatches: they will probably help... tomorrow!
Cheers!
BTW, have you tried Makuna's RTC library here: https://github.com/Makuna/Rtc
That is the one I used as a starting point for my library: it is not Std. C compliant but it might work as well for you and Makuna is for sure a much better C++ programmer than I am...
Hello Michael, I'm afraid I have bad news for you...
After a more thorough analysis of PaulStoffregen's library I realized it is absolutely not compatible with my library both in terms of different data types and available functions, some of which I actually use inside my library (not only in the examples...).
My library needs a supporting Std. C time library and Paul's one is not. If you want more information about what a Std. C time library must support you can have a look at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf chapter 7.23 (starting at page 338).
So for the time being I'm afraid I will only support the AVR architecture as it is the only one for which a complete and compatible time.h library is available.
I've also found the https://github.com/feilipu/Arduino_RTC_Library library, which apparently is the one the official AVR one is based on, and I tried compiling it for the DUE but without success.
I will update my readme.md clarifying what is supported what not.
Cheers!
Sergio
Thanks for giving it a shot!
Giving this one a try: https://github.com/Makuna/Rtc/wiki
Thank-you Michael and yes that's the library I was advising!
.. and please let me know if the Makuna library is good for the DUE, just in case someone else asks...
Has anyone tried to get this library working with a DUE R3?
I've tried adding from the Library Manager and manually from a Repo Clone.
I'm getting a bunch of compile errors when trying to build the DS3231_Alarms_and_Temperature.ino example.
Attached is the build output with the errors.
Thanks, Michael ComplieErrors.txt