2023-04-05 12:34 PM
im using pc8 as a reset pin and ive check it with a logic analyzer and wen its initalized it drops low then goes back to high before im calling my function to drop it low btw im using saleae logic 2
void reset_pin_init(void){
//PC8
RCC->AHB1ENR |= (1U<<2);
GPIOC->MODER &= ~(1U<<17);
GPIOC->MODER |= (1U<<16);
GPIOC->OSPEEDR |= (1U<<17);
GPIOC->OSPEEDR |= (1U<<16);
GPIOC->PUPDR &= ~(1U<<17);
GPIOC->PUPDR |= (1U<<16);
GPIOC->ODR |= (1U<<8);
}
void si47xx_reset(void){
reset_pin_init();
GPIOC->ODR &= ~(1U<<8);
systickDelayMs(50);
GPIOC->ODR |= (1U<<8);
}
Solved! Go to Solution.
2023-04-06 09:14 AM
You code changes the mode out output while the IDR still contains its power-on default value of zero, thus driving the pin low. Set the ODR before you change modes.
2023-04-06 09:14 AM
You code changes the mode out output while the IDR still contains its power-on default value of zero, thus driving the pin low. Set the ODR before you change modes.
2023-04-06 12:01 PM
thanks i changed the code to this
void reset_pin_init(void){
//PC8
RCC->AHB1ENR |= (1U<<2);
GPIOC->ODR |= (1U<<8);
GPIOC->MODER &= ~(1U<<17);
GPIOC->MODER |= (1U<<16);
GPIOC->OSPEEDR |= (1U<<17);
GPIOC->OSPEEDR |= (1U<<16);
GPIOC->PUPDR &= ~(1U<<17);
GPIOC->PUPDR |= (1U<<16);
}
void si47xx_reset(void){
reset_pin_init();
GPIOC->ODR &= ~(1U<<8);
systickDelayMs(50);
GPIOC->ODR |= (1U<<8);
}