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

SHT20 Temperature sensor not detected

Hello,

  I designed custom board using nRF52832 and SHT20 ambient temperature sensor. Temperature sensor not detected using example sdk TWI scanner.
SCL and SDA pins correctly assigned in code respective to my custom design.
VDD - 3.3V
GND-GND

SCL with 1k pullup to nRF GPIO
SDA with 1K pullup to nRF GPIO

please help me regarding. Thanks in advance.

Parents
  • 1k0 pullups are too harsh for default settings; increase power to low-level drive by selecting H0D1 in pin configuration after initialising TWI. There are multiple posts on this, maybe search for "H0D1 TWI"

    Example no-readings-twi-example

  • Dear hmolesworth,

    Thanks for your reply. I have checked that link. After including below code in main. I didn't get any response at debug terminal. Both device found/ not found is not coming on terminal. Please help regarding.

    #define PIN_VDD_ENV (22)
    #define PIN_R_PULLUP ( 0+32)

    nrf_gpio_pin_set(PIN_VDD_ENV);
    nrf_gpio_pin_set(PIN_R_PULLUP);
    // Power up and wait for voltage to rise
    nrf_gpio_cfg(PIN_VDD_ENV, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0H1, NRF_GPIO_PIN_NOSENSE);
    nrf_gpio_cfg(PIN_R_PULLUP, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0H1, NRF_GPIO_PIN_NOSENSE);
    nrf_delay_ms(4);

  • I don't know if you are using nrfx_twim.c or nrfx_twi.c in your project, but you can find the configuration of the TWI pins in both these files depending on which you use. I suggest to change from NRF_GPIO_PIN_S0D1 to NRF_GPIO_PIN_H0D1 in both these defines, e.g.:

    //nrfx_twim.c
    #define TWIM_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                             NRF_GPIO_PIN_DIR_INPUT,     \
                                             NRF_GPIO_PIN_INPUT_CONNECT, \
                                             NRF_GPIO_PIN_PULLUP,        \
                                             NRF_GPIO_PIN_H0D1,          \
                                             NRF_GPIO_PIN_NOSENSE)
    
    //nrfx_twi.c                                         
    #define TWI_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                            NRF_GPIO_PIN_DIR_INPUT,     \
                                            NRF_GPIO_PIN_INPUT_CONNECT, \
                                            NRF_GPIO_PIN_PULLUP,        \
                                            NRF_GPIO_PIN_H0D1,          \
                                            NRF_GPIO_PIN_NOSENSE)

    Also, consider reducing 1k0 to 4k7 pull-up resistors.

    If debug terminal is not working try to change in sdk_config.h:

    #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0

Reply
  • I don't know if you are using nrfx_twim.c or nrfx_twi.c in your project, but you can find the configuration of the TWI pins in both these files depending on which you use. I suggest to change from NRF_GPIO_PIN_S0D1 to NRF_GPIO_PIN_H0D1 in both these defines, e.g.:

    //nrfx_twim.c
    #define TWIM_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                             NRF_GPIO_PIN_DIR_INPUT,     \
                                             NRF_GPIO_PIN_INPUT_CONNECT, \
                                             NRF_GPIO_PIN_PULLUP,        \
                                             NRF_GPIO_PIN_H0D1,          \
                                             NRF_GPIO_PIN_NOSENSE)
    
    //nrfx_twi.c                                         
    #define TWI_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                            NRF_GPIO_PIN_DIR_INPUT,     \
                                            NRF_GPIO_PIN_INPUT_CONNECT, \
                                            NRF_GPIO_PIN_PULLUP,        \
                                            NRF_GPIO_PIN_H0D1,          \
                                            NRF_GPIO_PIN_NOSENSE)

    Also, consider reducing 1k0 to 4k7 pull-up resistors.

    If debug terminal is not working try to change in sdk_config.h:

    #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0

Children
Related