Sc16is750-i2c drivers

Hi,
I am trying to use this chip sc16is750 with Radxa Zero. The device is detected by Radxa. nº 48

sudo mraa-i2c detect 1

00: – -- – -- – -- – -- – -- – -- – -- – --

10: – -- – -- – -- – -- – -- – -- – -- – --

20: – -- 22 – -- – -- – -- – -- – -- – -- –

30: – -- – -- – -- – -- – -- – -- – -- – --

40: 40 – -- – -- – -- – 48 – -- – -- – -- –

50: – -- – -- – -- – -- – -- – -- – -- – --

60: – -- – -- – -- – -- – -- – -- – -- – --

70: 70 – -- – -- – -- – -- – -- – -- – -- –

Do you have a driver for this chip?
In RPI is very easy to make it work with a few lines in the /boot/config.txt

Overlay for the NXP SC16IS750 UART with I2C Interface

Enables the chip on I2C1 at 0x48. To select another address,

please refer to table 10 in reference manual.

dtoverlay=sc16is750-i2c,int_pin=4,addr=0x48
dtparam=i2c_arm=on,i2c_arm_baudrate=400000

1 Like

For driver we have sc16is7xx built as a module, and you can load with modprobe sc16is7xx.

However, what you were talking about is to have device detected in the system. Device tree overlay is one way which we don’t have yet. Another way is to use sysfs. You can try the following command:

# echo sc16is7xx 0x48 > /sys/bus/i2c/devices/i2c-1/new_device

Hi, Thank you for your response. That comand does not works because that folder does not exit.

goldelox@radxa-zero:/sys/bus/i2c/devices$ sudo mraa-i2c detect 1
00: – -- – -- – -- – -- – -- – -- – -- – --
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- 22 – -- – -- – -- – -- – -- – -- –
30: – -- – -- – -- – -- – -- – -- – -- – --
40: 40 – -- – -- – -- – 48 – -- – -- – -- –
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: 70 – -- – -- – -- – -- – -- – -- – -- –
goldelox@radxa-zero:/sys/bus/i2c/devices$ sudo mraa-i2c detect 0
goldelox@radxa-zero:/sys/bus/i2c/devices$ sudo mraa-i2c detect 3
goldelox@radxa-zero:/sys/bus/i2c/devices$ ls
i2c-3 i2c-5
goldelox@radxa-zero:/sys/bus/i2c/devices$ ls /dev
autofs fuse log mmcblk1p2 rfkill tty11 tty24 tty37 tty5 tty62 uhid vcs8 vcsu4
block gpiochip0 loop-control mmcblk2 rtc tty12 tty25 tty38 tty50 tty63 uinput vcsa vcsu5
btrfs-control gpiochip1 loop0 mmcblk2boot0 rtc0 tty13 tty26 tty39 tty51 tty7 uleds vcsa1 vcsu6
bus hidraw0 loop1 mmcblk2boot1 shm tty14 tty27 tty4 tty52 tty8 urandom vcsa2 vcsu7
char hidraw1 loop2 mmcblk2rpmb snapshot tty15 tty28 tty40 tty53 tty9 usb-ffs vcsa3 vcsu8
console hugepages loop3 mqueue snd tty16 tty29 tty41 tty54 ttyAML0 v4l vcsa4 vfio
cpu_dma_latency hwrng loop4 net spidev1.0 tty17 tty3 tty42 tty55 ttyS0 vcs vcsa5 vga_arbiter
cuse i2c-3 loop5 null stderr tty18 tty30 tty43 tty56 ttyS1 vcs1 vcsa6 vhci
disk i2c-5 loop6 port stdin tty19 tty31 tty44 tty57 ttyS2 vcs2 vcsa7 vhost-net
dri iio:device0 loop7 ppp stdout tty2 tty32 tty45 tty58 ttyS3 vcs3 vcsa8 video0
ecryptfs initctl mapper psaux tty tty20 tty33 tty46 tty59 ttyS4 vcs4 vcsu zero
fb0 input mem ptmx tty0 tty21 tty34 tty47 tty6 ttyS5 vcs5 vcsu1
fd kmsg mmcblk1 pts tty1 tty22 tty35 tty48 tty60 ttyS6 vcs6 vcsu2
full kvm mmcblk1p1 random tty10 tty23 tty36 tty49 tty61 ttyS7 vcs7 vcsu3

As you can see i have i2c-3 i2c-5. Which one is the port 1?

Hello,
I have try:
sudo su
echo sc16is7xx 0x48 > /sys/bus/i2c/devices/i2c-3/new_device
Because I have connected two I2c devices to this port B2C_EE_M3 (/dev/i2c-3), but nothings happens after reboot. Furthermore, ‘new_device’ is a file that I can no see with ‘cat’.

Is ‘sudo mraa-i2c detect 1’ detecting i2c-3?

I have seen the port iio:device0 in /dev.
Is this port created after echo sc16is7xx 0x48 > /sys/bus/i2c/devices/i2c-3/new_device ?

I have seen : alias i2c:sc16is740 sc16is7xx
in /lib/modules/5.10.69-10-amlogic-g617a45dd0fce

How Can I load this module?

I have try:
sudo su
modprobe sc16is7xx

But I do not see changes

Run this command as root and you should have device and driver loaded by kernel.

Hi,
Thank you for your reply.
I have writen in: /etc/modules-load.d/module_name.conf , this: sc16is7xx .
Also, in console I have writen: sudo modprobe sc16is7xx int_pin=4 addr=0x48
the port i2c-1 does not exit so, I have write: sudo echo sc16is7xx 0x48 > /sys/bus/i2c/devices/i2c-3/new_device
After reboot, I see iio:device0
But ttyCS0 is not loaded
the command lsmod shows:
sc16is7xx 28672 0





nobody knows how to install drivers in linux?

If your overlay is meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7 i2c-3 should be your bus.

You cannot use sudo with redirection since redirection is done. Either do it in a root shell like what I wrote, or try echo sc16is7xx 0x48 | sudo tee /sys/bus/i2c/devices/i2c-3/new_device.

Don’t reboot. Sysfs config won’t persist between boot. After running the above command check if you have the required serial port. If so you can create a cron job or systemd unit to run the command on boot.

1 Like

Thank you very much for you reply.
However, the ttySC0 is not loaded
goldelox@radxa-zero:~$ sudo su
root@radxa-zero:/home/goldelox# echo sc16is7xx 0x48 > /sys/bus/i2c/devices/i2c-3 /new_device
bash: echo: write error: Device or resource busy

root@radxa-zero:/home/goldelox# cd /sys/bus/i2c/devices/i2c-3/
root@radxa-zero:/sys/bus/i2c/devices/i2c-3# ls
3-0048 delete_device device i2c-dev name new_device of_node power subsystem uevent

root@radxa-zero:/sys/bus/i2c/devices/i2c-3/3-0048# ls
modalias name power subsystem uevent
root@radxa-zero:/sys/bus/i2c/devices/i2c-3/3-0048# cat modalias
i2c:sc16is7xx

So, I believe that I am missing some steps

Seems like there is an extra space between i2c-3 and /new_device when you do the first echo.

Perhaps I wrote here the sentence bad. I repeated the operation and the same result

More info:
root@radxa-zero:/usr/lib/modules/5.10.69-10-amlogic-g617a45dd0fce/kernel/drivers/tty/serial# ls
altera_jtaguart.ko arc_uart.ko fsl_linflexuart.ko jsm sc16is7xx.ko sprd_serial.ko
altera_uart.ko digicolor-usart.ko fsl_lpuart.ko rp2.ko sifive.ko

Try messing around under /sys/bus/i2c/devices and check your connection. You might connect it to a different bus. The reason you get bash: echo: write error: Device or resource busy is because you already add the device at that address (which is why you have 3-0048 folder). Reboot your board and try echo new_device again, then check dmesg to see if there is any error message related to the device.

[ 249.693870] i2c i2c-3: new_device: Missing parameters
[ 262.309987] i2c i2c-3: new_device: Missing parameters
[ 281.541123] i2c i2c-3: new_device: Instantiated device sc16is7xx at 0x48

Maybe I have to tell the driver: addr=0x48 int_pin=4
however the following gives: bash: echo: write error: Invalid argument

params=“sc16is7xx addr=0x48 int_pin=4”
echo ${params} > /sys/bus/i2c/devices/i2c-3/new_device

sudo cat /proc/tty/drivers

/dev/tty /dev/tty 5 0 system:/dev/tty

/dev/console /dev/console 5 1 system:console

/dev/ptmx /dev/ptmx 5 2 system

/dev/vc/0 /dev/vc/0 4 0 system:vtmaster

usbserial /dev/ttyUSB 188 0-511 serial

g_serial /dev/ttyGS 242 0-7 serial

unknown /dev/ttySC 243 0-7 serial

serial /dev/ttyS 4 64-71 serial

pty_slave /dev/pts 136 0-1048575 pty:slave

pty_master /dev/ptm 128 0-1048575 pty:master

unknown /dev/tty 4 1-63 console