AnsweredAssumed Answered

Facing problem in GPIO configuration

Question asked by hobb.epy on Jun 8, 2016
Latest reply on Jun 9, 2016 by Clive One
Hi,
I m configuring GPIO port for OUTPUT. but, i m not able to configure it propely.
Following is my implmentation which is not working.


     GPIOC->CRL |= 0x00000001<<20;          // GPIOC-5th
     GPIOC->CRL |= 0x00000001<<24;          // GPIOC-6th
     GPIOC->CRH |= 0x00000001;               // GPIOC-8th
     GPIOC->CRH |= 0x00000001<<4;          // GPIOC-9th


     GPIOC->BSRR = 0x00000020;
     GPIOC->BSRR = 0x00000000;
     GPIOC->BSRR = 0x00000100;
     GPIOC->BSRR = 0x00000000;
     
     I checked voltage, bit it is not comping. but if i used following configuration then it is working.
     
       GPIO_InitTypeDef GPIO_InitStruct;


       GPIO_InitStruct.Pin = GPIO_PIN_5;
       GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
       GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
       HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);


       GPIO_InitStruct.Pin = GPIO_PIN_6;
       GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
       GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
       HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);


       GPIO_InitStruct.Pin = GPIO_PIN_8;
       GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
       GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
       HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);


       GPIO_InitStruct.Pin = GPIO_PIN_9;
       GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
       GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
       HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

Outcomes