cancel
Showing results for 
Search instead for 
Did you mean: 

How disable PULL UP on i2c

HDIA.1
Associate III

Hello,

I have a STM32WLE that works with the lora end_node project

I have a sensor that i power up with a mosfet when needed.

But during the time that the chip is sleeping i need to disable the internal I2C pullup (+30 uA more due to the fact that the VCC of the sensor don't control the internal pullup).

Can someone help me

Thanks

2 REPLIES 2

Write zeros to appropriate bitfields in GPIOx_PUPDR to switch off internal pullups.

JW

I tried it like this but error when reading i2c sensor :

void setPullUp(GPIO_TypeDef* GPIOx, uint32_t pin, uint32_t state) {
 
  MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (pin * 2)), (state << (pin * 2)));
 
}

-----------------------------------------------

	LmHandlerErrorStatus_t status = LORAMAC_HANDLER_ERROR;
	UTIL_TIMER_Time_t nextTxIn = 0;
	MX_SPI1_Init();
	MX_I2C2_Init();
	MX_ADC_Init();
	if(Test_SCT31()==1){
	    	APP_LOG(TS_ON, VLEVEL_L, "Error reading id SCT31 \r\n");
	    	Error_Handler();
	    }
	setPullUp(GPIOA,GPIO_PIN_11,0);
	setPullUp(GPIOA,GPIO_PIN_12,0);

Any idea ?

Thanks