AnsweredAssumed Answered

What is the difference control between ODR and BSRRL(BSRRH)

Question asked by Carter Lee on Sep 7, 2017
Latest reply on Sep 8, 2017 by Zhitai Liu

Hi 

I'm currently working with STM32F429I-disco kit.

and testing about gpio control.

 

the below code is working well.

But I want to know 


int main(void)
{
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);

// GPIOG->CRL = 0x2800;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOG, &GPIO_InitStructure);

#using ODR

while (1)
{
if(GPIOA->IDR & GPIO_Pin_0)
 GPIOG->ODR =GPIO_Pin_14;
else
 GPIOG->ODR = 0x00;
}

}

 

#using BSRR

while (1)
{
if(GPIOA->IDR & GPIO_Pin_0)
GPIOG->BSRRL = GPIO_Pin_14;
else
GPIOG->BSRRH = 0xFFFF;

}

 

My question is what is the difference between ODR  and BSRR?

Outcomes