Skip to main content
Visitor II
August 5, 2021
Solved

How can I start rtos programming for stm32f217xx controller.

  • August 5, 2021
  • 1 reply
  • 857 views

Hi ,

I want configure the UART and GPIO peripherals using RTOS(RTx) .

here I am using keil5 u version .And STM32F217xx controller (custom board )

Already I was done configuration for gpio.

/*----------------------------------------------------------------------------
 
 * CMSIS-RTOS 'main' function template
 
 *---------------------------------------------------------------------------*/
 
 
 
#include "RTE_Components.h"
#include CMSIS_device_header
#include "cmsis_os2.h"
 
 
 
 void gpio_Initfun(void);
 
/*
 * led initialization.
 *
 */
 
 
 
 void gpio_Initfun(void)
 
 {
	 GPIOF->MODER |=0x00000005; 
	 GPIOF->OTYPER |=0x00000000;
	 GPIOF->OSPEEDR |=0x00000005;
	 GPIOF->PUPDR |=0x00000005;
	 GPIOF->ODR |=0x000000000;
 
 }
/*----------------------------------------------------------------------------
 
 * Application functions thread
 
 *---------------------------------------------------------------------------*/
 
__NO_RETURN static void ledTwo (void *argument) {
 
 (void)argument;
 while(1)
 
	{
		osDelay(500);
		GPIOF->ODR &= ~(unsigned int)(0x0000001); 
		osDelay(500);
		GPIOF->ODR |= 0x0000001;
	}
}
 
__NO_RETURN static void ledOne (void *argument) {
 (void)argument;
 while(1)
	{
		osDelay(500);
		GPIOF->ODR &= ~(unsigned int)(0x0000002);
		osDelay(500);
		GPIOF->ODR |= 0x0000002;
	}
 
}
 
 
 
 
 
int main (void) {
 
 SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN); 
 SystemCoreClockUpdate(); 
 osKernelInitialize(); 
 gpio_Initfun();
 
 osThreadNew(ledTwo, NULL, NULL);
 osThreadNew(ledOne, NULL, NULL);
 
 osKernelStart(); 
 
 while(1);
 
}

the above code is working.

Instead of using the SFR programming I want to use predefined librariesf or programming the my controller.

Please some one guide me how to use STM32 predefined libraries in RTOS programming.

thanks in advance.

    This topic has been closed for replies.
    Best answer by Bouraoui Chemli

    Hi,

    You can refer to provided FreeRTOS examples within STM32CubeF2 firmware via this path: STM32Cube_FW_F2_V1.8.0\Projects\STM322xG_EVAL\Applications\FreeRTOS

    Bouraoui

    1 reply

    ST Employee
    August 6, 2021

    Hi,

    You can refer to provided FreeRTOS examples within STM32CubeF2 firmware via this path: STM32Cube_FW_F2_V1.8.0\Projects\STM322xG_EVAL\Applications\FreeRTOS

    Bouraoui