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
  • 2847 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

    waclawek.jan
    Super User
    October 21, 2015
    Posted on October 21, 2015 at 12:01

    Ah, so this is a DISCOVERY board? You might've said that right away...

    These pins are connected to the on-board resources - the user-USB-connector, the touch surface and the gyroscope.

    Those which go to the USB header and touch surface are not connected to the header unless the jumpers (solder bridges, SB20, SB23, SB27-SB32 - located on the bottom of PCB, as indicated in Fig.4 in UM1690) are closed (shorted with a drop of solder); you might want to remove the parallel capacitors C26-C28 and maybe also the series resistors R38-R40; and avoid using the user-USB header.

    I don't see a way to use those which go to the gyroscope other than to remove the chip or cut the traces.

    I don't have the board, just working out of the  UM1690.

    And you've said PC0 works just fine.

    JW

    adeemkazi92
    Associate III
    October 22, 2015
    Posted on October 22, 2015 at 12:16

    thank you very much for the enlightment.

    just one more thing, if i want to use maximum of the pins for drivi ng other things,

    is it better to use any of the boards except for the discovery series