Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Seeking clarification on pulse_cnt capabilities. #11633

romeo987 started this conversation in Question - Community Help
Discussion options

I am seeking to upgrade an old project from pcnt to pulse_cnt. I am not a professional developer (hence my existence in the Arduino universe). I have read the Expressif write-ups, and a lot else besides; I am particularly trying to get my head around counter overflow. This term only gets mentioned in the section "Compensate Overflow Loss", and all it says is:

1.Enable [pcnt_unit_config_t::accum_count] when installing the PCNT unit.

2.Add the high/low limit as the [Watch Points].

3.Now, the returned count value from the [pcnt_unit_get_count()]function not only reflects the hardware's count value, but also accumulates the high/low overflow loss to it.

So would one normally set the High/Low limits at INT16_MAX and INT16_MIN? Some examples I have seen appear to set these limits at, (one example) +/-32760.

And what does "accumulates the high/low overflow" mean? My reading of esp-idf/issues/10167 (again, noting I am not a professional developer, so much of that is over my head) suggests that, by simply enabling accum_count when installing gives me a complete 32 bit counter with interrupt overhead (in the absence of other watchpoints) only at High/Low limit events, and regardless of what these limits are, I will still have a complete 32 bit counter (well 64000 times the count limits, I guess). My reading also suggests that all the associated get_count calls, and indeed all the now "hidden" interrupts and other magic are sufficiently atomic to the extent that 4 counters can all be independently flying along under FreeRTOS without any application-level ISRs, etc.

If my reading is correct, that is pure magic.
But is my understanding correct? I suspect not, because there is so little that I can find on Google about this.
But if I am correct, has that magic (noting issue 10167) been rolled yet into the current Arduino release?

You must be logged in to vote

Replies: 0 comments

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

AltStyle によって変換されたページ (->オリジナル) /