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

Then you’ll need to remove your “gpio-led” device tree node:

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

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

As that is given access to the gpio…

If you want to access the gpio thru gpioset, you need to rip out your gpio-led changes…

PS, c/c++ has a system call:

system("echo 255 > /sys/class/leds/gpio40/brightness"); 

Regards,

@RobertCNelson Sir.

  1. dtb (binary) is the file that important from the device tree and that I have to upgrade my imx7d-pico

  2. imx7d-pico it is originally made for android things (deprecated) and therefore google has the dts and dtsi files for me to build the dtb. Right? (Question 01)

Question 02:
What is the best way for me to build this dtb?



PS.:I know that the commands in the image above work because I updated the debin device tree

Well, since the *.dts has *.dtsi includes you can not just run “dtc”, you need to run the gcc preprocessor… So this isn’t trivial on the command line…

So, take a look at this repo project: https://github.com/beagleboard/BeagleBoard-DeviceTrees

Copy the Makefile, move your .dts/.dtsi to ./src/arm and copy your version of include/dt-bindings/ files needed when you run “make”…

Regards,

@RobertCNelson Hi,
I stay trying blink led in debian/imx7d-pico using libgpiod v1.4. I can blink gpio-led using gpioset 1 6=1 (and, in python3 application). But I can’t blink led in GPIO6_IO14 (pin number 40). How can I blink led in GPIO6_IO14 (imx7d-pico/carrier board) using gpioset (libgpiod) command ?

Pls

Hi @neuberfran , please share your device tree configuration for both those pins (aka gpio-led)…

Regards,

@RobertCNelson GitHub - neuberfran/imx7d-pico-dtsi

I did everything based on this site below. But instead of scp it uses the traditional commands (look part2) to write the device

https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/imx7d.dtsi

part2
sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/

sudo tar xfv ./armv7-lpae-multiplatform/deploy/${kernel_version}-dtbs.tar.gz -C /media/rootfs/boot/dtbs/${kernel_version}/

Hi @neuberfran , Looking at your posted device tree file, you have not defined GPIO6_IO14. You need to define it as a GPIO for gpioset to actually physically toggle the output.

Regards,

@RobertCNelson

Tks,
Ok,
I know how to generate the new *.dtb file,
using the makeconfig command, etc. But I need your help to include GPIO6_IO14 in my *.dts file and/or in *.h file.

Didn’t we already do this last november? PICO-PI-IMX7: Editing and Recovery/Linux 4.19.x - #160 by RobertCNelson

What’s different?

Regards,

@RobertCNelson Yes. I made this setup in November and it worked. With sysfs. I configured gpio-led and gpio40. But for libgpiod it’s a different story. You don’t need to make these changes. So much so, that the gpio-led is flashing nowadays

is the same as gpio-led, you need to make sure the pinmux is set and enabled by something… You just don’t need the gpio-led for full control…

I personally find gpio-led is better then libgpiod in final applications… As you can specify a boot-up condition/etc… Where-as libgpiod application “must” be active to have pin output control, and as soon as you stop libgpiod or the application the pin goes back to it’s default state.

Regards,

@RobertCNelson imx7d-pico-dtsi/imx7d-pinfunc.h at main · neuberfran/imx7d-pico-dtsi · GitHub

The GPIO6_IO14 It is already registered in this *.h file above. I need to know how to locate it within one of the five gpiochip blocks and then command(I guess)

https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/imx7d.dtsi

Use NXP’s pinmux tool, first few screen shots here:

Regards,

@RobertCNelson
Hi,

I need help to change files (DTB) inside
5.6.17-armv7-lpae-x14.1-dtbs.tar.gz file.

Because As you can see in the pictures below, there is a folder called POINT above the level where the files in the folder are. Very difficult. already tried something

How would you like me to change the creation of the archive?

Compressing 5.6.19-armv7-lpae-x23-dtbs.tar.gz...
tar --create --gzip --file ../5.6.19-armv7-lpae-x23-dtbs.tar.gz ./*

Regards,

@RobertCNelson I now have a new schedule of facts:

This photo below (important) is from 12/jan/2021. To get to it I made the changes (As you have asked now, that is, using NXP’s pinmux and I managed to flash the board’s led and gpios using SYSFS

On that day, if I tried to use the gpioset (from libgpiod) commands, I would get that the pins are in use.

Yesterday: I change imx7d-pico.dtsi file (besides, of course, removing the changes made with pinmux: gpio-led, gpio40, gpio38, gpio16):
&i2c1 {
@@ -393,6 +393,15 @@ &wdog1 {
};

&iomuxc {
+ pinctrl-names = “default”;
+ pinctrl-0 = <&pinctrl_hog>;
+
+ pinctrl_hog: hoggrp {
+ fsl,pins = <
+ MX7D_PAD_SAI1_TX_SYNC__GPIO6_IO14
0x40000014
+ >;
+ };
+
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX7D_PAD_I2C1_SCL__ECSPI3_MISO 0x2

I can make the 4 LEDs blink on Yocto using the gpioset command. But the read value (gpioget) never changes, it is always = 1

Using the command: tar --create --gzip --file …/5.6.19-armv7-lpae-x23-dtbs.tar.gz ./*

I generated a new dtbs.tar.gz (with the same DTB put on Yocto) but the only blinking led is the gpio-led. In the latter case, I’m talking about debian10/imx7d-pico/5.6.x

Hi @neuberfran, looking at your screenshot, gpio40 is an output… Did you convert it to an input before calling gpioget???

This thread has gone on for quite a long time. What is your goal for this project @neuberfran ? Are you just trying on learn libgpiod* or do you have a project in mind? (* i don’t personally use libgpiod in any projects, i still recommend gpio-led/etc…)

Regards,

@RobertCNelson Neither today nor then have I tried to convert the pin to input. Because it’s blink led. i think

I am preparing this board to use RPmsg. Send messages from A7 to M4. And, in the future, make something like the TAG robot from toradex and/or control BLDC/PMSM motors using FOC/pwm/RTOS type zephyr

SYSFS will be deprecated

I want to switch to libgpiod. I even have the issue below to transpose libgpiod v1.4.1 to v1.6:

**

About the fact that GPIO6_IO14 still doesn’t blink on debian10 I have a photo now that demonstrates the error. One of the DTB is still from January and not from July/2021.

How to correctly update a DTB

Ignore the kernel.org SYSFS depreciation entry, it will never be depreciated as there is tons of push back, as libgpiod is not even close to properly replacing it.

Regards,

@RobertCNelson In last post (numerber 196) I said: "Using the command: tar --create --gzip --file …/5.6.19-armv7-lpae-x23-dtbs.tar.gz ./*

The correct for me is tar --create --gzip --file …/5.6.17-armv7-lpae-x14.1-dtbs.tar.gz ./*

Now I can blink LED(s) in debian10 with imx7d-pico board using libgpiod v1.4