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

Timer takes longer to expire on ESP32 #3887

Closed
zephyrbot opened this issue Aug 1, 2017 · 6 comments
Closed

Timer takes longer to expire on ESP32 #3887

zephyrbot opened this issue Aug 1, 2017 · 6 comments
Assignees
Labels
area: Xtensa Xtensa Architecture bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 1, 2017

Reported by Leandro Pereira:

As noted by [~anasnashif], it seems that timers are taking longer to expire than expected. A k_sleep(1000) is taking longer than 1s, as can be evidenced by executing samples such as synchronization or drivers/gpio.

(Imported from Jira ZEP-2456)

@zephyrbot
Copy link
Collaborator Author

by Andy Ross:

Just got far enough along to see this for real. Yeah, a simple loop doing k_sleep(1000) followed by a printk shows that the system timer is operating at 1/4 speed, to within the precision of my finger on a stopwatch app.

A quick check of xternsa_sys_timer.c shows that it didn't get modified for the esp32 port. My guess is that it's hard-configured for the clock configuration of some other board. Shouldn't be hard to fix, though I need to read through the datasheet a bit.

@zephyrbot
Copy link
Collaborator Author

by Andy Ross:

It was actually the CPU clock that was wrong, not the driver. Marketing material for ESP-32 says "160 MHz", but it turns out that it boots at 40 MHz instead. Happily the cycle counter used by the timer has a really simple interface (very similar to the TSC on x86) and it was really easy to validate the hypothesis.

Long term, we're going to want a CPU frequency driver for this board given the 4x difference between default and maximum.

@zephyrbot
Copy link
Collaborator Author

by Ruud Derwig:

(sorry, wrong button)

@zephyrbot
Copy link
Collaborator Author

by Mark Linkmeyer:

Leandro Pereira , please verify this bug is fixed.

@zephyrbot
Copy link
Collaborator Author

by Leandro Pereira:

Works for me.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Sep 7, 2017

Related to GH-3930

@zephyrbot zephyrbot added priority: high High impact/importance bug area: Xtensa Xtensa Architecture bug The issue is a bug, or the PR is fixing a bug labels Sep 23, 2017
@zephyrbot zephyrbot added this to the v1.9.0 milestone Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Xtensa Xtensa Architecture bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants