AnsweredAssumed Answered

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

Question asked by kazi.adeem on Oct 20, 2015
Latest reply on Oct 22, 2015 by kazi.adeem
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




#include "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);

}
}

Outcomes