Set Default PIN modality for IMX6ULL

ear guys,
I’m sorry for my stupid question.
I want to set the PIN’s description at the boot:

for example I want to set the SODIMM 28 as GPIO input and in my image this PIN is set as rawnand.DQS, you can see the PIN description option in the attached image. [1]: /community/storage/temp/2562-screenshot.png

If I change manually the value with GPIO-TOOL as GPIO and INPUT.

I can read right the value of the PIN using teh follwoing lines:

         int fd;
        fd = open("/sys/class/gpio/export", O_WRONLY);
        write(fd, "112", 3  );
       close(fd);
   fd = open((_"/sys/class/gpio/gpio112/direction").c_str(), O_WRONLY);
   if(fd ==-1) std::cout<<"ERROR\n";
    write(fd, "in", 2);
   close(fd);
    fd = open("/sys/class/gpio/gpio112/value", O_RDONLY);
   read(fd, &value, 1); // read GPIO value
   printf("GPIO value: %c\n", value); // print GPIO value

while if I don’t change the default Description I read a wrong value.

I think to have to change the boot image or tree image but I don’t kown what I must do.
Could you help me ?
best regards
Matteo

Dear @kevin.tx,
I am interested in reading the motor frequency by reading the front of the gpio112.

This pin has a pull-up resistor and I used a code similar to Source code 4 of the following link:

If I change the pin modality as GPIO Input using the gpio-tool I obtain the right frequency, ( this valuie is compared with the oscilloscope and tester).

If you want could I share a video and / or code.
Thank you
Best regards

Gpio-tool application manipulate with GPIO and PINMUX registers directly. If you want to use some pin as GPIO using Linux interface(s) you need to set proper pinmuxing in a Device Tree

Dear @Matte,

for your information the BSP Version 2.8 will soon reach end of life and will not be supported anymore. Please consider moving to BSP3.0.4 (LTS) or our newer production release of BSP 5.1.0.

It is also recommended to change your application for handling the GPIOs. Using the sysfs environment for handling will be discontinued from the mainline kernel. The current approach for this is by libgpiod .

Your approach still works. As alex already stated you need to set proper pinmuxing, where you can also enable the pullup resistor. See attached the changes you need to do in the device tree.

device tree changes

Best Regards

Dear @kevin,
thank for your support.
Now, I’m starting to use the new production release toradex_5.4-2.3.x-imx.
I changed my tree and copy the zImage and imx6ull-colibri-eval-v3.dtb

I tried the Colibri-iMX6ULL_Reference-Multimedia-Image-Tezi_5.2.0-devel-202102+build.7
but I had any errors on the boot image, so I used the Image Colibri-iMX6ULL_Reference-Minimal-Image-Tezi_5.2.0-devel-202102+build.7
I want to auotogin at the start of the device
what do I do to autogin?

Coud you suggest me any other image compatible with toradex_5.4-2.3.x-imx.?
Best regards
Matte

Dear @Matte,

I see your using the Downstream kernel, which is a good choice.

Some instability is to be expected from the monthly builds. Did you try to use a newer “nightly” build?

It would be interesting and helpful for us, if you could state the errors you encountered while working with Colibri-iMX6ULL_Reference-Multimedia-Image-Tezi_5.2.0-devel-202102+build.7. Can you post some information on them?

Let me know if you had success with the nightly build.

Best Regards
Kevin

Dear @Matte,

let me know if the use of the nightly build changed anything.

Now to your SPI issue. Looking through your log-file, I can see that SPI is enabled, but it seems that, CAN is also enabled. After that CAN takes full control of the situation.

[   12.818485] spi_imx 2008000.spi: probed
[   16.946502] CAN device driver interface
[   17.027182] mcp251x spi0.0 can0: MCP2515 successfully initialized.

Did you intentionally enable the CAN interface?

Best Regards
Kevin

Dear @Matte,

I am glad that the nightly build allowed you login without request.

Yes right, on the log there is no CAN enabled, but as I see there is also no SPI enabled.

spi_imx 2008000.spi: probed

I can’t see the above line. Are you sure you enabled SPI?

Best Regards Kevin

Dear @kevin.tx,
I used the following lines on the tree:

&ecspi1 {
 	status = "okay";

         mcp2515: can@0 {
		compatible = "microchip,mcp2515";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_can_int>;
 		reg = <0>;
 		spi-max-frequency = <10000000>;
 		vdd-supply = <&reg_3v3>;
 		xceiver-supply = <&reg_5v0>;
		status = "disabled";
 	};
	 spidev0: spidev@0 {
                compatible = "toradex,evalspi";
                reg = <0>;
                spi-max-frequency = <1000000>;
                status = "okay";
        };


        spidev1: spidev@1 {
                compatible = "toradex,evalspi";
                reg = <1>;
                spi-max-frequency = <1000000>;
                status = "okay";
        };


         spidev2: spidev@2 {
                compatible = "toradex,evalspi";
                reg = <2>;
                spi-max-frequency = <1000000>;
                status = "okay";
        };

      spidev3: spidev@3 {
                compatible = "toradex,evalspi";
                reg = <3>;
                spi-max-frequency = <1000000>;
                status = "okay";
        };
    };

In order to enabled SPI is it right?

Best regards

Matteo

Dear @kevin.tx,

thank you for suggestion, today I’ll try a night version.
I recompiled the the and solved the errors with the Colibri-iMX6ULL_Reference-Multimedia-Image-Tezi_5.2.0-devel-202102+build.7.

I have a question about this version toradex_5.4-2.3.x-imx:

I add on my tree the spi using the proceedings described in the following my ticket

However I don’t have the spi device .

I attached the dmesg log link text

Could you see any errors?

Best regards

Matteo

Dear @kevin.tx,

I tried a night version (Toradex Embedded Linux Reference Multimedia Image 5.0.0+build.3)
and it’s starting correctly without the login request.

However I don’t have the SPI device: the can is disbaled and the spi is enable, in this case I don’t have CAN driver on dmesg log (see this attachmentlink text) and I attached the git diff log link text

Could you give me why I don’t have the SPi devices?

Best regards
Matteo

Dear @kevin.tx,

I saw in dmseg log the following message:

Failed to start Load Kernel Modules

in order to solve it,
Must I do all steps on my pc on linux-toradex folder?

         make -j3 modules
         mkdir modules
         export INSTALL_MOD_PATH=modules
         make modules_install
         cd modules
         tar -czf ../modules.tar.gz .
         tar -xzf modules.tar.gz -C /

I ask you before to break my pc?

Best regards
Matteo

Dear @Matte,

your issue is currently reviewed internally.

I will reach out back to you, as soon as there are any updates.

Thanks for your patience.

Best Regards
Kevin

Dear @kevin.tx,
thank you,

I’m waiting your news.

if I can perform any tests or do anythings.

Don’t hesitate to contact me.

Best regards

Hi @Matte!

Do you mean to use the SPI userspace API? If so, refer to this kernel documentation: https://www.kernel.org/doc/Documentation/spi/spidev

You can check if the SPI device shows up with:
ls /dev/spidev*