Question
Facing problem in GPIO configuration
Posted on June 08, 2016 at 19:27
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); #!stm32 #gpio #nucleo