stm32 cubeMx FreeRTOS...

dtvonly wrote on Monday, May 28, 2018:

Hi. I am using the stm32VLdiscovery board. I followed the example on Youtube to blink and LED on the board through PC8 or PC9 using FreeRTOS. All configurations were done in stm32 cubeMX. I did not add any additional task but used the default startup task.

All compiled fine then code was download to flash. However, neither of the LED blinked. Below is the default task code…

void StartDefaultTask(void const * argument)
{

  /* USER CODE BEGIN 5 */
  /* Infinite loop */
  for(;;)
  {
	  HAL_GPIO_TogglePin (GPIOC ,GPIO_PIN_8 );  // GPIO_PIN_9 did not work also.
                                                                                                                                  // both were configured in cubeMX as
                                                                                                                                  // output.
	  osDelay(500);
  }
  /* USER CODE END 5 */ 
}

Please advise. Thank you.

rtel wrote on Monday, May 28, 2018:

The first thing to determine is if the task is ever being executed at
all. That can be done simply enough by setting a break point at the
start of the function and seeing if it ever gets hit.

Once you are sure the task is being hit then you need to ensure the GPIO
is setup and functioning as you think it is. That can be done by adding
a few lines to turn the LED on and off and on again before the for(;:wink:
loop in the task, and stepping over the functions in the debugger so you
can observe the LED.

If the task is executed, but the LED is not working, then it is not a
FreeRTOS issue as such, but a board configuration issue.

If the LED does turn on and off then the next thing to do is determine
if the osDelay(500) is executing as you expect. If that is not working
then it may be that the tick interrupt is not installed correctly. That
can be determined by placing a break point in the xTaskIncrementTick()
function, which is in FreeRTOS/Source/tasks.c and seeing if it is every hit.