cancel
Showing results for 
Search instead for 
Did you mean: 

Hi! I am having isues regarding hal function for setting the pwm duty cycle. I am using stm32f401cd. __HAL_TIM_SET_COMPARE is not setting the value.

BELMA.1
Associate
a

I don't have a scope but i can measure from multimeter, if it is there. I am guessing there is a bug or I am doing something wrong. I think software focuses on Pulse value and does not recognize __HAL_TIM_SET_COMPARE command. I uploaded the code. Anyone have an idea?

1 ACCEPTED SOLUTION

Accepted Solutions
BELMA.1
Associate

Hello!

Thank you for answering. I think when i was configuring adc I opted for dma and in priority tab section of dma I chose medium priority, that's why it interfered with timers( timers start to malfunctioning) - this what i think happened. Probably this is on my part. I don't know about interrupt routines and about NVIC very well. I am still learning. I remade the project in CubeIDE this time I didn't touch priority setting left everything as default. This time it did work.

View solution in original post

2 REPLIES 2
FBL
ST Employee

Hello @Bektöre ELMALI​ ,

What do you mean "software focuses on Pulse value and does not recognize __HAL_TIM_SET_COMPARE command." Have you tried an example of Cube Firmware?

I suggest taking a look at this example.

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.

BELMA.1
Associate

Hello!

Thank you for answering. I think when i was configuring adc I opted for dma and in priority tab section of dma I chose medium priority, that's why it interfered with timers( timers start to malfunctioning) - this what i think happened. Probably this is on my part. I don't know about interrupt routines and about NVIC very well. I am still learning. I remade the project in CubeIDE this time I didn't touch priority setting left everything as default. This time it did work.