cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an API for accessing the timers (TIMx)?

vbuon.1
Associate III

hi,

i would like to know if there is an API for configuring, starting and stopping the timers (TIM1, TIM2, etc.) i'm interested in setting up a timer as a PWM device. i've come across documentation that talks about functions that can be used to set up a timer as a PWM device (e.g., pwm_apply_state, pwm_config, pwm_enable, etc.) but i can't find any documentation that describes these functions, the name of the library they are in or the header file to include. no can i find examples on how to use the API. i found examples on adding nodes to a device tree and how to use the sysfs interface. but, i would prefer to use a library if it exists.

thank you,

vincent j. buonassisi

1 ACCEPTED SOLUTION

Accepted Solutions
vbuon.1
Associate III

hi,

thank you for your response. the post was the most helpful. it seems that there is no library to access the timers. the easiest way w/o having to write my own driver was to use c/c++ file i/o calls. i can use either the higher level calls (e.g., fopen, fprintf, etc.) or the low level ones (.e.g, open, write, etc.)

thanks,

vince

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

Hi,

Please have a look to this wiki page which provide links to SW framework usable with TIMx

https://wiki.st.com/stm32mpu/wiki/TIM_internal_peripheral#Software_frameworks

in particular, I see this API https://wiki.st.com/stm32mpu/wiki/PWM_overview#Example_of_PWM_usage_with_kernel_PWM_API

See also this post: https://community.st.com/s/question/0D53W000014W92lSAC/pwm-kernel-driver-api

Regards,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
PatrickF
ST Employee

Hi,

Did the answer above helped you ?

Regards.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
vbuon.1
Associate III

hi,

thank you for your response. the post was the most helpful. it seems that there is no library to access the timers. the easiest way w/o having to write my own driver was to use c/c++ file i/o calls. i can use either the higher level calls (e.g., fopen, fprintf, etc.) or the low level ones (.e.g, open, write, etc.)

thanks,

vince