Skip to main content
added 1342 characters in body
Source Link
sylvaing
  • 41
  • 3
  • 10

EDIT :thank you for your answers, by modifying HAL_TIM_OC_Start(&htim3, TIM_CHANNEL_2); by HAL_TIM_OC_Start_IT(&htim3, TIM_CHANNEL_2); and by activating the interrupts HAL_NVIC_EnableIRQ(TIM3_IRQn); my program enters the HAL_TIM_OC_DelayElapsedCallback function.

On the other hand, by wanting to create the RQHandler function,

void TIM3_IRQHandler(void){ HAL_TIM_IRQHandler(&htim3); } 

I get a first defined here error, I don't know if this function is useful for the rest of my problem:

Now that my program enters the callback function of the output compare, it doesn't seem to compare, I explain myself:

I thought the lines:

if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) 

were going to check if the output compare of channel 2 or 4 is enabled, and if so, do what's in my condition. But, that's not what happens.

My program always enters the conditions.

I did a test to verify this:

I changed the value of my comparative output from channel 4 to 1500. The period of my timer is 1000, so this compare output should never be triggered. But it still triggers, my program enters the condition : if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) when it should not.

I don't know why, I still feel like I'm forgetting something lol

EDIT :thank you for your answers, by modifying HAL_TIM_OC_Start(&htim3, TIM_CHANNEL_2); by HAL_TIM_OC_Start_IT(&htim3, TIM_CHANNEL_2); and by activating the interrupts HAL_NVIC_EnableIRQ(TIM3_IRQn); my program enters the HAL_TIM_OC_DelayElapsedCallback function.

On the other hand, by wanting to create the RQHandler function,

void TIM3_IRQHandler(void){ HAL_TIM_IRQHandler(&htim3); } 

I get a first defined here error, I don't know if this function is useful for the rest of my problem:

Now that my program enters the callback function of the output compare, it doesn't seem to compare, I explain myself:

I thought the lines:

if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) 

were going to check if the output compare of channel 2 or 4 is enabled, and if so, do what's in my condition. But, that's not what happens.

My program always enters the conditions.

I did a test to verify this:

I changed the value of my comparative output from channel 4 to 1500. The period of my timer is 1000, so this compare output should never be triggered. But it still triggers, my program enters the condition : if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) when it should not.

I don't know why, I still feel like I'm forgetting something lol

Output compares triggering a function ?not work on STM32?

When I put a breakpoint on this function, I noticed that my program never entered it, even though I have 2 outputoutputs compare that are triggered every second.

So I have my timer3 with channelchannels 2 and 4 in output compare, in toggle on match mode. My timer has a period of 1000 and my channel 2 has a pulse at 250 and channel 750.

My idea was that with the output compare callback function, when aan output compare is triggered, it turns on the LEDs, so there is no need to connect the timer channels directly to the PINS of the 2 LEDs.

!!! Note that my program doesn't initialize the LEDs, for the moment I just want to see in debug mode if my program enters the function when a compare output is triggered, and already that, it doesn't work...

Output compares triggering a function ? STM32

When I put a breakpoint on this function, I noticed that my program never entered it, even though I have 2 output compare that are triggered every second.

So I have my timer3 with channel 2 and 4 in output compare, in toggle on match mode. My timer has a period of 1000 and my channel 2 has a pulse at 250 and channel 750.

My idea was that with the output compare callback function, when a output compare is triggered, it turns on the LEDs, so there is no need to connect the timer channels directly to the PINS of the 2 LEDs.

!!! Note that my program doesn't initialize the LEDs, for the moment I just want to see in debug mode if my program enters the function when a compare output is triggered and already that, it doesn't work...

Output compares triggering function not work on STM32?

When I put a breakpoint on this function, I noticed that my program never entered it, even though I have 2 outputs compare that are triggered every second.

So I have my timer3 with channels 2 and 4 in output compare, in toggle on match mode. My timer has a period of 1000 and my channel 2 has a pulse at 250 and channel 750.

My idea was that with the output compare callback function when an output compare is triggered, it turns on the LEDs, so there is no need to connect the timer channels directly to the PINS of the 2 LEDs.

!!! Note that my program doesn't initialize the LEDs, for the moment I just want to see in debug mode if my program enters the function when a compare output is triggered, and already that, it doesn't work...

added 207 characters in body
Source Link
sylvaing
  • 41
  • 3
  • 10

!!! Note that my program doesn't initialize the LEDs, for the moment I just want to see in debug mode if my program enters the function when a compare output is triggered and already that, it doesn't work...

!!! Note that my program doesn't initialize the LEDs, for the moment I just want to see in debug mode if my program enters the function when a compare output is triggered and already that, it doesn't work...

added 533 characters in body
Source Link
sylvaing
  • 41
  • 3
  • 10
Loading
full code
Source Link
sylvaing
  • 41
  • 3
  • 10
Loading
Source Link
sylvaing
  • 41
  • 3
  • 10
Loading