Skip to main content
Franksterb92
Senior
April 5, 2023
Solved

stm32f446re gpio as active LOW reset pin

  • April 5, 2023
  • 2 replies
  • 1628 views

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

This topic has been closed for replies.
Best answer by Bob S

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.

2 replies

Bob S
Bob SBest answer
Super User
April 6, 2023

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
April 6, 2023

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