cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1,161 Views
Registered: ‎09-13-2018

ZCU104 Petalinux I2C communication with external device

Greetings,

I use ZCU104 board and installed petalinux 2020.1 on ARM portion. I would like to make a connection through FMC connector with an external device which needs to be configured via I2C so that I need to enable I2C1 on kernel and learn how to do that. I have enabled I2C support on kernel ( petalinux-config -c kernel ) and left the rest of i2c settings (like multiplexer i2c chip support) default. According to schemetics I2C1 bus multiplexed with U34 whose address is 0x74. The thing that I am confused is how should I write C code to configure external device? Should I first send 0x74 address data then my slave's address data and then my slave's registers data? Also how can I read data from my slave since there exists a multiplexer on the bus lines?

Any help would be appreciated. 

Best regards,

Ömer Faruk Çetinkaya

 

0 Kudos
7 Replies
venui
Moderator
Moderator
1,094 Views
Registered: ‎04-09-2019

Hi,

By default the PS_I2C1 is connected to U34 with address 0x74 will help you to communicate with the peripherals connected to MUX channels.

Since you are using FMC card are you sure that there is connectivity b/w MUX and FMC card i don`t think so if yes please let me know the details. Once the hardware connectivity is cleared we can move forward to work.

Regards,

Venu

0 Kudos
1,086 Views
Registered: ‎09-13-2018

Dear Venu, 

Thank you very much for your response. Please find attached user guide doc's I2C1 related pages (UG1267 pg. 50-51). According to document I2C1 bus connected directly to the mux. If I am wrong please correct me.

Best regards,

Ömer Faruk Çetinkaya 

i2c1_2.png
i2c1.png
0 Kudos
venui
Moderator
Moderator
1,073 Views
Registered: ‎04-09-2019

So you are going to access the FMC channel SD5/SC5 from U34 am i correct?

0 Kudos
1,030 Views
Registered: ‎09-13-2018

Dear Venui, 

Yes, it seems like that. Im going to connect an external sensor from FMC connector so that I connect that sensor directly to U34, right? So how can I implement the bus now? How do I get data from this external sensor while U34 exists on the bus line. I am a bit confused.

Best regards,

Ömer Faruk Çetinkaya

0 Kudos
venui
Moderator
Moderator
1,019 Views
Registered: ‎04-09-2019

Hi,

First you have to enable the channel SD5/SC5 in U34 MUX then once the channel is enabled then the path b/w the controller and external sensor is clear. User can communicate with salve device for read write applications.

Regards,

Venu

0 Kudos
1,012 Views
Registered: ‎09-13-2018

Hi Venu,

Could you please tell me how to enable channel SD5/SC5? 

Best regards,

Ömer Faruk Çetinkaya

0 Kudos
venui
Moderator
Moderator
1,001 Views
Registered: ‎04-09-2019

Hi,

Please find the command used for i2c transactions from linux using i2c-tools

https://manpages.debian.org/unstable/i2c-tools/i2ctransfer.8.en.html

Read the data sheet of MUX to get an idea regarding i2c address and channel info

https://datasheet.octopart.com/TCA9548APWR-Texas-Instruments-datasheet-17022518.pdf

 i2ctransfer -f -y 1 w2@0x74 0x00 0x20

Regards,

Venu

0 Kudos