cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f446re gpio as active LOW reset pin

Franksterb92
Senior

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);
}

1 ACCEPTED SOLUTION

Accepted Solutions
Bob S
Principal

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.

View solution in original post

2 REPLIES 2
Bob S
Principal

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.

Franksterb92
Senior

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);
}