This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GPIO not outputting correctly

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.

0