cancel
Showing results for 
Search instead for 
Did you mean: 

PA11 and PA12 on STM32F3 discovery

hendalage
Associate II
Posted on October 11, 2013 at 20:44

hi,

below is the code i wrote just to change the states of pins PA10, PA11, PA12 and PA even though pin PA10 and pin PA15 gives the correct output to the functionsGPIO_SetBits() andGPIO_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.!
1 REPLY 1
Posted on October 11, 2013 at 21:46

I know it's easier to fumble around and ask here, but the

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00063382.pdf

would be worth at least a cursory review.

0690X00000605W1QAI.png
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..