/*---------------------------------------------------------------------------- * 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; }
Yes, I am using RTX(5). After reducing the GLobal dynamic Memory size in <RTX_Config.h> from 32768 to 16384 the LED is now blinking. You were absolutely correct in your answer.