AnsweredAssumed Answered

Blink program not working

Question asked by Laga.Freya on Sep 19, 2015
Latest reply on Oct 19, 2015 by Laga.Freya
Hi to all,
I am trying to write my first program for STM32F0 discovery board.
Of course the first step is to make a LED blink, but, till now, I failed.
I created the program using CubeMX and of course it worked. Then I tried to write it by myself and there is no way to make it work.

Hereafter there is my system clock init function:

------------------------------------------
void SystemInit()
{
    /* Clock init */
    if(!(RCC->CR & 0x02))    // Check if HSI is on
    {
        RCC->CR |= 0x01;    // if not, just enable it
        while((RCC->CR & 0x02) == 0);    // Wait for HSI being ready
    }
    if((RCC->CFGR & 0x0C)) RCC->CFGR &= 0xFFFFFFFC;    // if HSI is not SystemClock, set HSI as SystemClock
    RCC->CFGR &= 0xFFFEF80F;                    // Set prescler PPRE and HPRE to no division
    RCC->CR &= 0xFEF2FFFF;                        // Reset HSEON, CSSON, HSEBYP and PLLON bits
    RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;            // Reset PREDIV1[3:0] bits
    RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;            // Reset USARTSW[1:0], I2CSW, CECSW and ADCSW bits
    RCC->CR2 &= (uint32_t)0xFFFFFFFE;            // Reset HSI14 bit
    RCC->CIR = 0x00000000;                        // Disable all interrupts
}



Could it be right?
How can I debug my program?


Thank you
Freya

Attachments

Outcomes