AnsweredAssumed Answered

GPIO ODR Register

Question asked by Sean Mutlu on Jul 9, 2017
Latest reply on Jul 10, 2017 by Clive One

Hello, 

Was doing some tests with the ODR register for GPIO and noticed that when I load it with 0xFFFF some pins (13-15 for GPIOA &GPIOC) were still off. I have them initialized so I am unsure why they won't come on. Wondering why this happens and how to overcome this. Also might there be an easier/faster/less trivial way to initialize all pins to the same for GPIOA/B/C?

 

Source Code:

#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"

GPIO_InitTypeDef GPIO_InitStructure;


int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);

GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
GPIO_Init(GPIOA,&GPIO_InitStructure);
while(1)
{

GPIOA->ODR = 0xFFFF;
}
}

Outcomes