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

Did you physically boot into xorg/xfce? xinput relies on a running xserver.

Regards,

I command startx and I have results (But I only have touch now after ):

sudo modprobe edt-ft5x06 **and**
sudo cat /dev/input/event0 | hexdump -C

But I have two images (jpg and png) and I can’t enlarge them to full screen after double clicking on them:

Enviando: 20201003_232012.jpg…

Just add “edt-ft5x06” to the file:

/etc/modules

to have it loaded on startup…

That’s for the application that you are “writing” to do…

Regards,

@RobertCNelson I am now with intent to make a pico-imx7d based drone (I have 3 here). Many have already done it based on rpi3 and rpi zero. But HAT navio2 said it does not fit in the peak with her carrier board. I’m working on it. But first I need to learn a few things. I count on some of your answers below:

1 - How to flash a led using the ubuntu image (the same one we installed last) that I have here?
2 - The lib pi4j (much used in debian/raspberry pi) and android things itself (very used in pico-imx7d) give me commands (cli) so I can see which gpios I can count on. Is there anything similar in this version of ubuntu embedded in pico-imx7d that I can use to do this?

This is not trivial, and will take some work on your behalf @neuberfran, but a quick gist of what you need to accomplish.

First just export the pins you would like to interface with thru the device tree. Either as gpio or as led devices.

Then just add support for the board for the drone library, so the library knows what gpio/pins interface with what.

Regards,

@RobertCNelson Sir. Tks. In page 02 of my email: (removed)

I asked the Sir. Adrien Aubry some questions
who responded promptly.
At first, I will rely on his project to make my drone economically and efficiently.
1 - I still have doubts on how to blink a led and see my pwm on my pico-imx7d with embedded ubuntu

2 - Find out if the commands below, supported by it, will work:
2.1 - copy the Toolchain-rpi.cmake file to Toolchain-pico-imx7d.cmake and change the necessary paths (you can also take a look at Toolchain-stm32.cmake for more examples)
2.2 - then copy the boards/generic folder to boards/pico-imx7d
Finally, you should be able to compile :
2.3 - mkdir flight/build && cd flight/build
2.4 - cmake -Dboard=pico-imx7d -Dhud=0 …
2.5 - make

Hi @neuberfran, it looks like you are in good hands…

There is already one led enabled: “gpio-led”

#off
echo 0 > /sys/class/leds/gpio-led/brightness

#on
echo 255 > /sys/class/leds/gpio-led/brightness

PS, i really hope that was from a public email thread, you really shouldn’t share private emails.

Regards,

@RobertCNelson

Okay. This is something public. But, what if I want more than one blinking led? If you want to turn on the led using a button and a breadboard and a python app?

And, mostly, you didn’t answer about pwm. Do I have them? How to know?

If want to access them thru the LED subsystem, you’ll need to add more to that list:

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

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

That doesn’t matter, your python app would turn on (and off) the led the same way…

First take a look at the Device Tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx7d-pico.dtsi

&pwm1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm1>;
	status = "okay";
};

&pwm2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm2>;
	status = "okay";
};

&pwm3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm3>;
	status = "okay";
};

&pwm4 { /* Backlight */
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm4>;
	status = "okay";
};
	pinctrl_pwm1: pwm1 {
		fsl,pins = <
			MX7D_PAD_GPIO1_IO08__PWM1_OUT   0x7f
		>;
	};

	pinctrl_pwm2: pwm2 {
		fsl,pins = <
			MX7D_PAD_GPIO1_IO09__PWM2_OUT   0x7f
		>;
	};

	pinctrl_pwm3: pwm3 {
		fsl,pins = <
			MX7D_PAD_GPIO1_IO10__PWM3_OUT   0x7f
		>;
	};

	pinctrl_pwm4: pwm4grp{
		fsl,pins = <
			MX7D_PAD_GPIO1_IO11__PWM4_OUT	0x7f
		>;
	};

So 4 pin’s are defaulted to pwm, one is set to a backlight for the LCD, while the other 3 should be free for you to use under /sys/class/pwm/

Regards,

@RobertCNelson Where is be the list ?

I will do this: echo 255 > /sys/class/leds/gpio-led/brightness
Ok.
But I will attack the positive of the led in which gpio of pico-im7d?

That LED in the code block is already on the pcb.

Regards,

@RobertCNelson

tks. But I do other question too. Where is be the (gpio) list ? (To edit) and Where is be the (pwm) list ? (To edit and see my pwm(s) pins)

echo 255 > /sys/class/leds/gpio-led/brightness not change nothing in carrier board

mainline kernel only initialized linux peripheral actually being used. Grab the schematic, find the pins on the interface you want to use and add them to the pinmux/peripheral in the device tree.

Did you try 0? is it even enabled? It’s setup in the device tree, there should be a led tied to it.

Regards,

@RobertCNelson

Pin 40 is CAN2_RX:

Schematic:

https://www.technexion.com/support/download-center/?wpv-product=pico-imx7-emmc&wpv_aux_current_post_id=78&wpv_view_count=181-TCPID78

Regards,

@RobertCNelson

1 - I need a step by step (tutorial) on how to activate this gpio

2 - What about the result of the gpiodetect command from the screenshot above? Are these gpios there already enabled? Why can’t I use them instead of gpio 40?

3 - What about the pull-up/pull-down? Did the gpios come with this?

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

@RobertCNelsonI have to make a correction before:
The commands echo 255 > /sys/class/leds/gpio-led/brightness and echo 0 > /sys/class/leds/gpio-led/brightness
are producing changes in 1 carrier board led

@RobertCNelson
Excuse me for insisting, but this part below is not so easy for me and it would be good to advance a few more details:

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

Can I assume you already followed?

Change back to ./armv7-lpae-multiplatform/, patch the files under ./KERNEL/ then run:

./tools/rebuild.sh

Then update:

/boot/extlinux/extlinux.conf

Then install the kernel, modules, and dtbs’s:

Regards,