Skip to content

[F1] Duty cycle / frequence measurement not working for AF pin #1036

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

Closed
treitmayr opened this issue Apr 18, 2020 · 3 comments · Fixed by #1039
Closed

[F1] Duty cycle / frequence measurement not working for AF pin #1036

treitmayr opened this issue Apr 18, 2020 · 3 comments · Fixed by #1039
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@treitmayr
Copy link

Description
When trying to run the Frequency_Dutycycle_measurement example on an STM32F103C8 (bluepill) with input pin B4, the code is not able to capture any rising/falling edges.

The important piece of information here is that B4 is not the default pin for this timer but an alternate function pin. While for default pins, capturing edges with the HardwareTimer was fixed for the F1 family with PR #824, the AF bits of the pin function must still be retained and configured for non-default pins to be usable.

I have a working version commited here (ready for a PR): treitmayr@4f134ae

Expected behavior
Rising and falling edges are detected and frequency and duty cycle are reported on serial port.

Desktop (please complete the following information):

  • OS: Linux
  • Arduino IDE version: 1.8.12
  • STM32 core version: latest git a8b0838

Board:

  • Name: STM32F103C8 (bluepill)
@treitmayr treitmayr changed the title [F1] Duty cycle / frequence measurement not working [F1] Duty cycle / frequence measurement not working for AF pin Apr 18, 2020
@fpistm fpistm assigned fpistm and ABOSTM and unassigned fpistm Apr 18, 2020
ABOSTM added a commit to ABOSTM/Arduino_Core_STM32 that referenced this issue Apr 20, 2020
@ABOSTM
Copy link
Contributor

ABOSTM commented Apr 20, 2020

Hi @treitmayr
Thanks for highlighting this issue.
I made a PR to solve it: #1039
It is a little bit different than your implementation proposal, so let me know if tit solves your issue.

@fpistm fpistm added the bug 🐛 Something isn't working label Apr 20, 2020
@fpistm fpistm added this to the 1.9.0 milestone Apr 20, 2020
@fpistm
Copy link
Member

fpistm commented Apr 21, 2020

@treitmayr any feedback on this?

@treitmayr
Copy link
Author

treitmayr commented Apr 21, 2020

Just tried the example with PR #1039 in the above setup, and I can confirm it fixes the issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants