I'm not able to set up my input and read the condition using hall.
I want to pull in and hold high (internal pull up) 3 pins. Then simply read the condition.
This is how I set them up, left comments, did I do this right?
GPIOC->MODER &= ~(GPIO_MODER_MODER6_0);//in GPIOC->OSPEEDR &= ~GPIO_OSPEEDER_OSPEEDR6;//set max speed GPIOC->OTYPER &= ~GPIO_OTYPER_OT_6;//push pull mode //GPIOC->PUPDR &= ~GPIO_PUPDR_PUPDR6 ;//disable pull up down. GPIOC->BSRR &= ~(1<<6);GPIOC->BSRR |= (1<<22);//hold high
GPIOC->MODER &= ~(GPIO_MODER_MODER7_0);//in GPIOC->OSPEEDR &= ~GPIO_OSPEEDER_OSPEEDR7;//set max speed GPIOC->OTYPER &= ~GPIO_OTYPER_OT_7;//push pull mode //GPIOC->PUPDR &= ~GPIO_PUPDR_PUPDR7 ;//disable pull up down. GPIOC->BSRR &= ~(1<<7);GPIOC->BSRR |= (1<<23); //hold high
GPIOC->MODER &= ~(GPIO_MODER_MODER8_0);//in GPIOC->OSPEEDR &= ~GPIO_OSPEEDER_OSPEEDR8;//set max speed GPIOC->OTYPER &= ~GPIO_OTYPER_OT_8;//push pull mode //GPIOC->PUPDR &= ~GPIO_PUPDR_PUPDR8 ;//disable pull up down. GPIOC->BSRR &= ~(1<<8);GPIOC->BSRR |= (1<<24);//hold high
then I just watch GPIOC->IDR but it's always 0x0000ffff no matter the condition of the pin.
GPIOC->OSPEEDR &= ~GPIO_OSPEEDER_OSPEEDR6;//set max speed ACTUALLY SLOWEST, BUT AN INPUT, WHO CARES Make sure you've enable the GPIO clocks, and check the peripheral setting via the debugger's peripheral view. If all GPIO registers stuck at ZERO, clock probably not enabled.
Ok that was not done, I did add RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN;
I the GPIOC window I see the property of IDR with 0x0000ffff but can't find the peripheral view. Although with the above code assume it's set now.
Ok I take that back, that was my issue. Had a hardware issue join the party.