We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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 in simulator mode; I can see the virtual pin A_5 blinking on and off. Any ideas? Here is the code:
/*---------------------------------------------------------------------------- * 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; }
Duplicate:
https://community.arm.com/developer/ip-products/processors/f/cortex-m-forum/49309/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-com