Hallo Zusammen,
ich hab ein kleines Problem. Ich hab Eclipse mit ARM GCC und der STM
Standart Lib installiert. Als Plattform hab ich von der Uni momentan ein
Nucleo STM32 F411RE.
Es geht um folgendes, ich will einfach nur eine LED am Port A Pin 5
Blinken lassen. Mit folgendem Code funktioniert es auch:
1 | #include <stm32f4xx_gpio.h>
|
2 | #include <stm32f4xx_tim.h>
|
3 | #include <stm32f4xx_rcc.h>
|
4 | #include <misc.h>
|
5 |
|
6 |
|
7 | int main()
|
8 | {
|
9 |
|
10 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
|
11 |
|
12 | GPIO_InitTypeDef gpioStructure;
|
13 | gpioStructure.GPIO_Pin = GPIO_Pin_5;
|
14 | gpioStructure.GPIO_Mode = GPIO_Mode_OUT;
|
15 | gpioStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
16 | GPIO_Init(GPIOA, &gpioStructure);
|
17 |
|
18 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_RESET);
|
19 |
|
20 |
|
21 | for (;;) {
|
22 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_RESET);
|
23 | for (int i = 0; i < 5000000; i++); // Warte damit man es Blinken sieht
|
24 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_SET);
|
25 | for (int i = 0; i < 5000000; i++);
|
26 |
|
27 | }
|
28 |
|
29 | }
|
Wenn ich jetzt aber meine Initialisierung in eine Funktion pappe, wie
folgt:
1 | #include <stm32f4xx_gpio.h>
|
2 | #include <stm32f4xx_tim.h>
|
3 | #include <stm32f4xx_rcc.h>
|
4 | #include <misc.h>
|
5 |
|
6 | void InitIOs()
|
7 | {
|
8 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
|
9 |
|
10 | GPIO_InitTypeDef gpioStructure;
|
11 | gpioStructure.GPIO_Pin = GPIO_Pin_5;
|
12 | gpioStructure.GPIO_Mode = GPIO_Mode_OUT;
|
13 | gpioStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
14 | GPIO_Init(GPIOA, &gpioStructure);
|
15 |
|
16 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_RESET);
|
17 |
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 | int main()
|
23 | {
|
24 | InitIOs();
|
25 |
|
26 | for (;;) {
|
27 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_RESET);
|
28 | for (int i = 0; i < 5000000; i++); // Warte damit man es Blinken sieht
|
29 | GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_SET);
|
30 | for (int i = 0; i < 5000000; i++);
|
31 |
|
32 | }
|
33 |
|
34 | }
|
Funktioniert das ganze nicht mehr. Die Sache dabei ist, das es vorher
mal alles funktioniert hat. Seitdem ich von Win7 auf Win10 umgestiegen
bin, hab ich nur noch Probleme in dieser hinsicht. Eclipse etc wurde
wieder "frisch" installiert.
Hat jemand eine Idee? Ich bin da leider mit meinem Latein am Ende..