AnsweredAssumed Answered

PA11 and PA12 on STM32F3 discovery

Question asked by MaRiSiPāLa on Oct 11, 2013
Latest reply on Oct 11, 2013 by Clive One
hi,
below is the code i wrote just to change the states of pins PA10, PA11, PA12 and PA15.
even though pin PA10 and pin PA15 gives the correct output to the functions GPIO_SetBits() and GPIO_ResetBits(); PA11 pin and PA12 pin doesn't seem to change its state at all. those two pins always stays at logic low (i read around 0.10 Volts rather than perfectly 0 Volts on both pins). can anyone explain me why??

void GPIO_Init_Motor(void)
{  
    // Setup PWM outputs
    GPIO_InitTypeDef GPIO_InitStructure;
     
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
     
    GPIO_DeInit(GPIOA);
     
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
 
    GPIO_PinAFConfig(GPIOA, GPIO_PinSource8, GPIO_AF_6); // TIM1_CH1 -> Motor1
    GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_6); // TIM1_CH2 -> Motor2
     
    // Setup direction IOs
     
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_15;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
}
 
 
int main(void)
{  
    GPIO_Init_Motor();
     
    GPIO_SetBits(GPIOA, GPIO_Pin_10);
    GPIO_SetBits(GPIOA, GPIO_Pin_11);
    GPIO_SetBits(GPIOA, GPIO_Pin_12);
    GPIO_SetBits(GPIOA, GPIO_Pin_15);
    while(1){}
}


Thanks in advance.!

Outcomes