Trenz Electronic GmbH Support Forum

Trenz Electronic Products => Trenz Electronic FPGA Modules => Topic started by: bigguiness on December 21, 2022, 07:48:46 PM

Title: TE0720 I2C interface
Post by: bigguiness on December 21, 2022, 07:48:46 PM
Hello,

I have a TE0720 board on a custom carrier board. I'm trying to test the I2C interface and have some confusion.

Currently I'm using a prebuilt binary but I'm not sure what one:

# cat /etc/issue
PetaLinux 2021.2 \n \l
# uname -a
Linux petalinux 5.10.0-xilinx-v2021.2 #1 SMP PREEMPT Tue Oct 12 09:30:57 UTC 2021 armv7l GNU/Linux


The i2cdetect utility shows:
# i2cdetect -l
i2c-1   i2c             Cadence I2C at e0005000                 I2C adapter
i2c-0   i2c             Cadence I2C at e0004000                 I2C adapter
# i2cdetect 0
Warning: Can't use SMBus Quick Write command, will skip some addresses
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
# i2cdetect 1
Warning: Can't use SMBus Quick Write command, will skip some addresses
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60:
70:


What are these detected devices? The only I2C device I find on the TE0720 board is the ISL12020 RTC which should be at address 6F. The I2C pins are also on the U19 CPLD but I don't know what it's using them for.

The ISL12020 appears to be discovered during the boot:
~# dmesg | grep i2c
[    2.112827] i2c /dev entries driver
[    2.115649] cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 30
[    2.133237] cdns-i2c e0005000.i2c: 400 kHz mmio e0005000 irq 31
root@petalinux:~# dmesg | grep rtc
[    2.122059] rtc-isl12022 1-006f: registered as rtc0
[    2.125988] rtc-isl12022 1-006f: setting system clock to 2000-01-01T00:00:00 UTC (946684800)
[    7.089649] rtc-isl12022 1-006f: init write enable and 24 hour format


Or is this device only showing up during the boot because of the device tree?

On my carrier board I have a number of I2C devices connected to the MIO10 (SCL) and MIO11 (SDA) pins. Do I need to modify the Vivado design for that I2C bus to be enabled and the devices on the carrier board to be found?

The I2C devices that I expected to detect on my carrier board are:
  20  LTC1669 DAC
  48  LM75 Temperature Sensor
  49  LM75 Temperature Sensor
  51  512Kb EEPROM
  71  PCA9685 PWM

Thanks
Title: Re: TE0720 I2C interface
Post by: JH on January 04, 2023, 07:39:22 AM
Hi,
I2C0 controller (MIO10/11) goes direct to B2B connector, so it' something on your carrier what you see there.
I2C1 controller goes over PL to CPLD.
You should see normally RTC there as UU(it's a little bit strange that you did see it with I2C detect but it was detected by drivers...UU means address is used by drivers...not more) and I2C slave inside the CPLD, see:
https://wiki.trenz-electronic.de/display/PD/TE0720+CPLD#TE0720CPLD-I2CtoGPIOblock

can you try out this command options one time:
i2cdetect -y -r 0 
i2cdetect -y -r 1
You should see full matrix in this case.
br
John

br
John
Title: Re: TE0720 I2C interface
Post by: bigguiness on January 04, 2023, 11:54:32 PM
Hi John,

Still have not figured out how to get I2C bus 0 to work in Linux. But I have been able to scan the two busses in U-Boot (I added the <- comments to identify the known devices):


Zynq> i2c bus
Bus 0:  i2c@e0004000
Bus 1:  i2c@e0005000
Zynq> i2c dev 0
Setting bus to 0
Zynq> i2c probe
Valid chip addresses: 00 20 48 49 51 70 71 7E
Zynq> i2c dev 1
Setting bus to 1
Zynq> i2c probe
Valid chip addresses: 20 21 57 6F
Zynq> i2c bus
Bus 0:  i2c@e0004000  (active 0)
   00: generic_0, offset len 1, flags 0     <- ? (this address should be reserved I think)
   20: generic_20, offset len 1, flags 0    <- LTC1669 DAC
   48: generic_48, offset len 1, flags 0    <- LM75 Temperature Sensor
   49: generic_49, offset len 1, flags 0    <- LM75 Temperature Sensor
   51: generic_51, offset len 1, flags 0    <- 512Kb EEPROM
   70: generic_70, offset len 1, flags 0    <- ? (no device on my carrier at this address, possible problem with the PCA9685 address lines?)
   71: generic_71, offset len 1, flags 0    <- PCA9685 PWM
   7e: generic_7e, offset len 1, flags 0    <- ? (no device on my carrier at this address, possible problem with the PCA9685 address lines?)
Bus 1:  i2c@e0005000  (active 1)
   20: generic_20, offset len 1, flags 0    <- CPLD - I2C to GPIO block
   21: generic_21, offset len 1, flags 0    <- ? (is this part of the slave inside the CPLD?)
   57: generic_57, offset len 1, flags 0    <- ISL12020 RTC
   6f: generic_6f, offset len 1, flags 0    <- ISL12020 Battery Backed Registers


Do the Bus 1 devices look correct?

Do you have any comments on the "?" devices on both busses?

Thanks,
Hartley
Title: Re: TE0720 I2C interface
Post by: bigguiness on January 05, 2023, 12:12:32 AM
Update...

Address 7E is the "SYNC Address" for the LTC1669.

It appears the PCA9685 responds to address 00 writes. This causes a Software Reset of the device.

Address 70 appears to also be associated with the PCA9685. It's a "LED All Call" address used to program all PCA9685 devices on the bus at the same time.

Looks like all the devices on my carrier board are working, at least from U-Boot.

Hartley
Title: Re: TE0720 I2C interface
Post by: bigguiness on January 05, 2023, 12:31:59 AM
BTW, is there a PDF (or cleaner, printable) version of the TE0720 CPLD information?

Thanks
Title: Re: TE0720 I2C interface
Post by: JH on January 05, 2023, 06:54:33 AM
Hi,
I've add a PDF export to the attachment.
br
John