Enabling usb host controller to detect ttyUSB0 for i.MX8MN

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling usb host controller to detect ttyUSB0 for i.MX8MN

Jump to solution
2,356 Views
betanapallisandeepraj
Contributor III

Hi,

I am trying to connect a serial console to usb interface in i.MX8MN board with ddr4. SoM is i.MX8MN and base board is custom with USB connection to connect a serial device through the USB. When we connect to ubuntu host machine I could see my sensor detected with ttyUSB0. Similarly I would like to interface my sensor to i.MX8MN board with USB interface to read the data serially. I have enabled 2 configurations as below, 

CONFIG_USB_SERIAL_CONSOLE=y

CONFIG_USB_SERIAL_GENERIC=y

Solved: Enable ttyUSB0 - NXP Community

In device tree I could see usbotg1: usb@32e40000 and usbmisc1: usbmisc@32e40200 already. Is there any changes needed in the device tree to enable the usb to serial host support in the i.MX8MN SoM.

I could already see ttymxc0, ttymxc1, ttymxc2. I am using ttymxc2 for another application on bluetooth. I think ttymxc1 for serial debug console. Can I use ttymxc0, If I am not using M7 controller on the board?
If so, how to free it?

From kernel and device tree or bootloader do I need to add any other changes to support this usb serial interface feature on i.MX8MN SoM source code. Any suggestions on this would be very helpful. 

Tags (1)
0 Kudos
1 Solution
2,305 Views
betanapallisandeepraj
Contributor III

Hi,

To convert default usb otg in i.MX8mn to normal usb host only on the board, I have done below changes,

$pwd
/home/sandeepraj/imx-yocto-bsp1/build-wayland/tmp/work-shared/imx8mnevk/kernel-source/arch/arm64/boot/dts/freescale
$vim imx8mn-ddr4-evk.dts
&usbotg1 {
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
// dr_mode = "otg";
dr_mode = "host";
hnp-disable;
srp-disable;
adp-disable;
// usb-role-switch;
status = "okay";
/*
port {
usb1_drd_sw: endpoint {
remote-endpoint = <&typec1_dr_sw>;
};
};
*/
};

/*
ptn5110_1: tcpc@50 {
compatible = "nxp,ptn5110";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_typec1>;
reg = <0x50>;
interrupt-parent = <&gpio2>;
interrupts = <11 8>;
status = "okay";

port {
typec1_dr_sw: endpoint {
remote-endpoint = <&usb1_drd_sw>;
};
};

typec1_con: connector {
compatible = "usb-c-connector";
label = "USB-C";
power-role = "dual";
data-role = "dual";
try-power-role = "sink";
source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
PDO_VAR(5000, 20000, 3000)>;
op-sink-microwatt = <15000000>;
self-powered;
};
};
*/
disable other serial drivers in usb support related serial or other to work.
In my case default serial driver did not work, so I enabled the required one. 

After doing all these changes along with serial baudrate configuration from my application, 
I could read my sensor data through the usb serial interface that is /dev/ttyUSB0. 

Thank you NXP for the support over email communication. 

View solution in original post

0 Kudos
2 Replies
2,306 Views
betanapallisandeepraj
Contributor III

Hi,

To convert default usb otg in i.MX8mn to normal usb host only on the board, I have done below changes,

$pwd
/home/sandeepraj/imx-yocto-bsp1/build-wayland/tmp/work-shared/imx8mnevk/kernel-source/arch/arm64/boot/dts/freescale
$vim imx8mn-ddr4-evk.dts
&usbotg1 {
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
// dr_mode = "otg";
dr_mode = "host";
hnp-disable;
srp-disable;
adp-disable;
// usb-role-switch;
status = "okay";
/*
port {
usb1_drd_sw: endpoint {
remote-endpoint = <&typec1_dr_sw>;
};
};
*/
};

/*
ptn5110_1: tcpc@50 {
compatible = "nxp,ptn5110";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_typec1>;
reg = <0x50>;
interrupt-parent = <&gpio2>;
interrupts = <11 8>;
status = "okay";

port {
typec1_dr_sw: endpoint {
remote-endpoint = <&usb1_drd_sw>;
};
};

typec1_con: connector {
compatible = "usb-c-connector";
label = "USB-C";
power-role = "dual";
data-role = "dual";
try-power-role = "sink";
source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
PDO_VAR(5000, 20000, 3000)>;
op-sink-microwatt = <15000000>;
self-powered;
};
};
*/
disable other serial drivers in usb support related serial or other to work.
In my case default serial driver did not work, so I enabled the required one. 

After doing all these changes along with serial baudrate configuration from my application, 
I could read my sensor data through the usb serial interface that is /dev/ttyUSB0. 

Thank you NXP for the support over email communication. 

0 Kudos
2,341 Views
betanapallisandeepraj
Contributor III

usb host controller is working fine with nxp board. but in the custom board we have removed the Power Management IC and changed the otg usb-c slot to USB host adapter slot in custom board. What are the changes required in device tree or kernel if we remove the PMIC with respect to usb device?

0 Kudos