qkidamon
Posts: 5
Joined: Mon Mar 18, 2019 1:03 pm

Re: How to use 2 SC16IS752,I USE I2C

Wed Mar 20, 2019 12:48 pm

DougieLawson wrote:
Tue Mar 12, 2019 10:13 am
What's your wiring for pin A0 and pin A1 on each of your SC16IS752 chips. That's what defines the I2C address

A0=Vdd A1=Vdd gives a write address of 0x90 and a read address of 0x48.
A0=Vss A1=Vdd gives a write address of 0x98 and a read address of 0x4C.

Datasheet is here: https://www.nxp.com/docs/en/data-sheet/ ... 6IS762.pdf

As the next table from SC16IS752 & SC16IS762 datsheet shows:

Code: Select all

A1 A0 SC16IS752/SC16IS762 I2C address (hex)[1]
VDD VDD 0x90 (1001 000X)
VDD VSS 0x92 (1001 001X)
VDD SCL 0x94 (1001 010X)
VDD SDA 0x96 (1001 011X)
VSS VDD 0x98 (1001 100X)
VSS VSS 0x9A (1001 101X)
VSS SCL 0x9C (1001 110X)
VSS SDA 0x9E (1001 111X)
SCL VDD 0xA0 (1010 000X)
SCL VSS 0xA2 (1010 001X)
SCL SCL 0xA4 (1010 010X)
SCL SDA 0xA6 (1010 011X)
SDA VDD 0xA8 (1010 100X)
SDA VSS 0xAA (1010 101X)
SDA SCL 0xAC (1010 110X)
SDA SDA 0xAE (1010 111X)
Folowing this, read address 0x4C (write address 0x98) is set with A0 = VDD and A01 = VSS.

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Thu Mar 21, 2019 8:35 pm

Hello,

The current official Rasbian contains the kernel 4.14.79-V7+
and has the same issue: only ttySC0 and ttySC1 are available.

Is it possible to get the driver for this kernel version ?

Regards

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:01 pm

Hello again,
As far I understand, the problem is not solved yet. There is only debug drivers.
Am I right ?
Regards

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:06 pm

Correct - I am waiting for feedback from either of the users above, but so far I have had no reply. Are you in a position to run some tests soon?

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:14 pm

Yes, I'm ready
My kernel is now the latest: 4.14.98-v7+
I have 2 boards from Waveshare https://www.waveshare.com/serial-expansion-hat.htm
Last edited by PGTokheim on Fri Mar 22, 2019 2:26 pm, edited 1 time in total.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:25 pm

Great - try this module: https://drive.google.com/file/d/1nYNreN ... sp=sharing
Install it as above.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:29 pm

Apologies, @qkidamon - I see you have a screen shot now. "devm_clk_get -> -517" - the second instance isn't getting a clock.

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:31 pm

Here the result:
[email protected]:/lib/modules/4.14.98-v7+/kernel/drivers/tty/serial$ sudo insmod
sc16is7xx.ko
insmod: ERROR: could not insert module sc16is7xx.ko: Invalid parameters

As I just wrote, my kernel is now 4.14.98-v7+

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:34 pm

Please don't edit posts to add significant information - I don't get notifications about that. I'll have another build in a moment.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:41 pm

Try again - same download link.

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:43 pm

Here the result:
[email protected]:/lib/modules/4.14.98-v7+/kernel/drivers/tty/serial$ sudo insmod /mnt/pc/temp/sc16is7xx.ko
[email protected]:/lib/modules/4.14.98-v7+/kernel/drivers/tty/serial$ ls /dev/ttySC*
/dev/ttySC0 /dev/ttySC1

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:44 pm

And what does "dmesg -l err" report?

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:46 pm

[email protected]:~$ dmesg -l err
[ 3.689418] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43455-sdio.bin for chip 0x004345(17221) rev 0x000006
[ 3.793183] sc16is7xx 1-0049: Built with added debugging
[ 3.802917] sc16is7xx 1-0048: Built with added debugging
[ 3.802995] sc16is7xx 1-0048: devm_clk_get -> -517
[ 4.011932] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04
[ 4.012465] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 9.10.105 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2018-03-09 18:56:28
[ 18.302914] CIFS VFS: ioctl error in smb2_get_dfs_refer rc=-5
[email protected]:~$

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 2:48 pm

Code: Select all

[ 3.802995] sc16is7xx 1-0048: devm_clk_get -> -517
The same error as above. I'll read the driver a bit more in search of a clue.

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 3:10 pm

I removed physically the 2 modules Waveshare. I got exactly the same output.
I got also the 2 devices ttySC0 and ttySC1, but not ttySC2 and ttySC3.
So you can try without hardware to get ttySC0...ttySC3.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7124
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 3:53 pm

I think I had this when trying to run two HDMI to CSI2 bridge chips.
I suspect it's a conflict over the name of the clock as they are both sc16is752_clk.

I'm just trying to find my thread...
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7124
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 3:54 pm

6by9 wrote:
Fri Mar 22, 2019 3:53 pm
I think I had this when trying to run two HDMI to CSI2 bridge chips.
I suspect it's a conflict over the name of the clock as they are both sc16is752_clk.

I'm just trying to find my thread...
Found viewtopic.php?f=38&t=227354#p1395310
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 4:22 pm

Thanks, that confirmed my theory. In the absence of explicit clock names, the driver uses the node name as the name of the clock, leading to the clash. Unfortunately it ignores any "@xx" name suffix, stopping me from using the same disambiguation mechanism as the parent node (assigning to the "reg" property also renames the node). Fortunately it is possible to also treat the "addr" parameter as a string and assign it to the magic "name" property of the clock node, resulting in clocks called "0x48" and "0x4c".

Please download an updated overlay from here: https://drive.google.com/file/d/1oGdsJD ... sp=sharing

PGTokheim
Posts: 8
Joined: Thu Mar 21, 2019 8:18 pm

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 4:31 pm

[email protected]:~$ ls /dev/ttySC*
/dev/ttySC0 /dev/ttySC1 /dev/ttySC2 /dev/ttySC3

[email protected]:~$ dmesg -l err
[ 3.512076] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43455-sdio.bin for chip 0x004345(17221) rev 0x000006
[ 3.791856] sc16is7xx 1-0049: Built with added debugging
[ 3.797879] sc16is7xx 1-0048: Built with added debugging
[ 3.833748] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04

[email protected]:~$ echo xxxxx > /dev/ttySC0
[email protected]:~$ echo xxxxx > /dev/ttySC1
[email protected]:~$ echo xxxxx > /dev/ttySC2
[email protected]:~$ echo xxxxx > /dev/ttySC3

Transmit data on the 4 ports is OK.
I have to check the reception.

Can I keep the same interrupt int_pin=24 for the 2 modules or should the modules have different interrupt PIN ?

Regards (and thank you).

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 4:37 pm

Can I keep the same interrupt int_pin=24 for the 2 modules or should the modules have different interrupt PIN ?
No - the interrupt pins have to be unique, otherwise the debug module will log an error like this:

Code: Select all

[   10.392344] sc16is7xx 1-0048: devm_request_irq -> -16
(Error 16 is EBUSY)

I'll update the standard overlay with this fix, then look for other overlays with similar potential issues.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2302
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to use 2 SC16IS752,I USE I2C

Fri Mar 22, 2019 4:54 pm

This is now fixed in rpi-4.19.y, and will be in future firmware releases.

qkidamon
Posts: 5
Joined: Mon Mar 18, 2019 1:03 pm

Re: How to use 2 SC16IS752,I USE I2C

Sun Mar 24, 2019 12:16 pm

PhilE wrote:
Fri Mar 22, 2019 2:29 pm
Apologies, @qkidamon - I see you have a screen shot now. "devm_clk_get -> -517" - the second instance isn't getting a clock.
Thanks, but there is no need for apologies.

So many thanks for the super fast fix for current issue.

Miguel.

hnwangkg163
Posts: 19
Joined: Tue Sep 11, 2018 6:01 am

Re: How to use 2 SC16IS752,I USE I2C

Mon Mar 25, 2019 7:03 am

Code: Select all

sudo cp sc16is752-i2c.dtbo /lib/modules/4.14.50-v7+/kernel/drivers/tty/serial/
and add

Code: Select all

dtoverlay=sc16is752-i2c,int_pin=18,addr=0x4c
dtoverlay=sc16is752-i2c,int_pin=25,addr=0x48
sudo reboot

then:

Code: Select all

[email protected]:~ $ ls /dev/ttySC
ttySC0  ttySC1  
error:

Code: Select all

[email protected]:~ $ dmesg -l err
[    3.712372] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43455-sdio.bin for chip 0x004345(17221) rev 0x000006
[    3.978688] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04
[    3.979276] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 9.10.105 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2018-03-09 18:56:28 

Code: Select all

[email protected]:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- UU -- -- -- 4c -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   
I am using:
https://drive.google.com/file/d/1oGdsJD ... L_E2r/view

qkidamon
Posts: 5
Joined: Mon Mar 18, 2019 1:03 pm

Re: How to use 2 SC16IS752,I USE I2C

Mon Mar 25, 2019 7:39 am

hnwangkg163 wrote:
Mon Mar 25, 2019 7:03 am

Code: Select all

sudo cp sc16is752-i2c.dtbo /lib/modules/4.14.50-v7+/kernel/drivers/tty/serial/

Hi.

I think you should copy sc16is752-i2c.dtbo to "/boot/overlays/" not to "/lib/modules/4.14.50-v7+/kernel/drivers/tty/serial/".

At least it works for me that way.

Thanks.

hnwangkg163
Posts: 19
Joined: Tue Sep 11, 2018 6:01 am

Re: How to use 2 SC16IS752,I USE I2C

Mon Mar 25, 2019 7:54 am

cd /boot/overlays
ls -al
and find this:

Code: Select all

-rwxr-xr-x 1 root root  1356 Mar 25 15:46 sc16is752-i2c.dtbo
sudo reboot,but as same...

Code: Select all

[email protected]:/boot/overlays $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- UU -- -- -- 4c -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --     

Return to “Device Tree”