Skip to main content
BELMA.1
Associate
February 16, 2023
Solved

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.

  • February 16, 2023
  • 2 replies
  • 1609 views
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?

This topic has been closed for replies.
Best answer by BELMA.1

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.

2 replies

ST Technical Moderator
February 20, 2023

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 "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
BELMA.1
BELMA.1AuthorBest answer
Associate
February 21, 2023

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.