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

Pwm input mode in timers #131

Open
talalahsan01 opened this issue Aug 8, 2020 · 4 comments
Open

Pwm input mode in timers #131

talalahsan01 opened this issue Aug 8, 2020 · 4 comments

Comments

@talalahsan01
Copy link

Hey! I am working on something where i needed the timer pwm input mode and i didn't find anything in the hal to implement this as in this crate there is a way to implementation pwm but pwm input is not available. I want to get the duty cycle and frequency of a pwm signal being input to the board and i also it needs to be 4 channels per timer. I am a newbie to rust and embedded programming so i am not very sure how this could be done using the pac crates but can anyone help regarding this?

@talalahsan01 talalahsan01 changed the title Pwm input mode in timera Pwm input mode in timers Aug 8, 2020
@strom-und-spiele
Copy link
Collaborator

Hey,

It helps a lot if you describe your setup in more detail (esp. what chip you are using), what your requirements are in detail and things you have tried so far.

If you want to implement something using the PAC, check the reference manual of your chip for detailed information.
E.g. for the F3Discovery, which is equipped with a STM32F303VC, this RM Has a detailed description of what to do in section 20.3.8.

Of course generalization of your code to improve the current HAL are always welcome, even if it's just for your particular chip.

@talalahsan01
Copy link
Author

Hey,

It helps a lot if you describe your setup in more detail (esp. what chip you are using), what your requirements are in detail and things you have tried so far.

If you want to implement something using the PAC, check the reference manual of your chip for detailed information.
E.g. for the F3Discovery, which is equipped with a STM32F303VC, this RM Has a detailed description of what to do in section 20.3.8.

Of course generalization of your code to improve the current HAL are always welcome, even if it's just for your particular chip.

Basically i am trying to use fs-ia6 receiver with my f3 board, the receiver outputs pwm signal ranging from 1000 to 2000 i need to receive this signal using tim2 of my board using 4 channels for example on receiver i have 6 channels i want to wire them up to pins pa0, pa1, pa2 and pa3 and i want to do use a function like "get_duty()" to calculate the duty cycle of incoming pwm signal from each pin. I hope that explains my setup

@David-OConnor
Copy link
Contributor

David-OConnor commented Sep 15, 2020

#141 includes the ability to set the CaptureCompare to input mode. Is still missing some features you might need though, but could be patched in easily. Have you figured out what register calls you need to make?

@talalahsan01
Copy link
Author

#141 includes the ability to set the CaptureCompare to input mode. Is still missing some features you might need though, but could be patched in easily. Have you figured out what register calls you need to make?

Yup I have and i have made it work perfectly, but i still have issues in activating four channels at the same time, because the interrupt is global and I don't know how to set it up for each channel, nonetheless i still believe it would be a good idea to add it in the hal crate

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

3 participants