stm32f429 gpioh

Gast #3731268
Lesenswert?

Ich dachte das Problem mit der blinkenden Leds im Griff zu haben.

nun funktioniert das Schalten bestimmter Portpins nicht. Was mache ich 
falsch?
A0,G13,G14: ok
H0,H1, F6: nichts
1
void init_gpio2rcc(void){
2
    RCC_AHB1PeriphClockCmd(
3
        RCC_AHB1Periph_GPIOA |
4
        RCC_AHB1Periph_GPIOB |
5
        RCC_AHB1Periph_GPIOC |
6
        RCC_AHB1Periph_GPIOD |
7
            RCC_AHB1Periph_GPIOE |
8
            RCC_AHB1Periph_GPIOF |
9
            RCC_AHB1Periph_GPIOG |
10
            RCC_AHB1Periph_GPIOH, ENABLE);
11
}
12

13
void init_led(void) {
14
  GPIO_InitTypeDef GPIO_InitStructure;
15
u32 port='G';
16
  // Clock Enable
17
   // Config PG13 als Digital-Ausgang
18
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
19
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
20
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
21
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
22
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
23
GPIO_Init(GPIO(G), &GPIO_InitStructure);
24

25
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
26
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
27
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
28
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
29
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
30
GPIO_Init(GPIO(H), &GPIO_InitStructure);
31

32
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
33
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
34
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
35
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
36
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
37
GPIO_Init(GPIO(F), &GPIO_InitStructure);
38

39
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
40
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
41
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
42
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
43
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
44
GPIO_Init(GPIO(A), &GPIO_InitStructure);
45

46

47
  u32 i;
48
    for (i=0;i<20;i++){
49
        GPIO(G)->ODR|=(1<<14);
50
    GPIO(G)->ODR&=~(1<<13);
51
    GPIO(H)->ODR|=(1<<0);
52
     GPIO(A)->ODR|=(1<<0);
53
         GPIO(H)->ODR|=(1<<1);
54
          GPIO(F)->ODR|=(1<<6);
55
      wait;
56
    GPIO(G)->ODR|=(1<<13);
57
    GPIO(G)->ODR&=~(1<<14);
58
    GPIO(H)->ODR&=~(1<<0);
59
     GPIO(A)->ODR&=~(1<<0);
60
          GPIO(H)->ODR&=~(1<<1);
61
          GPIO(F)->ODR&=~(1<<6);
62
      wait;
63
    }
64

65
}
#3731436
Lesenswert?

Kaj schrieb:
> Detlef Kunz schrieb:
>> F6 ist zum quarzen. ;)
> Immer diese Raucher :P

Nö, nix da.
Aber es hat nunmal so schön gepasst. :)

Ansonsten kann ich zum eigentlichen Thema nur sagen, das ich dem 
vorgefertigten Zeug nicht traue, und meine eigenen Routinen benutze.
H0 und H1 sind, wenn HSE gesetzt ist, im OszillatorModus und somit nicht 
verfügbar.
F6 ist allerdings merkwürdig. Ich wüde mir zuerst die Register mal mit 
dem Debugger anschauen.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren