Verdin USB OTG Slave

Hi,
I have no experience with usb protocol but basically I would like to connect the Verdin over usb to a PC and see it as a mounted drive.
From the Dahlia datasheet on Verdin USB_1 Port:

I see that this should be possible, but just connecting a USB-C cable between my PC and Verdin X3 connector does nothing. On the other hand the port does work as a host. I can put in a usb stick and it is mounted in Linux and I can copy data onto it.

I see it depends on the CC Pin. Should I change anything or the PC handles handles this by itself?

Furthermore we are designing a USB Micro interface on our custom board with the same idea and the same USB_1 port of the Verdin. Is there something that we have to watch out for? This is the schematics:

Thanks in advance!

Hi @swiss !

Please refer to this USB Device Mode (Linux) | Toradex Developer Center article.

About the hardware for Verdin interfaces, please refer to the Verdin Carrier Board Design Guide.

Let us know if it helps you :slight_smile:

Best regards,

Hi @swiss !

Were you able to solve your issue?

Let us know :slight_smile:

Best regards,

Hi @henrique.tx ,
Sorry I am preoccupied with some other parts of the project right now. I will update you as soon as possible!

1 Like

Hi @henrique.tx ,
One month later I’m finally back on this topic.

After reading up on the links you sent me, I decided I want a to use the USB CDC ECM function.
I tried following the gadget example but I hit a problem as soon as:

# Mount configfs
mount -t configfs none /sys/kernel/config
cd /sys/kernel/config/usb_gadget/

# Create gadget
mkdir g2
cd g2

# Use Toradex vendor and product id
echo 0x1b67 > idVendor

I had to run most of the commands as sudo, but even with that, as soon as I change the idVendor file, (sudo vim idVendor and :wq! after to exit) I get a message:

WARNING: The file has been changed since reading it!!!

and the idVendor goes back to 0x0000.
The same happens for every step where I have to change a file in this example. I can’t change it and it goes back to it’s original value.

Also maybe worth mentioning just running the first step gives me this message:

mount -t configfs none /sys/kernel/config
mount: /sys/kernel/config: none already mounted on /sys/fs/bpf.

I have no idea if that is connected with the issue.

Btw I am using the TorizonCore image without Portainer

Hi @swiss !

Could you please share the following information:

  • Which exact module are you using? Please share its full name and version.
  • Which TorizonCore version are you using? Please share the output of cat /etc/os-release.
  • Have you done any customization on your TorizonCore image (either using TorizonCore Builder or building it using Yocto)?

This is expected as the default user in TorizonCore is torizon and you are dealing with system-related files in /sys/kernel therefore you need to give permission to torizon user to perform the modifications.

About your specific issue, we need to research and do some tests. We will get back to you as soon as we have some news.

Best regards,

Hi,

Verdin Mini v1.1 (with wifi), right now testing on Dahlia boad v1.1

ID=torizon
NAME=“TorizonCore”
VERSION=“5.7.0+build.17 (dunfell)”
VERSION_ID=5.7.0-build.17
PRETTY_NAME=“TorizonCore 5.7.0+build.17 (dunfell)”
DISTRO_CODENAME=“dunfell”
BUILD_ID=“17”
ANSI_COLOR=“1;34”
VARIANT=“Docker”

Only using TorizonCore to change the device tree overlay, I’m trying to aviod using Yocto (no experience). I just added my changes to the verdin-imx8mm_lt8912 overlay that was already applied. Pretty much just deactivating peripherals that I’m using form the M core and activating RPMSG. Here is the dto:

// Verdin DSI to HDMI Adapter orderable at Toradex.

/dts-v1/;
/plugin/;

/ {
	compatible = "toradex,verdin-imx8mm";
};

&gpu {
	status = "okay";
};


&pwm1 {
	status = "disabled";
};


/* Disable Verdin SPI */
&uart2 {
        status = "disabled";
        };
&uart3 {
	status = "disabled";
        };
&ecspi1 {
	status = "disabled";
        };

&ecspi2 {
	status = "disabled";
       	};

&gpio3 {
	status = "disabled";
	};

&flexspi {
	status = "disabled";
	};
&{/} {

    reserved-memory {

		#address-cells = <2>;
		#size-cells = <2>;
		ranges;
        
        vdev0vring0: vdev0vring0@B8000000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8000000 0 0x8000>;
			no-map;
		};

		vdev0vring1: vdev0vring1@B8008000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8008000 0 0x8000>;
			no-map;
		};

     		vdev1vring0: vdev1vring0@B8010000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8010000 0 0x8000>;
			no-map;
		};

		vdev1vring1: vdev1vring1@B8018000 {
			compatible = "shared-dma-pool";
			reg = <0 0xB8018000 0 0x08000>;
			no-map;
		};     

		vdevbuffer: vdevbuffer@b8400000 {
			compatible = "shared-dma-pool";
			reg = <0 0xb8400000 0 0x100000>;
			no-map;
		};
        
        rsc_table: rsc_table@B80FF000 {
			reg = <0 0xb80ff000 0 0x1000>;
			no-map;
		};
    };
};

&rpmsg {
	/*
	 * 64K for one rpmsg instance:
	 * --0xb8000000~0xb800ffff: pingpong
	 */
	vdev-nums = <2>;
	reg = <0x0 0xb8000000 0x0 0x20000>;
	 memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, 
                   <&vdev1vring0>, <&vdev1vring1>, 
                   <&rsc_table>;
    status = "okay";
};

How do I change the permissions? I would suggest adding this information to the USB Device Mode (Linux) | Toradex Developer Center page since a lot of users probably use torizoncore with torizon user when trying this for the first time.
Sorry, I missunderstood, you meant adding sudo is expected, but my issue that the files keep their old values is a new issue.

Since you are looking into my specific issue, a bit more information:

My goal is to use the pins shown in my first post in this question, so USB 1 of the Verdin port for communication with the PC. The CDC ECM protocol looks like the best solution since it should be compatible with Windows, OSx and Linux as host computers. My priority right now is communicating with Windows though. Also the communication will be through a container later, but that shouldn’t pose any issues I hope, after I make it work from the torizoncore directly.

Thanks in advance!

Hello @swiss ,
Did you have a look at this thread too?

Best regards,
Josep