Skip to main content
adeemkazi92
Associate III
October 20, 2015
Question

im getting only 0.5v on some gpio pins instead of 3v.

  • October 20, 2015
  • 12 replies
  • 2804 views
Posted on October 20, 2015 at 11:29

gpioc pin 0 and gpio a pin 0 &1 work fine

but gpio c pin 1 and furhter show 0.5v at output instead of 3 volts.

here is the code i implemented

&sharpinclude ''main.h''

static __IO uint32_t TimingDelay;

//------------------------------------------------------------------------------

// Function Name : Init _GPIO pins

// Description : pins ,port clock & mode initialization.

//------------------------------------------------------------------------------

void Init_GPIO(void)

{

/* GPIO config */

    GPIO_InitTypeDef GPIO_InitDef;

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

 

    GPIO_InitDef.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;

    GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;

    GPIO_InitDef.GPIO_OType = GPIO_OType_PP;

    GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;

    GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;

    //Initialize pins

    GPIO_Init(GPIOC, &GPIO_InitDef);

 

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

 

    GPIO_InitDef.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;

    GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;

    GPIO_InitDef.GPIO_OType = GPIO_OType_PP;

    GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;

    GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;

    //Initialize pins

    GPIO_Init(GPIOA, &GPIO_InitDef);

 

    //volatile int i;}

    }

void Delay(__IO uint32_t nTime)

{

  TimingDelay = nTime;

  while(TimingDelay != 0);

}

/**

  * @brief  Decrements the TimingDelay variable.

  * @param  None

  * @retval None

  */

void TimingDelay_Decrement(void)

{

  if (TimingDelay != 0x00)

  {

    TimingDelay--;

  }

}

/*******************************************************************************

* Function Name : main

* Description : Main program.

*******************************************************************************/

int main(void)

{

Init_GPIO(); //calling a function

while(1)//infinite loop

{

/*ODR bits can be individually set and reset */

//for displaying 0

GPIO_SetBits(GPIOC, GPIO_Pin_0);

GPIO_SetBits(GPIOA, GPIO_Pin_0);

GPIO_SetBits(GPIOC, GPIO_Pin_2);

GPIO_SetBits(GPIOA, GPIO_Pin_1);

}

}

#no-crystal-ball
    This topic has been closed for replies.

    12 replies

    Amel NASRI
    Technical Moderator
    October 20, 2015
    Posted on October 20, 2015 at 13:10

    Hi kazi.adeem,

    I suggest you check the hardware connections to the pins where you see 0.5V instead of 3 V (may be there is an external connection to the ground).

    Then, in your main, I don't see the code to set GPIO_Pin_1 for port C.

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 07:14

    there is no external connection to ground.

    and i tried enabling the gpio pins one by one many of them dont set to high

    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 08:26

    and these are the pins connected to sb27 to sb 32 these are the jumpers i guess

    waclawek.jan
    Super User
    October 21, 2015
    Posted on October 21, 2015 at 09:42

    What hardware are you talking about?

    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 09:44

    stm32f072b

    waclawek.jan
    Super User
    October 21, 2015
    Posted on October 21, 2015 at 09:55

    I can see no ''sb27 to sb 32'' in the STM32F072 datasheet.

    So what hardware are you talking about?

    JW
    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 09:59

    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 10:01

    here look at the attachment.the pin config is there

    ________________

    Attachments :

    Untitled.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0nB&d=%2Fa%2F0X0000000bin%2FKrUVbPrPQt3mDdpO5eDBzWEHcX5XPqTuILxjuYPKssc&asPdf=false
    waclawek.jan
    Super User
    October 21, 2015
    Posted on October 21, 2015 at 10:12

    This still does not tell us what hardware are you talking about, nor what is connected to the pins you showed.

    Also, you complained about PC1, there is no PC1 shown on that picture.

    JW
    adeemkazi92
    Associate III
    October 21, 2015
    Posted on October 21, 2015 at 11:05

    Ive attched the whole pin config file now

    pins that arent working are

    PA2,3,6,7,11,

    PB0,1

    PC0,2

    ________________

    Attachments :

    STM32F072xx_Pin_Config.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I17y&d=%2Fa%2F0X0000000bio%2Fcv6Urb4oS7YgxEmvuvsEEPvMJSDtmOsZ8fXEjSRqhio&asPdf=false