We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm currently working on an STM32F4.
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN; GPIOB->MODER |= ((0x01 << 2*8) | (0x01 << 2*7) | (0x01 << 2*5)); GPIOB->OTYPER &= ~(GPIO_OTYPER_OT_8 | GPIO_OTYPER_OT_7 | GPIO_OTYPER_OT_5); GPIOB->PUPDR &= ~(GPIO_PUPDR_PUPDR8|GPIO_PUPDR_PUPDR7|GPIO_PUPDR_PUPDR5); GPIOB->OSPEEDR |= (GPIO_OSPEEDER_OSPEEDR8|GPIO_OSPEEDER_OSPEEDR7|GPIO_OSPEEDER_OSPEEDR5); while(1){ GPIOC->ODR = 0x000001A0; Delay(10000); GPIOC->ODR = 0x01A00000; Delay(1000); } }
This code above should (as far as I believe), set PB8, PB7 & PB5 high and low on a loop with a delay. However, when measuring the pins they just stay consistently high.
Any suggestions as to what might be going on or if anything is wrong with the code will be greatly appreciated.
Thanks.
Use BSRR not ODR, ODR is a 16-bit wide register