Do you suggest CooCox for Stm32f4 discovery kit?

7.4k views Asked by At

I'm new with ARM processors, i recently bought STM32F4 Discovery Kit. Do you suggest me to begin proggraming with CooCoz or another IDE? Sorry for English, Good work.

1

There are 1 answers

0
Insomnious On BEST ANSWER

Yes, it is easy to use.

Download ST-LINK utility, CoIDE and gcc-arm-embedded toolchain.

Install it and configure CooCox. In "Project -> Select Toolchain Path" select directory with toolchain, by default "C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin"

Create new project, select stm32f407vg chip, then from repository select M4 CMSIS Core, CMSIS BOOT, RCC, GPIO. All needed files will be added to project tree.

Add code to main.c file

//basic headers
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"

// delay function
void Soft_Delay(volatile uint32_t number)
{
        while(number--);
}

int main(void)
{
    //Peripherial clock setup
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);


    //Port setup
    GPIO_InitTypeDef  ledinit;  

    ledinit.GPIO_Mode = GPIO_Mode_OUT;  
    ledinit.GPIO_OType = GPIO_OType_PP;  
    ledinit.GPIO_PuPd = GPIO_PuPd_NOPULL; 
    ledinit.GPIO_Speed = GPIO_Speed_2MHz;  
    ledinit.GPIO_Pin = GPIO_Pin_15; //

    GPIO_Init(GPIOD, &ledinit); 


    while(1)
    {
        // Led On
        GPIO_SetBits(GPIOD, GPIO_Pin_15);


        // Pause
        Soft_Delay(0x000FFFFF);

        // Led Off
        GPIO_ResetBits(GPIOD, GPIO_Pin_15);

        // PAuse
        Soft_Delay(0x000FFFFF);
    }
}

Select "Project -> Rebuild" and "Flash -> Program Download", blue led will start blink.