01- First time with STM32F429 Discovery
Ok, you got your STM32F429 DIscovery board and you don’t know how to use it. In this tutorial I will explain how to use this board with CooCox IDE. I prefer install from their CoCenter. You will need to download ARM GCC from here. There is also youtube tutorial, make sure you did all correct.
So, you have finished installing CoIDE. Open it and click Project -> New project. Choose your project name and project path and click Next. In the next step choose Chip and Next.
CooCox does not support STM32F429 for now, but we can use STM32F407 version which works pretty good. So type “stm32f407vg” in filter, select it and click Finish.
You should have a window like this. Here you select all peripheral you will use in your project.
In every project you have to select under BOOT “CMSIS BOOT”. When you click on checkbox, CMSIS CORE is automatically checked. This 2 libraries you have to always use in project.
Our first project will just blinky led on board, so we need to select GPIO Library. This is General Purpose Input/Output to use with our physical pins on microcontroller.
On the bottom left you have project files. Open main.c and copy bottom program inside and press F7. Your project should be built without errors. When is built, click on 7th icon from the left on top, it says “Download code to flash“. Of course, you have to connect your board with USB cable.
Both onboard leds (red and green) should now toggle in period.
Program (I will not describe how it works for now, other tutorials will explain this):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
/** * Blinky project * * @author Tilen Majerle * @email tilen@majerle.eu * @version v1.0 * @gcc v4.7 20013qr3 * @ide CooCox CoIDE v1.7.6 */ #include "stm32f4xx.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_gpio.h" int main(void) { RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); GPIO_InitTypeDef GPIO_InitDef; GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; GPIO_InitDef.GPIO_OType = GPIO_OType_PP; GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz; //Initialize pins GPIO_Init(GPIOG, &GPIO_InitDef); volatile int i; while (1) { // Toggle leds GPIO_ToggleBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14); // Waste some tome for (i = 0; i < 500000; i++); } } |
Download Project: CooCox project
I hope this help to you for your first time.
Recent comments