PICO-PI-IMX7: Editing and Recovery/Linux 4.19.x

Step 1: Download and Install:

Select Device:

Find D11 pin (pin 40 in schematic), configure as gpio, select pull-up/etc…

Open Board DTSI

Look at pinmux value:

Magic values are:

MX7D_PAD_SAI1_TX_SYNC__GPIO6_IO14          0x00000014

Open: imx7d-pico-pi.dts

change:

	pinctrl_gpio_leds: gpioledsgrp {
		fsl,pins = <
			MX7D_PAD_EPDC_DATA06__GPIO2_IO6		0x14
		>;
	};

to:

	pinctrl_gpio_leds: gpioledsgrp {
		fsl,pins = <
			MX7D_PAD_EPDC_DATA06__GPIO2_IO6		0x14
			MX7D_PAD_SAI1_TX_SYNC__GPIO6_IO14          0x00000014
		>;
	};

Then Change:

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio_leds>;

		led {
			label = "gpio-led";
			gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
		};
	};

to:

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio_leds>;

		led {
			label = "gpio-led";
			gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
		};

		led40 {
			label = "gpio40";
			gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};

Then in: imx7d-pico.dtsi rip out can2 as you’ve re-allocated gpio40…

Change

	pinctrl_can2: can2frp {
		fsl,pins = <
			MX7D_PAD_SAI1_TX_SYNC__FLEXCAN2_RX	0x59
			MX7D_PAD_SAI1_TX_DATA__FLEXCAN2_TX	0x59
		>;
	};

to:

	//pinctrl_can2: can2frp {
	//	fsl,pins = <
	//		MX7D_PAD_SAI1_TX_SYNC__FLEXCAN2_RX	0x59
	//		MX7D_PAD_SAI1_TX_DATA__FLEXCAN2_TX	0x59
	//	>;
	//};

and change:

&flexcan2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can2>;
	status = "okay";
};

to:

//&flexcan2 {
//	pinctrl-names = "default";
//	pinctrl-0 = <&pinctrl_can2>;
//	status = "okay";
//};

Then rebuild the kernel, install the kernel and reboot into it…

#turn on
echo 255 > /sys/class/leds/gpio40/brightness
#turn off
echo 0 > /sys/class/leds/gpio40/brightness

and repeat for any more gpio…

use ‘gpioinfo’ , this is a different board but same sytnax…

debian@bbb-pwr01-ser09:~$ gpioinfo
gpiochip0 - 32 lines:
        line   0:  "MDIO_DATA"       unused   input  active-high
        line   1:   "MDIO_CLK"       unused   input  active-high
        line   2:  "SPI0_SCLK"      "P9_22"   input  active-high [used]
        line   3:    "SPI0_D0"      "P9_21"   input  active-high [used]
.............

Column 4 is the ‘consumer’ using the gpio…

In this case, GPIO0_3 = SPI, and it’s controlled by the P9_21 consumer…

you configure that in the pinmux…

Regards,

1 Like