I2C communication between TCPC and TCPM in the Chromium EC project

129 views
Skip to first unread message

Shruthi

unread,
Aug 29, 2016, 9:00:41 AM8/29/16
to Chromium OS discuss
Hi,

I am working on USB power delivery project which needs to use the APIs available in the chromium EC project to set up an I2C communication between the TCPM and TCPC devices. I am using the STM32F072 board as TCPM (master) and STM32F051 board as TCPC (slave). I was able to find I2C APIs for the master in "/trunk/src/platform/ec/common/i2c.c" file, which has functions like "i2c_read8()", "i2c_write8()", etc. But I couldn't find similar APIs for the slave device. There is a function called "tcpc_i2c_process()" in "/trunk/src/platform/ec/common/usb_pd_tcpc.c", but it didn't seem to work when I used it.

Can anyone please tell me what APIs to use for an I2C communication in the chromium EC project? I also want to know the sequence of function calls to make to set up an I2C connection between the two boards.

Thank you,
Shruthi

David Hendricks

unread,
Sep 1, 2016, 2:16:08 PM9/1/16
to shruthi...@gmail.com, Chromium OS discuss
Hi Shruthi,
Were you able to find what you needed?

The TCPC-specific functions are defined in files in ec/driver/tcpm. The API is basically the tcpm_drv struct which is defined for each of the TCPMs.

For general I2C communications it seems you found i2c_read8(), i2c_write8(), etc. For TCPMs we generally use the wrappers defined in driver/tcpm/tcpm.h.


--
--
Chromium OS discuss mailing list: chromium-os-discuss@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Chromium OS discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-discuss+unsubscribe...@chromium.org.



--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.

Shruthi

unread,
Sep 1, 2016, 4:16:15 PM9/1/16
to Chromium OS discuss, shruthi...@gmail.com
Hi David,

Thanks for replying. I want to implement a policy for power delivery. The document for pdeval-stm32f072 says, "Please duplicate driver/tcpm/tcpci.c into driver/tcpm/##chip#name##.c. Then update the control logic through I2C there.". Does this mean I should implement the power delivery policy in this file (driver/tcpm/##chip#name##.c), by using the I2C APIs you suggested?

Or should I use these APIs from "board/glados_pd/" to communicate with TCPM?

Thank you for your time and awaiting your reply.

Regards,
Shruthi



On Thursday, September 1, 2016 at 8:16:08 PM UTC+2, David Hendricks wrote:
Hi Shruthi,
Were you able to find what you needed?

The TCPC-specific functions are defined in files in ec/driver/tcpm. The API is basically the tcpm_drv struct which is defined for each of the TCPMs.

For general I2C communications it seems you found i2c_read8(), i2c_write8(), etc. For TCPMs we generally use the wrappers defined in driver/tcpm/tcpm.h.

On Mon, Aug 29, 2016 at 6:00 AM, Shruthi <shruthi...@gmail.com> wrote:
Hi,

I am working on USB power delivery project which needs to use the APIs available in the chromium EC project to set up an I2C communication between the TCPM and TCPC devices. I am using the STM32F072 board as TCPM (master) and STM32F051 board as TCPC (slave). I was able to find I2C APIs for the master in "/trunk/src/platform/ec/common/i2c.c" file, which has functions like "i2c_read8()", "i2c_write8()", etc. But I couldn't find similar APIs for the slave device. There is a function called "tcpc_i2c_process()" in "/trunk/src/platform/ec/common/usb_pd_tcpc.c", but it didn't seem to work when I used it.

Can anyone please tell me what APIs to use for an I2C communication in the chromium EC project? I also want to know the sequence of function calls to make to set up an I2C connection between the two boards.

Thank you,
Shruthi

--
--
Chromium OS discuss mailing list: chromium-...@chromium.org

View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Chromium OS discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-os-discuss+unsub...@chromium.org.
Reply all
Reply to author
Forward
0 new messages