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

GPIO Set Inconsistencies

Hi all,

I've got some code running on my nRF9160dk that is behaving oddly. LED 3 blinks as expected (2 seconds on, 1 second off) but GPIO 10 (pin 18/ULTRASONIC_TRIG) remains at 3v (VDD_GPIO). My code,

void main(void) {
    _gpio = device_get_binding("GPIO_0");
  if (_gpio == NULL) {
    printk("Error Initializing GPIO\n");
  } else {
    printk("GPIO Initialized.\n");
  }
    gpio_pin_configure(_gpio, 4, GPIO_OUTPUT_HIGH); //p0.04 == LED3
  gpio_pin_configure(_gpio, ULTRASONIC_TRIG, GPIO_OUTPUT_HIGH);
  while (1) {
    //Maintaining High
    gpio_pin_set(_gpio, ULTRASONIC_TRIG, 1);
    gpio_pin_set(_gpio, 4, 1);
    k_msleep(2000);
    // Go low go low
    gpio_pin_set(_gpio, ULTRASONIC_TRIG, 0);
    gpio_pin_set(_gpio, 4, 0);
    k_msleep(1000);

    printk("Triggered.\n");
  }
}

In addition to this, i have a `nRF9160_pca10090ns.overlay as follows (hangs over from before I removed everything out to diagnose this).

&uart0 {
	status = "okay";
	current-speed = <9600>;
	tx-pin = <9>;
	rx-pin = <19>;
	rts-pin = <0xFFFFFFFF>;
	cts-pin = <0xFFFFFFFF>;
};

Lastly, for sanity's sake, my prj.conf

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_STDOUT_CONSOLE=y

#CONFIG_GPIO=y

#debug
CONFIG_DEBUG=y
CONFIG_LOG=y

# Segger RTT
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_BSD_LIBRARY_TRACE_ENABLED=n

Thanks in advance for your help :)

Parents Reply Children
No Data
Related