How S32G3 Linux BSP 35 enable ttyLF1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How S32G3 Linux BSP 35 enable ttyLF1

跳至解决方案
3,015 次查看
GG0712
Contributor III

Hi NXP team,

 

I referenced S32G399ardb3 and designed out custom board and use Linux BSP 35.

 

Our S32G3 customized board can not receive UART data from PC,but PC can received UART data from S32G3

 

How do we know what function PINMUX FUNC X represents in device tree?

If we enable UART2 how should PINMUX FUNC X be set?

 

Below is our device tree (I follow BSP 43 to modify)

uart1_pins: uart1_pins {
	uart1_pins_grp0 {
		pinmux = <S32CC_PINMUX(40, FUNC2)>;	// PC_08
		output-enable;
		slew-rate = <S32CC_GPIO_SLEW_50MHZ>;
	};

	uart1_pins_grp1 {
		pinmux = <S32CC_PINMUX(36, FUNC0)>;	// PC_04
		input-enable;
		slew-rate = <S32CC_GPIO_SLEW_50MHZ>;
	};

	uart1_pins_grp2 {
		pinmux = <S32CC_PINMUX(736, FUNC2)>;
	};
};
&uart1 { pinctrl-0 = <&uart1_pins>; pinctrl-names = "default"; status = "okay"; };

I use command in S32G3 to send data

echo "Test" > /dev/ttyLF1

My PC can use command to received data

cat /dev/ttyUSB1

 

Thanks

0 项奖励
回复
1 解答
3,009 次查看
GG0712
Contributor III

Hi NXP team,

 

I found these issue in S32G3_IOMUX 2.xlsx file

 

PC_04 PINMUX function "LIN Receive Data" SSS is 0000_0100, so it should be FUNC4

 

uart1_pins_grp2 {
	pinmux = <S32CC_PINMUX(736, FUNC4)>;
};

 

Thanks

在原帖中查看解决方案

0 项奖励
回复
8 回复数
3,010 次查看
GG0712
Contributor III

Hi NXP team,

 

I found these issue in S32G3_IOMUX 2.xlsx file

 

PC_04 PINMUX function "LIN Receive Data" SSS is 0000_0100, so it should be FUNC4

 

uart1_pins_grp2 {
	pinmux = <S32CC_PINMUX(736, FUNC4)>;
};

 

Thanks

0 项奖励
回复
2,992 次查看
carlos_o
NXP TechSupport
NXP TechSupport

Hi @GG0712,

As you say, the FUNCX is described at the S32G3_IOMUX 2.xlsx file attached at the Reference Manual (it needs to be open with Acrobat Reader to open the attached files). 

After changing this setting, is the UART working correctly?

Let me know if you face any other issue with this. 

0 项奖励
回复
2,978 次查看
GG0712
Contributor III

Hi NXP team,

 

Currently working correctly.

But how do I set the baud rate without using stty comand?

 

Note: ttyLF1 is internal UART instead of serial console

0 项奖励
回复
2,970 次查看
carlos_o
NXP TechSupport
NXP TechSupport

Hi @GG0712,

You can find that information at the BSP 42 User Manual at chapter 27.5 Changing UART baud rate.

carlos_o_0-1743196707967.png

carlos_o_1-1743196768388.png

carlos_o_2-1743197668929.png

 

 

0 项奖励
回复
2,941 次查看
GG0712
Contributor III

Hi @carlos_o ,

 

It looks like same as BSP 43 User Manual at chapter 29.6

My understanding is that this is to change the serial console and the baud rate of the default tty during the startup phase.

But my requirement is that the baud rate of ttyLF0 is 115200 and still serves as the serial console. The baud rate of ttyLF1 needs to be changed from the default 9600 to other values.

 

Thanks

0 项奖励
回复
2,934 次查看
carlos_o
NXP TechSupport
NXP TechSupport

Hi @GG0712,

You are right the documentation I shared is to change the baudrate for the UART used as console.

In this case the recommendation is to use the stty command to change to another standard baudrate. This because the serial driver used for the UART is the provided with linux. 

0 项奖励
回复
2,909 次查看
GG0712
Contributor III

Hi @carlos_o ,

 

I solved this issue and thanks for your support.

I modify Linux serial driver in "drivers/tty/serial/serial_core.c"

normal->init_termios.c_cflag = B921600 | CS8 | CREAD | HUPCL | CLOCAL;
normal->init_termios.c_ispeed = normal->init_termios.c_ospeed = 921600;

Now, the ttyLF1 and ttyLF2 default baud rate is 921600 and serial console baud rate is 115200

 

Below is my test log (I jump the ttyLF2 and connect it to USB to TTL dongle)

root@s32g399ardb3:~# stty -F /dev/ttyLF1
speed 921600 baud; line = 0;
-brkint -imaxbel
root@s32g399ardb3:~# echo "test" > /dev/ttyLF2
root@s32g399ardb3:~#
root@s32g399ardb3:~# cat /dev/ttyLF2
PC to GW

PC

PC:~$ stty -F /dev/ttyUSB1 921600 -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -icrnl -inlcr
PC:~$
PC:~$ cat /dev/ttyUSB1
test
^C
PC:~$
PC:~$ echo "PC to GW" > /dev/ttyUSB1

 

Thanks

2,894 次查看
carlos_o
NXP TechSupport
NXP TechSupport

Hi @GG0712,

Thanks for share your solution. 

 

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2069570%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32G3%20Linux%20BSP%2035%E5%A6%82%E4%BD%95%E5%90%AF%E7%94%A8ttyLF1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2069570%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%A5%BD%EF%BC%8CNXP%E5%9B%A2%E9%98%9F%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%88%91%E5%8F%82%E8%80%83%E4%BA%86%20S32G399ardb3%20%E5%B9%B6%E8%AE%BE%E8%AE%A1%E4%BA%86%E5%AE%9A%E5%88%B6%E6%9D%BF%E5%B9%B6%E4%BD%BF%E7%94%A8%20Linux%20BSP%2035%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%88%91%E4%BB%AC%E7%9A%84%3CFONT%20color%3D%22%23FF0000%22%3ES32G3%3C%2FFONT%3E%E5%AE%9A%E5%88%B6%E6%9D%BF%3CFONT%20color%3D%22%23FF0000%22%3E%E6%97%A0%E6%B3%95%E6%8E%A5%E6%94%B6PC%E7%9A%84UART%E6%95%B0%E6%8D%AE%3C%2FFONT%3E%EF%BC%8C%E4%BD%86PC%E5%8F%AF%E4%BB%A5%E6%8E%A5%E6%94%B6S32G3%E7%9A%84UART%E6%95%B0%E6%8D%AE%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%88%91%E4%BB%AC%E5%A6%82%E4%BD%95%E7%9F%A5%E9%81%93%20PINMUX%20FUNC%20X%20%E5%9C%A8%E8%AE%BE%E5%A4%87%E6%A0%91%E4%B8%AD%E4%BB%A3%E8%A1%A8%E4%BB%80%E4%B9%88%E5%8A%9F%E8%83%BD%EF%BC%9F%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E5%90%AF%E7%94%A8%20UART2%20%3CSPAN%3E%EF%BC%8C%E5%BA%94%E8%AF%A5%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AE%20PINMUX%20FUNC%20X%EF%BC%9F%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E4%B8%8B%E9%9D%A2%E6%98%AF%E6%88%91%E4%BB%AC%E7%9A%84%E8%AE%BE%E5%A4%87%E6%A0%91%EF%BC%88%E6%88%91%E6%8C%89%E7%85%A7BSP%2043%E8%BF%9B%E8%A1%8C%E4%BF%AE%E6%94%B9%EF%BC%89%3C%2FP%3E%3CPRE%20translate%3D%22no%22%3Euart1_pins%3A%20uart1_pins%20%7B%0A%09uart1_pins_grp0%20%7B%0A%09%09pinmux%20%3D%20%3CS32CC_PINMUX%3EFUNC2)%26gt%3B%3B%09%2F%2F%20PC_08%0A%09%09output-enable%3B%0A%09%09slew-rate%20%3D%20%3CS32CC_GPIO_SLEW_50MHZ%3E%3B%0A%09%7D%3B%0A%0A%09uart1_pins_grp1%20%7B%0A%09%09pinmux%20%3D%20%3CS32CC_PINMUX%3EFUNC0)%26gt%3B%3B%09%2F%2F%20PC_04%0A%09%09input-enable%3B%0A%09%09slew-rate%20%3D%20%3CS32CC_GPIO_SLEW_50MHZ%3E%3B%0A%09%7D%3B%0A%0A%09uart1_pins_grp2%20%7B%0A%09%09pinmux%20%3D%20%3CS32CC_PINMUX%3EFUNC2)%26gt%3B%3B%0A%09%7D%3B%0A%7D%3B%3CBR%20%2F%3E%0A%26amp%3Buart1%20%7B%0A%09pinctrl-0%20%3D%20%26lt%3B%26amp%3Buart1_pins%26gt%3B%3B%0A%09pinctrl-names%20%3D%20%22default%22%3B%0A%09status%20%3D%20%22okay%22%3B%0A%7D%3B%3C%2FS32CC_PINMUX%3E%3C%2FS32CC_GPIO_SLEW_50MHZ%3E%3C%2FS32CC_PINMUX%3E%3C%2FS32CC_GPIO_SLEW_50MHZ%3E%3C%2FS32CC_PINMUX%3E%3C%2FPRE%3E%3CP%3E%E6%88%91%E4%BD%BF%E7%94%A8S32G3%E4%B8%AD%E7%9A%84%E5%91%BD%E4%BB%A4%E5%8F%91%E9%80%81%E6%95%B0%E6%8D%AE%3C%2FP%3E%3CPRE%20translate%3D%22no%22%3Eecho%20%22Test%22%20%26gt%3B%20%2Fdev%2FttyLF1%3C%2FPRE%3E%3CP%3E%E6%88%91%E7%9A%84%E7%94%B5%E8%84%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4%E6%9D%A5%E6%8E%A5%E6%94%B6%E6%95%B0%E6%8D%AE%3C%2FP%3E%3CPRE%20translate%3D%22no%22%3Ecat%20%2Fdev%2FttyUSB1%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2070153%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20S32G3%20Linux%20BSP%2035%20%E5%A6%82%E4%BD%95%E5%90%AF%E7%94%A8ttyLF1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070153%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%A5%BD%EF%BC%8CNXP%E5%9B%A2%E9%98%9F%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E7%9B%AE%E5%89%8D%E5%B7%A5%E4%BD%9C%E6%AD%A3%E5%B8%B8%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%86%E6%98%AF%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%8D%E4%BD%BF%E7%94%A8%20stty%20%E5%91%BD%E4%BB%A4%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E8%AE%BE%E7%BD%AE%E6%B3%A2%E7%89%B9%E7%8E%87%EF%BC%9F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%B3%A8%E6%84%8F%EF%BC%9AttyLF1%20%E6%98%AF%E5%86%85%E9%83%A8%20UART%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E4%B8%B2%E8%A1%8C%E6%8E%A7%E5%88%B6%E5%8F%B0%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2069620%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%20S32G3%20Linux%20BSP%2035%20%E5%A6%82%E4%BD%95%E5%90%AF%E7%94%A8ttyLF1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2069620%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%A5%BD%EF%BC%8CNXP%E5%9B%A2%E9%98%9F%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%88%91%E5%9C%A8%3CFONT%20color%3D%22%23FF0000%22%3ES32G3_IOMUX%202.xlsx%3C%2FFONT%3E%3CFONT%20color%3D%22%23FF0000%22%3E%E6%96%87%E4%BB%B6%3C%2FFONT%3E%E4%B8%AD%E5%8F%91%E7%8E%B0%E4%BA%86%E8%BF%99%E4%BA%9B%E9%97%AE%E9%A2%98%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EPC_04%20PINMUX%E5%8A%9F%E8%83%BD%E2%80%9CLIN%E6%8E%A5%E6%94%B6%E6%95%B0%E6%8D%AE%E2%80%9DSSS%E4%B8%BA0000_0100%EF%BC%8C%E5%9B%A0%E6%AD%A4%E5%BA%94%E8%AF%A5%E6%98%AFFUNC4%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20translate%3D%22no%22%3Euart1_pins_grp2%20%7B%0A%09pinmux%20%3D%20%3CS32CC_PINMUX%3E%3CFONT%20color%3D%22%23000000%22%3EFUNC%3C%2FFONT%3E4)%26gt%3B%3B%0A%7D%3B%3C%2FS32CC_PINMUX%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3C%2FLINGO-BODY%3E