Hello there,
I’m working on a project on Humming Board IMX8MP, in that I’m working with UART for Video stream out. We are able to transmit video stream with 1.5Mbps i.e. with baud rate 1500000. For video streaming, we are using gstreamer pipeline.
As per the data sheet, UART can support up to 4Mbps and we would like to use it to the fullest.
Could anyone help me with this. ???
We are using following commands to set Baud Rate :
stty -F /dev/ttymxc2 1500000 // set baudrate
stty -F /dev/ttymxc2 -crtscts // disable cts-rts
已解决! 转到解答。
Ok.
In imx8mp RM see available settings
Determine in device how are they called in Linux jargon. dtsi's point to include/dt-bindings/clock/imx8mp-clock.h. You won't find there something like PLL1_DIV10, but somewhat equivalent with divider output frequency. In imx8mp-ab2.dts I found ready made example for you:
&uart1 { /* BT */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
assigned-clocks = <&clk IMX8MP_CLK_UART1>;
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
fsl,uart-has-rtscts;
status = "okay";
};
You need those two assigned-xx lines with UARTn matching your UART instance. It could be SYS_PLL1_80M or something else from the list above "translated" to defines from imx8mp-clock.h.
Isn't 24MHz (1.5*16) oscillator selected as your UART module clock?
From imx7 manual:
Dear @kef2 ,
Thanks for your reply.
I'm attaching imx8mp SOM schematic, and Highlighted an oscillator section.
Were you taking about this.??
If Yes, then by changing it to 64Mhz, UART should start working with 4Mbps. Right.??
Plz refer the below image. Looking forward to your quick response.
I meant that your UART module clock is perhaps too low for >1.5MBps. You shouldn't change oscillator crystal, but instead modify your kernel device tree to switch your UART to faster clock.
Dear @kef2 ,
Understood. But could you please help me with few more details, like -
Which device tree files exactly I should be looking into..??
I'm working with Solidrun's Humming Board.
Thanks,
Lokesh
It depends on board you are using.
Looks like you are not in touch with kernel device tree. Sadly I don't have time to create detail instructions for You.
Dear @kef2 ,
I'm using IMX8MP Humming Board from Solidrun. I've gone through all the dts and dtsi files, where UART modules are declared and clks also defined in there. But if I look deeper, I didn't found the place where I can change the clock frequency.
You can give me a generalize hint, a little more detailed. So, I can find it by myself.
Thanks for your response.
Lokesh
Hello @jadhav_lokesh,
I am wondering if you were able to find a solution to setting the desired baud rate with your DTS. I am trying to reach 3 Mbaud/s but was not lucky enough to get there with the solution proposed by @kef2. The interface work perfectly in U-Boot when 115200 bauds/s is set, but as soon as I boot to Linux kernel with command line option console=ttyS5,3000000, the output gets lost somewhere between our UART2USB adapter and my serial console client. The adapter's LED does indicate there is some data transmission from the kernel, but gives no output either with 115200 baud/s or with 3 Mbauds/s. I am able to reconnect to another ARM64 CPU from a different manufacturer with 3Mbauds/s using the same HW and procedure, though.
Thanks!
Lukáš
There is a list of "standard" baud rates, Linux supports. If your baudrate is not on that list, then the only practical way to get custom baudrate is to use TCSETS2 IOCTL.
#include <stdlib.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <asm/termbits.h>
#include <sys/ioctl.h>
#include <unistd.h>
void main(void)
{
struct termios2 newtio;
int fd = open( "/dev/ttymxc1", O_RDWR | O_NOCTTY);
ioctl(fd, TCGETS2, &newtio);
newtio.c_cflag &= ~CBAUD; //Remove current baud rate
newtio.c_cflag |= CBAUDEX; //Allow custom baud rate using int input
newtio.c_ispeed = 1250000; //Set the input baud rate
newtio.c_ospeed = 1250000; //Set the output baud rate
ioctl(fd, TCSETS2, &newtio);
Hello @kef2, thank you for quick reply. What do you mean by "standard" baud rates? Is it a limitation of NXP's serial driver? If so, is there a list of baud rates which are actually allowed by the driver for the iMX8MP processor? The Linux kernel supports baud rates up to 4 Mbaud/s incl. 3 Mbaud/s, as documented in the manual: https://man7.org/linux/man-pages/man3/termios.3.html. The UART2USB adapter we are using works correctly at 3 Mbaud/s with ARM64 processors from Marvell. Our use case requires early-boot access to the serial console with baud rate set at boot time.
I meant baud rates, which Linux finds OK. Other not listed in Linux sources are not OK.
drivers/tty/tty_baudrates.c lists only these baud rates. Others like 1250000 can be activated with TCSETS2 ioctl.
Hello @kef2,
right, but this is precisely the resource I am referring to. Both tables list 3000000 baud/s as well. After all, the iMX8MP processor is not a SPARC platform.
Yet, the baud rate does not seem to work. What I don't know is if that is a limitation of the serial driver from NXP. And, if there are further limits imposed by the driver, which baud rates are actually supported?
Low serial module clock question was touched already. Check your module clock. From imx8mp RM;
Ok.
In imx8mp RM see available settings
Determine in device how are they called in Linux jargon. dtsi's point to include/dt-bindings/clock/imx8mp-clock.h. You won't find there something like PLL1_DIV10, but somewhat equivalent with divider output frequency. In imx8mp-ab2.dts I found ready made example for you:
&uart1 { /* BT */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
assigned-clocks = <&clk IMX8MP_CLK_UART1>;
assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
fsl,uart-has-rtscts;
status = "okay";
};
You need those two assigned-xx lines with UARTn matching your UART instance. It could be SYS_PLL1_80M or something else from the list above "translated" to defines from imx8mp-clock.h.
I just wonder how you set gstreamer pipeline with uart to transmit video stream? for how to set uart, maybe you can refer to the link as below:
"https://community.nxp.com/t5/i-MX-Processors/iMX6-UART-refuse-to-set-baud-rate-to-1-Mbps/m-p/704653"