cancel
Showing results for 
Search instead for 
Did you mean: 

Can't Get Blinky Project working With FreeRTOS

andrewralea
Visitor

I am new to FreeRTOS ( RTOS in general, although I am very familiar with baremetal) and am following along with this video:https://www.youtube.com/watch?v=CdpgqpuPSyQ&t=4s 

I am using a STM32F3DISCOVERY board so I had to make some minor tweaks to follow along, seemingly just pin numbering. I am using the default pin configurations and clock configuration. I am using TIM6 as Timebase source. I cannot seem to figure out why my LEDs are not blinking. I created a baremetal project to confirm the config of the pins is good and there I can get them toggling. I see the TIM6 CNT incrementing and wrapping so that is working. I tried to use breakpoints to see if I ever get back to my task and aside from the first hit during initialization, I never get back.

Not sure what I did wrong, but it appears my tasks only occur once and then terminate but I cannot figure out why. Any tips on how to debug this? Thank you

9 REPLIES 9
KnarfB
Principal III

I am using TIM6 as Timebase

in main.c, there is no reference to TIM6, but TIM4. 

hth

KnarfB

I used TIM6 originally like the demo but after some debugging effort I played around with trying others, meant to change it back to TIM6 before uploading that is my mistake. I do not believe it is the issue however

 I do not believe 

seeing is believing.

Set a breakpoint at the timer callback and check that it is called. The interrupt handler is in the *_it.c file. Check that everything is consistent.

hth

KnarfB

+

Did you set a break points in tasks infinite loops:

 

  for(;;)
  {
	HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_11); // on board green LED
	  HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_4); // external LED

    osDelay(500);
  }

 

and

 

  for(;;)
  {
	  HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_11); // on board green LED
	  HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5); // external LED

    osDelay(600);
  }

Also, do you reach the call of osKernelStart() when you set a break point to it?

 

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

I meant more that I don't think TIM4 vs TIM6 was the issue, just a discrepancy between file and description, very well may be a timer issue.

I do hit the callback in that *_.it.c file, but it stops after the LEDS on GPIOs 5 and 4 turn on which is done in the 2 tasks

I do reach osKernalStart(). I also put breakpoints in the 2 task loops and hit each breakpoint once at startup then never again


@andrewralea wrote:

I do reach osKernalStart(). I also put breakpoints in the 2 task loops and hit each breakpoint once at startup then never again


That's weird .. Unfortunately, I don't have F3 dico board at the moment. If you will not solve the issue by next Monday, I will try to find a board and run the test.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

Okay I will let you know if I figure anything out before then, thank you!

while debugging, you might want to use

  __HAL_DBGMCU_FREEZE_TIM6();
  __HAL_DBGMCU_FREEZE_IWDG();
or thelike to stop the peripherals whe  the debugger is stopped.
hth
KnarfB