cancel
Showing results for 
Search instead for 
Did you mean: 

Access PWM Registers in P-NUCLEO-IHM03 - Kit

tejas_amp
Senior

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

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.

View solution in original post

2 REPLIES 2
Sarra.S
ST Employee

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.

Thanks !