Skip to main content
Associate III
June 17, 2024
Solved

Access PWM Registers in P-NUCLEO-IHM03 - Kit

How to read/write PWM Register in P-NUCLEO-IHM03 - Kit ? It is associated with TIM1 having 4 channels.

 

My motor is running for few seconds and then stop (which by default according to the documentation should be running continuously), that's why I am trying to figure out if PWM Registers are storing current values.

 

In debug mode, SFRs section, I found TIM1, but it has several components, which one corresponds to storing current value?
Please suggest.
Thanks in Advance!

    This topic has been closed for replies.
    Sarra.SBest answer
    ST Employee
    June 18, 2024

    Hello @tejas_amp 

    All the timer registers are described in the dedicated reference manual of your board, in this case, NUCLEO-G431RB

    Otherwise, you should check the following registers: 

    TIMx_CNT: This register holds the current value of the timer counter. It's not directly related to the PWM duty cycle but can give you an idea of the timer's operation at a given moment

    TIMx_CCRx: registers (CCR1, CCR2, CCR3, CCR4 for channels 1 to 4) hold the values used for comparing against the counter to generate the PWM signal

    TIMx_SR : you  can check this to see if there are any interrupt flags set that might indicate an issue, such as an update event or a trigger event

    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.

    2 replies

    Sarra.SBest answer
    ST Employee
    June 18, 2024

    Hello @tejas_amp 

    All the timer registers are described in the dedicated reference manual of your board, in this case, NUCLEO-G431RB

    Otherwise, you should check the following registers: 

    TIMx_CNT: This register holds the current value of the timer counter. It's not directly related to the PWM duty cycle but can give you an idea of the timer's operation at a given moment

    TIMx_CCRx: registers (CCR1, CCR2, CCR3, CCR4 for channels 1 to 4) hold the values used for comparing against the counter to generate the PWM signal

    TIMx_SR : you  can check this to see if there are any interrupt flags set that might indicate an issue, such as an update event or a trigger event

    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.
    tejas_ampAuthor
    Associate III
    June 19, 2024

    Thanks !