• Support
  • Binding fails because the pinmux_lpuart2 name is incorrect.

I have definitions in *.dtsi file (see below)

	pinmux_lpuart2: **pinmux_lpuart2** {
		group0 {
			pinmux = <&iomuxc_gpio_ad_b1_09_lpuart2_rx>,
				<&iomuxc_gpio_ad_b1_08_lpuart2_tx>;
			drive-strength = "r0-6";
			slew-rate = "slow";
			nxp,speed = "100-mhz";
		};
	};

	/* conflicts with user led */
	pinmux_lpuart2_sleep: pinmux_lpuart2_sleep {
		group0 {
			pinmux = <&iomuxc_gpio_ad_b1_09_gpio1_io25>;
			drive-strength = "r0-6";
			bias-pull-up;
			bias-pull-up-value = "100k";
			slew-rate = "slow";
			nxp,speed = "100-mhz";
		};
		group1 {
			pinmux = <&iomuxc_gpio_ad_b1_08_lpuart2_tx>;
			drive-strength = "r0-6";
			slew-rate = "slow";
			nxp,speed = "100-mhz";
		};
	};

The binding code fails

    const struct device * uart2_dev = device_get_binding("**pinmux_lpuart2**");
    if (uart2_dev ==NULL) {
         LOG_ERR ("Failed to bind to GPIO device");
    }
    // configure the LED pin as output
   gpio_pin_configure(uart2_dev, UART2_PIN, GPIO_OUTPUT_ACTIVE | GPIO_OPEN_DRAIN | GPIO_ACTIVE_LOW);
   gpio_pin_set(uart2_dev, UART2_PIN, GPIO_LOW);

    k_msleep(2500);  //sleep for 2.5 sec
    uart_poll_out (uart2_dev, 0x60) ;  // transmit after they got the pin low to get it going 
//---------------------------
    fd = setup_socket(tty2);
    if (fd < 0) {
        LOG_ERR("Cannot start UART2 application (%d)", fd);
        return;
    }

Evidently, "pinmux_lpuart2 is a wrong device to be binding to … What am I doing wrong ?
Thank you!


*************TX: Buffer read returned 0 *********
[00:00:05.514,000] <err> net_socket_can_sample: Failed to bind to GPIO device
[00:00:05.514,000] <err> os: ***** MPU FAULT *****
[00:00:05.514,000] <err> os:   Instruction Access Violation
[00:00:05.514,000] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000052  r2/a3:  0x00060007
[00:00:05.514,000] <err> os: r3/a4:  0xffffffff r12/ip:  0x0000158a r14/lr:  0x60004a09
[00:00:05.514,000] <err> os:  xpsr:  0x01000000
[00:00:05.514,000] <err> os: Faulting instruction address (r15/pc): 0xfffffffe
[00:00:05.514,000] <err> os: >>> ZEPHYR FATAL ERROR 20: Unknown error on CPU 0
[00:00:05.515,000] <err> os: Current thread: 0x80000a20 (unknown)
[00:00:05.516,000] <err> os: Halting system

I am answering my own question. I am missing DEVICE_DT_GET (BUTTON_GET).
I also think that the syntax
pinmux_lpuart2: pinmux_lpuart2 is incorrect.
needs to be
pinmux_lpuart2: pinmux_lpuart_2

Terms and Conditions | Privacy Policy