Verdin imx8m mini, torizon OS, uart set maximal Baudrate

Hello Support Team

My HW:
SOM: Verdin iMX8MM Q 2GB IT, V1.1
Carrier board: custom
SW:
TorizonCore 6.4.0+build.5, adapted with own dt-overlay

I like to set the maximum available uart Baudrate for /dev/verdin-uart1 and /dev/verdin-uart2. Best would be 6Mbps, but looking into the ‘i.MX 8M Mini Applications Processor Datasheet for Consumer Products’ datasheet (p.12) it seems that 4Mbps is maximum.

So I guess I have to adapt the device tree with an overlay for higher uart speed. Could you provide the adaption? When I look at this link https://community.nxp.com/t5/i-MX-Processors/Baud-rate-is-not-getting-set-for-more-than-1500000-1-5Mbps/m-p/1641377#M204942 I guess it should be possible when changing the ‘assigned-clock-parents’ parameter.

Thanks.
Regards.
Pitschen

Hi @pitschen

Most likely the device tree overlay would look something like this:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2022 Toradex
 */

// Verdin iMX8M Mini uart

/dts-v1/;
/plugin/;

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

/* Verdin UART_1 */
&uart2 {
	max-speed = <4000000>;
	assigned-clocks = <&clk IMX8MM_CLK_UART4>;
	assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
};

However, most likely you first need to download or configure the module with a lower baud rate. Therefore, you have to make sure that the low and high UART clock speed can be reached with a divider (can be found in the reference manual of the iMX8MM from NXP) with the configured clock parent e.g. 80MHz. Therefore, I recommend you to first try to bringup the Bluetooth module with the default settings and only afterward try to switch to a higher clock speed.

Regards,
Stefan

Hello Stefan

I could resolve the issue. Thanks a lot.
Here is my solution:

// RS485 2, Verdin UART1
&uart2 {
status = “okay”;
linux,rs485-enabled-at-boot-time;
rs485-rts-active-high;
rs485-rx-during-tx;
//rs485-rts-delay = <100 100>;
max-speed = <4000000>;
assigned-clocks = <&clk IMX8MM_CLK_UART2>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
};

// RS485 1, Verdin UART2
&uart3 {
status = “okay”;
linux,rs485-enabled-at-boot-time;
rs485-rts-active-high;
rs485-rx-during-tx;
//rs485-rts-delay = <100 100>;
max-speed = <4000000>;
assigned-clocks = <&clk IMX8MM_CLK_UART3>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
};

Now I can send with 4Mbps on the uart side. As you can see we use the 2 uarts with RS485 Transceivers.

There is another issue with uart2 (i.MX8MM function) when sending: the uart2.CTS_B Signal on Verdin pin 133 suddenly stops working, whereas there is no issue with the uart3 (i.MX8MM function) concerning the uart3.CTS_B Signal. I tried also the default uart clock source (ie. without device tree adaption above) for the uart: same issue there with uart2 (i.MX8MM function).
So my question is: is there any known issue with uart2 (i.MX8MM function) when using it as RS485?

Best regards.
Pitschen

Hello Stefan

Just an addition:
The issue happens when I switch the baudrate several times with stty, eg.
stty -F /dev/verdin-uart1 1500000

Best regards.
Pitschen

Hi @pitschen,

We are not aware of any problems with the uart. However, as you probably understand, we cannot test every possible use case. Therefore, you may run into a corner case. If you check imx8mm.dtsi you will see that uart2 does not use the dma, maybe this is the problem?

// RS485 2, Verdin UART1
&uart2 {
status = “okay”;
linux,rs485-enabled-at-boot-time;
rs485-rts-active-high;
rs485-rx-during-tx;
//rs485-rts-delay = <100 100>;
max-speed = <4000000>;
assigned-clocks = <&clk IMX8MM_CLK_UART2>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
dmas = <&sdma1 26 4 0>, <&sdma1 27 4 0>;
dma-names = "rx", "tx";
};

// RS485 1, Verdin UART2
&uart3 {
status = “okay”;
linux,rs485-enabled-at-boot-time;
rs485-rts-active-high;
rs485-rx-during-tx;
//rs485-rts-delay = <100 100>;
max-speed = <4000000>;
assigned-clocks = <&clk IMX8MM_CLK_UART3>;
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
/delete-property/ dmas;
/delete-property/ dma-names;
};

Does this change anything? I would expect that it afterward works with uart2 but not anymore with uart3.

Regards,
Stefan

Hi Stefan

I tried it out, but with above devicetree there is no communication possible at all with Verdin-Uart1.
Sending something with echo on the command line stucks.

Anyway, we decided to not use the linux rs485 mode. We have full duplex and use the RTS/CTS Signals just for power saving in power save modes. We will do this now with GPIOs.

So I think we can close this issue. 4MBps is working.
Best regards.
Pitschen

Hi @pitschen

Thanks a lot for the feedback. Strange that it is not working at all with the dma enabled. However, it is good to hear you found a workaround for it.

Regards,
Stefan