Skip to main content
Sean Mutlu
Associate II
July 9, 2017
Question

GPIO ODR Register

  • July 9, 2017
  • 4 replies
  • 5623 views
Posted on July 09, 2017 at 20:32

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:

&sharpinclude 'stm32f10x_gpio.h'

&sharpinclude '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;

}

}

#odr #gpio
This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
July 9, 2017
Posted on July 09, 2017 at 23:25

What do they connect to externally? PA13 and PA14 would nominally be used by the debug interface.

PC13,14 and 15 are typically in the low power domain, so don't have high current drive capabilities.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Sean Mutlu
Associate II
July 10, 2017
Posted on July 10, 2017 at 01:07

Just an LED which i was using to probe all outputs, I may have misunderstood this register, i thought it loaded all 16 bits to output of respective port.

Sean Mutlu
Associate II
July 10, 2017
Posted on July 10, 2017 at 01:08

By that i meant I am under the impression that:

GPIOA->ODR = 0xFFFF;

should make every port (0-15) in GPIOA high