problem with nrf52832 gpio

Hi,I'm using nrf52832. I configured P0.20 as GPIO output,P0.22 as GPIO input.These two pins are connected wiht a 10Kohm resistor.I measured the voltage level on P0.22 is about 2V.

Why?The chip is broken?I have dozens of nrf52832 have the same problem.

  • Show us code. Note that you can pullup resistors on GPIO inputs that are only a bit larger than 10k per datasheet.

    That could explain your 2V resulting voltage on the pin.

    .

  • #define J11_IN 22
    #define J11_OUT 20
    int main(void)
    {
    bool erase_bonds;

    log_init();
    NRF_LOG_INFO("TX_TANZHUAN %s started %s %s.", APP_VERSION, __DATE__, __TIME__);

    timers_init();
    leds_init(&erase_bonds);
    gpiote_init();
    record_init();
    set_sensor_id(Readid());
    NRF_LOG_INFO("id:%s", get_sensor_id());
    nrf_gpio_cfg(
    J11_OUT,
    NRF_GPIO_PIN_DIR_OUTPUT,
    NRF_GPIO_PIN_INPUT_DISCONNECT,
    NRF_GPIO_PIN_PULLUP,
    NRF_GPIO_PIN_S0H1,
    NRF_GPIO_PIN_NOSENSE);

    nrf_gpio_cfg_output(J9_OUT);
    nrf_gpio_pin_set(J11_OUT);
    nrf_gpio_pin_set(J9_OUT);
    nrf_gpio_cfg_input(J9_IN,NRF_GPIO_PIN_NOPULL);
    // nrf_gpio_cfg_input(J10_IN,NRF_GPIO_PIN_NOPULL);
    nrf_gpio_cfg(
    J11_IN,
    NRF_GPIO_PIN_DIR_INPUT,
    NRF_GPIO_PIN_INPUT_CONNECT,
    NRF_GPIO_PIN_NOPULL,
    NRF_GPIO_PIN_S0S1,
    NRF_GPIO_PIN_NOSENSE);

    NRF_LOG_INFO("num8 %d",nrf_gpio_pin_read(J8_IN));
    NRF_LOG_INFO("num9 %d",nrf_gpio_pin_read(J9_IN));
    NRF_LOG_INFO("num10 %d",nrf_gpio_pin_read(J10_IN));
    NRF_LOG_INFO("num11 %d",nrf_gpio_pin_read(J11_IN));
    NRF_LOG_INFO("num6 %d",nrf_gpio_pin_read(J6_IN));
    while(1);

  • R52:10K;R41:1M;K5DET2 is GPIO input;K5DET1 is GPIO output.The two pins are connected with a 10Kohm resistor and a switch.There are 6 switches in my design.P0.20 and P0.22 are only mentioned as example.When the switch is open,the voltage level of output pin is 3.6V,the input pin is 0V.When the switch is closed,I expect the voltage level on the input pin would be 3.6V.But actually the voltage level varied,3.6V,2.6V,2V,0.4V,e.g.

Related