Forum: µC & Digital Electronics STM32F0 Discovery Port C Pin 1 and Pin 2 problem

Author: PeterP (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello Folks,

I tear my hair out over this. I have a STM32F0 Discovery board here and 
i would like to get all 16 bits of PORTC high. Most of the pins do what 
i expect them to do, but PC1 and PC2 dont. They stay low out of what 
ever reason. I am a bloody newbie in this , so please dear gurus, give 
me some code that will get pin1 and pin 2 in the high state. I am not 
sure what is wrong here.

In some data sheet of the board is found that these 2 pins are also used 
for external interrupts but i am not sure if that is the reason and how 
to disable that alternative function to get these 2 pins into a usable 

Any help would be deeply appreciated, I am chewing on this problem 
already since a week and ready to give up on it.

#include "stm32f0xx.h"
#include "stm32f0xx_rcc.h"
#include <stm32f0xx_conf.h>
#include "stm32f0xx_gpio.h"
#include "diag/Trace.h"
//#include <stdio.h>

int main()

  GPIO_InitTypeDef GPIO_InitDef;
        GPIO_InitDef.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5\
        | GPIO_Pin_6 | GPIO_Pin_7| GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 \
      | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15 ;
    GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
    GPIO_InitDef.GPIO_PuPd = 0x01;
    GPIO_InitDef.GPIO_Speed = GPIO_Speed_2MHz;
    //Initialize pins
    GPIO_Init(GPIOC, &GPIO_InitDef);

        GPIOC->ODR =0xFFFF;


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.