Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing with 20Mhz? #29

Closed
mitchsf opened this issue Jul 18, 2016 · 4 comments
Closed

Timing with 20Mhz? #29

mitchsf opened this issue Jul 18, 2016 · 4 comments

Comments

@mitchsf
Copy link

mitchsf commented Jul 18, 2016

Thanks for this core! It's working great, but I'm having a problem with the 20Mhz timing using a 1284P. I switched from Skinny Bob/Bobuino by Christensen, to this, for the 20Mhz option. Testing against a DS3231 that is itself tested against a GPS each minute, the internal clock appears to be off by about one second, each two minutes. The same program works perfectly at 16Mhz using Skinny Bob/Bobuino, with no corrections necessary for the day or two I've kept track. I'm using the Time.h library, which uses millis(), as a reference.

Any suggestions as to how to narrow this to the root cause, are appreciated. Thanks again.

@MCUdude
Copy link
Owner

MCUdude commented Jul 18, 2016

I'll have a look at it when I get home. Meanwhile, please try with the 16 MHz option and see if this drifts to. I guess the problem is the millis() function. Have you also tried swaping it with another 20 MHz crystal?

@mitchsf
Copy link
Author

mitchsf commented Jul 18, 2016

Thanks, Hans. Tonight I'll try it with a 16mhz crystal. Several clocks
built with the identical configuration have the same issue, so it's not the
crystal. I agree that it appears to be related to the millis() function.

I'll let you know later after I swap a 16mhz crystal and change the
firmware.

Regards,
Mitch

On Monday, July 18, 2016, Hans notifications@github.com wrote:

I'll have a look at it when I get home. Meanwhile, please try with the 16
MHz option and see if this drifts to. I guess the problem is the millis()
function. Have you also tried swaping it with another 20 MHz crystal?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJ9Qx6yX2zkr25yW-1b2JpTDF3um7IRHks5qW2jtgaJpZM4JOncW
.

Sent from my iPhone 6s

@mitchsf
Copy link
Author

mitchsf commented Jul 25, 2016

Still waiting to test. We're moving, so it will be another few days. Thanks.

@mitchsf
Copy link
Author

mitchsf commented Jul 31, 2016

Sorry. I don't think this is an issue with the core.

@mitchsf mitchsf closed this as completed Jul 31, 2016
MCUdude added a commit that referenced this issue Feb 19, 2021
…8b9a

a367b8b9a Merge pull request #32 from cburstedde/feature-exact-timing
e7f9313ce Merge branch 'master' into feature-exact-timing
c24da8fcb Updated accuracy calculation
7efce6186 Replace bit_is_set with "regular" and operation
5fba4671d Minimal accuracy tweaks
0f33b77ce Merge pull request #31 from cburstedde/feature-exact-timing
d10b60393 Update README
299220515 Exact or very accurate millis/micros/delay always
065732108 Non-functional tweaks
0dd91a679 Update README
25fad398a Add exact timing for 9.216 MHz
19b8514f5 Merge branch 'master' into feature-exact-timing
5d4ba89e8 Correct millis and micros for arbitrary frequencies
8913fb360 Add missing parentheses
b622f9856 Add exact timing for 10 MHz
0333bcea5 Update README
5af5045c8 Add accurate timing for 16.5 MHz
e318ce1ca Add exact timing for 6 MHz
0c0b4f3a8 Remove superfluous cast
aeaadea0f Merge pull request #29 from cburstedde/feature-delayMicroseconds
4e74473d7 Merge pull request #28 from cburstedde/feature-correct-micros
6916530f2 Fix several corner cases in delayMicroseconds()
038385eea It makes a difference using unsigned math!!
912145b81 Go back to long multiply but still optimize
909105605 Use faster unsigned int multiply in micros()
eeb6635e7 Merge pull request #27 from cburstedde/feature-exact-timing
21d1d6fa7 README typo
9be3a3e42 Disable alternate micros algorithm for powers of 2
bcd8baa5a Move timer0_exact static variable def into ISR
745508971 Rename correction #define and variable
9fef70e27 Reduce unnecessary long comparison to char
95166c10e Correct bad idea: access fract with interrupts off
f64aa5d03 Remove unneeded unsigned char in micros()
a91536407 White space in wiring.c
f683310fa Make micros zero-drift based on exact millis
b28acdb84 Make 25 MHz a supported clock frequency
2a6c810ce Comments and README edits
7cde04dd0 Merge pull request #26 from cburstedde/feature-delayMicroseconds
0172627e2 Merge branch 'master' into feature-delayMicroseconds
3b1142ffd Merge pull request #25 from cburstedde/feature-correct-micros
e858df7d8 Merge branch 'master' into feature-correct-micros
b32ca2bc5 Merge pull request #24 from cburstedde/feature-correct-millis
0205fd55b delayMicroseconds() safe for us == 0 and >= 24 MHz
032bed72f Statement on delayMicroseconds() in README
afa0f8f69 Use 60398UL unsigned long constant
9b7291ae3 Add 22.1184 and 18 MHz cases to delayMicroseconds
ec16def12 Add/edit comments for delayMicroseconds()
4a89b74ed Replace abs macro ... with a "safe" version of the original abs macro. Unlike __builtin_abs() this also deals with floats, which is pretty much required to ensure compatibility against the official Arduino core(s).
57b7486af Tune ppm values in README
059d20b18 Optimize away two increments from timing ISR
3d890c22d Improve micros() to 100 ppm for 7.37, 3.68, 1.84
d852091be Tiny README update
39112b389 Simplify millis calculation to fit into long int
d1719372c Improve micros() accuracy for 14.7456, 12, 11.0952
84c8f335d micros() below crystal tolerance for 18.432, 20 MHz
b8002ce05 Update README for new/improved micros()
239425178 Make micros calculation more efficient for 20 MHz
d736735fd Add 18 MHz clock to micros()
21cf2177e Improve accuracy of 24 MHz micros()
3b9aa8990 Add 18 MHz clock to millis() calculation
65aa77f4d Fix timing error for non-power-of-two clocks
0091354f8 Add discussion of micros and delay to README
af3b94c79 Non-functional clarification
2568a3f85 Add millis() discussion to README
56512e963 Add millis () correction to make 22.1184 MHz exact
2d42b729d Add 22.1184 MHz micros () correction
46fa6940c Prevent micros for 32 MHz to enter wrong case
49f5f250a Increase micros () accuracy for 18.432 and 20 MHz
b51058fe1 Supply millis () correction for 24 MHz
993843d4d Add two odd frequencies 7.37 and 3.69 MHz
25c1c988b Correction makes millis() exact for several speeds

git-subtree-dir: avr/cores/MCUdude_corefiles
git-subtree-split: a367b8b9ab17653a379108e48d7696bf1c6ca336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants