This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Powering sensor through GPIO

Hello all, 

In order to optimize my power design, I want to power my sensors though GPIO pin on nrf52832 and toggle the pin when I need to use them.

I have two sensors on one twim bus. I configured a GPIO in the following way:

		gpio_init();
	
		nrf_drv_gpiote_out_config_t config = NRFX_GPIOTE_CONFIG_OUT_SIMPLE(0);
		err = nrf_drv_gpiote_out_init(10, &config);
		APP_ERROR_CHECK(err);


A timer is fired every 10 seconds and in the handler I want to set the pin, to read from thr first sensor an clear the pin:

        nrf_gpio_pin_set(10);
	
		*temp = hts221_read_temperature();
		*hum = hts221_read_humidity();
	
	//	while(!m_xfer_done);
	
		nrf_gpio_pin_clear(10);

The case is that when I measure voltage on pin 10, the pin is never cleared. When I disconnect the sensors, the pin is cleared immediately. When I connect the sensors to any other pin, for example pin 9, this pin is set high automatically, even it is not configured. 

What is the proper way to control a GPIO?

Parents
  • Hi

    Are you aware that pins 9 and 10 are the nRF52s NFC pins, and that you have to specifically configure them as GPIOs if you are using them as such. Configuring them as GPIOs is done like this if you are using Keil, and as shown in this picture if you are using SES: 

    If you have already done this, please specify whether you are using SPI or I2C in your project, and I will look into it.

    Best regards,

    Simon

    EDIT: You could also just use any of the regular GPIO pins instead of configuring your NFC pins as GPIOs.

Reply
  • Hi

    Are you aware that pins 9 and 10 are the nRF52s NFC pins, and that you have to specifically configure them as GPIOs if you are using them as such. Configuring them as GPIOs is done like this if you are using Keil, and as shown in this picture if you are using SES: 

    If you have already done this, please specify whether you are using SPI or I2C in your project, and I will look into it.

    Best regards,

    Simon

    EDIT: You could also just use any of the regular GPIO pins instead of configuring your NFC pins as GPIOs.

Children
Related