Why does the following code not blinking the built-in LED (A_5) on an F103RB board when using the CIM-RTOS2 API. The same code works when using the older CIM-RTOS API. There are no compilation errors: no errors no warning when compiling. The code does work

/*----------------------------------------------------------------------------
 * CMSIS-RTOS 'main' function template
 *---------------------------------------------------------------------------*/
 
#include "RTE_Components.h"
#include  CMSIS_device_header
#include "cmsis_os2.h"
 
void GPIOInit(void);
void LEDOn(void);
void LEDOff(void);
 
/*----------------------------------------------------------------------------
 * Application main thread
 *---------------------------------------------------------------------------*/
__NO_RETURN static void app_main (void *argument) {
  (void)argument;
  // ...
  for (;;) 
	{
		LEDOn() ;
		osDelay(500);
		LEDOff();
		osDelay(500);
	}
}
 
int main (void) {
  osKernelInitialize();                 // Initialize CMSIS-RTOS
  // System Initialization
  SystemCoreClockUpdate();
	GPIOInit();
  // ...
  osThreadNew(app_main, NULL, NULL);    // Create application main thread
  osKernelStart();                      // Start thread execution
  for (;;) { osDelay(20); }
}


void GPIOInit(void)
{
	//enable GPIOA
	RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
	//PA_5 - output, push pull (green Led)
	GPIOA->CRL |= GPIO_CRL_MODE5_0 | GPIO_CRL_MODE5_1;
	GPIOA->CRL &= ~GPIO_CRL_CNF;
}


void LEDOn(void)
{
	//turn on A_5
	GPIOA->BSRR |= GPIO_BSRR_BS5;
}
	
void LEDOff(void)
{
	//turn off A_5
	GPIOA->BSRR |= GPIO_BSRR_BR5; 
}

Parents Reply Children
No data
More questions in this forum