Thanks to visit codestin.com
Credit goes to github.com

Skip to content

esp32/machine_timer: Restrict timer numbers for ESP32C6 to 0 and 1. #16439

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

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

robert-hh
Copy link
Contributor

Summary

The ESP32C6 has only one timer in each of the two groups, like the ESP32C3.
Add also a check for valid timer numbers.

Addresses the issue #16438 raised by @mattklapman.

Testing

Tested with an ESP32C6 generic board and a ESP32 Generic board.

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up, @robert-hh. If you don't have time to apply and test these suggestions then let me know, I think it'd be fine to merge this fix now and then move over to SOC macros later.

@mattklapman
Copy link

mattklapman commented Dec 18, 2024 via email

@robert-hh
Copy link
Contributor Author

That was already mentioned in my comment.

@robert-hh
Copy link
Contributor Author

Updated. Tested with ESP32, ESP32S3, ESP32C3, ESP32C6.

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @robert-hh!

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.57%. Comparing base (4e76acc) to head (49deb43).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #16439   +/-   ##
=======================================
  Coverage   98.57%   98.57%           
=======================================
  Files         164      164           
  Lines       21349    21349           
=======================================
  Hits        21045    21045           
  Misses        304      304           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Code size report:


@dpgeorge
Copy link
Member

@robert-hh you have a stray change to the lib/pico-sdk submodule here.

@robert-hh
Copy link
Contributor Author

robert-hh commented Dec 20, 2024

I hope it's fixed now. It's now at pico-sdk v2.1.0. These stray changes seem always complicated for me to fix.

The ESP32C6 has only one timer in each of the two groups.  Also add a check
for valid timer numbers.

Addresses issue micropython#16438.

Signed-off-by: robert-hh <[email protected]>
@dpgeorge dpgeorge merged commit 1360584 into micropython:master Dec 20, 2024
8 checks passed
@dpgeorge
Copy link
Member

Thanks for updating, it's all good now.

@robert-hh robert-hh deleted the esp32c6_timer branch December 20, 2024 19:48
@graeme44
Copy link

@robert-hh @projectgus, I'm not so sure about this. I'm testing this now and the ESP32C3 loses access to two timers.

The two ESP32-C3 timer groups, with two timers in each, provide the total of four individual timers for use.

@graeme44
Copy link

@robert-hh @projectgus, I'm not so sure about this. I'm testing this now and the ESP32C3 loses access to two timers.

The two ESP32-C3 timer groups, with two timers in each, provide the total of four individual timers for use.

I believe the issue is within esp-idf actually, opened an issue there.

@robert-hh
Copy link
Contributor Author

As far as I understand the manual, the ESP32C3 has two general purpose timers, one in each of the two timer groups. There is another timer in each timer group, but that is a watchdog timer.
Note that the code for machine_timer takes the number of timers from the ESP32 header files.

@projectgus
Copy link
Contributor

@robert-hh @projectgus, I'm not so sure about this. I'm testing this now and the ESP32C3 loses access to two timers.

The two ESP32-C3 timer groups, with two timers in each, provide the total of four individual timers for use.

I believe the issue is within esp-idf actually, opened an issue there.

I agree with @robert-hh, I think the bug might be in that line of ESP-IDF documentation and not the ESP-IDF code.

Here's the ESP32-C3 reference manual:
image

@projectgus
Copy link
Contributor

(That quoted line is also no longer present in the latest version of the ESP-IDF docs, the linked docs are for the v4.3 release which came out in 2021.)

@graeme44
Copy link

graeme44 commented Feb 26, 2025

Many thanks. My mistake, I was looking at old docs – confirmed by Espressif here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESP32C6 Timers: Only Timer(0) and Timer(2) are functional for ESP32-C6 v1.24
5 participants