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

nrf9160 gpio low is not voltage 0, help

const struct device* gpio_dev = device_get_binding("GPIO_0");
err = gpio_config(gpio_dev,
tx_pin,
NRF_GPIO_PIN_S0S1);

for(i=0 ;; i++)
{
printk("nrf_gpio_pin_write");

if( i%2 == 0 )
nrf_gpio_pin_write(tx_pin, 0);
else
nrf_gpio_pin_write(tx_pin, 1);

k_usleep(100000);
}

the low voltage is 1.2v

/// nRF9160_PS_v2.0.pdf p. 101

nrfjprog -f NRF91 --memrd 0x50842504 --w 16 --n 64
0x50842504: 0002 1400 0002 1400 0002 1400 0043 D400 |............C...|
0x50842514: 8002 1400 8002 1400 8002 1400 0000 0000 |................|
0x50842524: 0000 0000 0000 0000 0000 0000 0000 0000 |................|
0x50842534: 0000 0000 0000 0000 0000 0000 0000 0000 |................|

///

how to change to 0v

Parents
  • /////////////I got answer

    static void Test_GPIOTE()
    {
    int i;
    int err;

    nrfx_gpiote_in_config_t in_config =
    {
    .sense = NRF_GPIOTE_POLARITY_LOTOHI,
    .pull = NRF_GPIO_PIN_PULLUP,
    .is_watcher = false,
    .hi_accuracy = true,
    .skip_gpio_setup = false
    };

    IRQ_DIRECT_CONNECT(GPIOTE0_IRQn, 0, nrfx_gpiote_irq_handler, 0);
    irq_enable(GPIOTE0_IRQn);

    err = nrfx_gpiote_init(0);
    if (err != NRFX_SUCCESS)
    {
    printf("nrfx_gpiote_init error: %08x", err);
    return;
    }

    err = nrfx_gpiote_in_init(rx_pin, &in_config, rx_event_handler);
    if (err != NRFX_SUCCESS)
    {
    printf("nrfx_gpiote_in_init error: %08x", err);
    return;
    }

    nrfx_gpiote_in_event_enable(rx_pin, true);

    ////////////////////////////////can not before nrfx_gpiote_init and nrfx_gpiote_out_init(tx_pin, &out_config); ////////////////////////////////
    ////////////////beause nrfx_gpiote_init call -> nrf_gpio_cfg_output of ~/ncs/modules/hal/nordic/nrfx/hal/nrf_gpio.h
    //add this
    nrf_gpio_cfg(tx_pin,
    NRF_GPIO_PIN_DIR_OUTPUT,
    NRF_GPIO_PIN_INPUT_DISCONNECT,
    NRF_GPIO_PIN_NOPULL,
    NRF_GPIO_PIN_H0H1,       //use this, low will be 0.4v
    NRF_GPIO_PIN_NOSENSE);

    ///////////////////////////////////////////////////

    for(i=0 ;; i++)
    {
    printk("nrf_gpio_pin_write");

    if( i%2 == 0 )
    nrf_gpio_pin_write(tx_pin, 0);
    else
    nrf_gpio_pin_write(tx_pin, 1);

    k_usleep(10000);
    }
    }

    //////////////////////////////////////////////////////////////////////////////another problm
    now high is 1.8v and low is 0.45v

    Could set low to 0.0v

    Can software to do this?

    or need hardware to solve?

Reply
  • /////////////I got answer

    static void Test_GPIOTE()
    {
    int i;
    int err;

    nrfx_gpiote_in_config_t in_config =
    {
    .sense = NRF_GPIOTE_POLARITY_LOTOHI,
    .pull = NRF_GPIO_PIN_PULLUP,
    .is_watcher = false,
    .hi_accuracy = true,
    .skip_gpio_setup = false
    };

    IRQ_DIRECT_CONNECT(GPIOTE0_IRQn, 0, nrfx_gpiote_irq_handler, 0);
    irq_enable(GPIOTE0_IRQn);

    err = nrfx_gpiote_init(0);
    if (err != NRFX_SUCCESS)
    {
    printf("nrfx_gpiote_init error: %08x", err);
    return;
    }

    err = nrfx_gpiote_in_init(rx_pin, &in_config, rx_event_handler);
    if (err != NRFX_SUCCESS)
    {
    printf("nrfx_gpiote_in_init error: %08x", err);
    return;
    }

    nrfx_gpiote_in_event_enable(rx_pin, true);

    ////////////////////////////////can not before nrfx_gpiote_init and nrfx_gpiote_out_init(tx_pin, &out_config); ////////////////////////////////
    ////////////////beause nrfx_gpiote_init call -> nrf_gpio_cfg_output of ~/ncs/modules/hal/nordic/nrfx/hal/nrf_gpio.h
    //add this
    nrf_gpio_cfg(tx_pin,
    NRF_GPIO_PIN_DIR_OUTPUT,
    NRF_GPIO_PIN_INPUT_DISCONNECT,
    NRF_GPIO_PIN_NOPULL,
    NRF_GPIO_PIN_H0H1,       //use this, low will be 0.4v
    NRF_GPIO_PIN_NOSENSE);

    ///////////////////////////////////////////////////

    for(i=0 ;; i++)
    {
    printk("nrf_gpio_pin_write");

    if( i%2 == 0 )
    nrf_gpio_pin_write(tx_pin, 0);
    else
    nrf_gpio_pin_write(tx_pin, 1);

    k_usleep(10000);
    }
    }

    //////////////////////////////////////////////////////////////////////////////another problm
    now high is 1.8v and low is 0.45v

    Could set low to 0.0v

    Can software to do this?

    or need hardware to solve?

Children
Related