SC16IS752 SPI to UART on Orin nx,L4T 35.3.1

Hi all,
We used SC16IS752(SPI to UART) on a custom board, and encountered some problems in the load driver project. sc16is7xx.ko has been loaded successfully, but ttySC0 and ttySC1 are not visible under /dev. I hope to get your help.
Thanks.
log.txt (72.2 KB)
sc16is7xx.c.txt (44.9 KB)
tegra234-p3768-0000-a0.dtsi.txt (8.6 KB)

Hi sjz_shaohua,

Are you using the devkit or custom board for Orin NX?

Have you verified SPI loopback test before using your module?

Do you get the porting guide from your vendor?

It seems the ttySC1 has been registered.

[  115.043836] serial serial1: tty port ttySC1 registered

Hi KevinFFF,
we using custom board for orin nx. And ttySC0 and ttySC1 are not in the /dev directory. SPI loopback test is ok, I have contacted the vendor. But they don’t have any information for me.
For sc16is7xx.c, I using sc16is7xx.c in the official source code of NVIDIA, and the vendor did not give sc16is7xx.c file
My operation is:

  1. sudo modprobe spidev
  2. sudo insmod sc16is7xx.ko

Is this procedure correct.

Did you build your driver as a loadable kernel module(=m) or build it inside kernel image(=y)?

It seems you have duplicate node for SPI1 with CS0.

		spi@0 {          //zhangshaohua11
			status = "okay";
			#address-cells = <1>;
			#size-cells = <1>;
			compatible = "nxp,sc16is752";
			reg = <0x0>;
			spi-max-frequency = <4000000>;
			clocks = <&sc16is752_clk1>;
			interrupt-parent = <&tegra_main_gpio>;
			interrupts = <TEGRA234_MAIN_GPIO(Q, 6) IRQ_TYPE_LEVEL_LOW>;
			//interrupts = <TEGRA234_AON_GPIO(CC, 3) GPIO_ACTIVE_LOW>;
			//interrupts = <TEGRA234_AON_GPIO(CC, 3) 0>;
			gpio-controller;
			#gpio-cells = <2>;
			sc16is752_clk1: sc16is752_clk2 {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <1843200>;
			};
		};

		..

		spi@0 { /* chip select 0 */
			status = "disabled";   //zhangshaohua
			compatible = "tegra-spidev";
			reg = <0x0>;
			spi-max-frequency = <50000000>;
			controller-data {
				nvidia,enable-hw-based-cs;
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x0>;
			};
		};

Maybe you could try to remove the 2nd one and just load your SC16IS752 driver.

$ sudo modprobe sc16is7xx

Hi, KevinFF
Thank you for your reply. I added the following two files in configs/tegra defconfig.
CONFIG_SERIAL_SC16IS7XX_CORE=y
CONFIG_SERIAL_SC16IS7XX=y

I also re-modified my dts file.


I would like to ask if the CS0 pin of SPI1 is correct after the modification of dts file?
I recompiled and refreshed, but after executing sudo modprobe sc16is7xx, I got an error message

It seems you built them into kernel image so that they should be loaded during boot up automatically.
Please check the loaded kernel module with lsmod and also the dmesg to check if it is probed successfully.

Hi,KevinFF
I succeeded to get ttySC0 and ttySC1, but when I sent data to these two serial ports, the following error message appeared.

I am eager for your help.Thanks.

Have you confirmed if your driver is loaded and probed correctly?

It seems the errors reporting from your 3rd-party driver(sc16is7xx) and we don’t have this module to verify and debug further.
I would suggest you requesting the help from your vendor.
Maybe you should open/configure the UART interface(ttySC0 and ttySC1) like baudrate, parity , stopBits, flags…etc before use.
Or you can add more debug message in the driver to check what causes the errors.

Hi,KevinFF
Thank you very much for your support. I will add some debug message and check it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.