Open ernestum opened 2 years ago
The issue seems to be, that the code was written for the Teensy 4.0/4.1. When I remove all references to the snvs interrupt, I get it to compile with the following folder structure:
lib
├── cycle6s4
│ ├── cycle64s.cpp
│ └── cycles64.h
├── README
└── teensy_clock
├── teensy_clock.cpp
└── teensy_clock.h
However, the time does not seem to advance after the initial sync to the RTC. For this to work we need to enable the cycle counter in the cycle64.cpp by adding
ARM_DEMCR |= ARM_DEMCR_TRCENA;
ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
to the begin()
.
Yes, this was done for the T4. For the T3.1 you need to enable the cycle counter as you have already found. Please also note, that if you disable the RTC interrupt you need to make sure that you call cycles64::get() at least once per overflow time of the cycle counter. For a T3.2 at 96MHz that would be at least every 2^32/96MHz = 44.7s. Placing a dummy cycles64::get() in loop() should be good enough.
Edit: Fixed the wrong cppx extension in the repo
Thanks for the fix. When I include the teensy_clock code in my code in this way. Where would you want me to place the license file? One copy in each subfolder?
Actually I don't care. Would be nice if you could place a link to the repo somewhere but event that is not necessary from my point of view.
Hi, thanks for this nice helper library! I wanted to use teensy_clock in my PlatformIO project with a Teensy 3.1. Unfortunately it was unclear how to properly incorporate the library in my source code. What I tried so far:
teensy_clock
folder in thelib
subfolder of my projectteensy_clock
folder in thesrc
subfolder of my projectteensy_clock
files directly into thesrc
subfolder of my project.cppx
file renamed tocpp
I always get an error at link time:
(it is a different error when I rename the
.cppx
file)Do you have any hints for me?