-
Notifications
You must be signed in to change notification settings - Fork 6
Embedded Controller (EC) COM Protocol
The Embedded Controller (EC) is responsible for the following roles:
- Standby power management
- Firewalling the WF200 wifi chip
- Charger IC management
- Gasgauge IC management
- USB power negotiation (e.g. DRP role setting)
- Gyro readings
- Backlight control
Its primary goals are a low power footprint, simplicity, and reliability.
The SoC talks to the EC using the COM bus. The COM bus is documented here https://ci.betrusted.io/betrusted-ec/doc/com.html. The main highlights are:
- SPI-like serial bus
- Fixed 16 bit transfer length
- Free-run clock, with packets defined by chip select
- 1280-entry, 16-bit wide FIFO (for 2560 bytes) in both Tx and Rx direction
-
hold
pin to indicate when Tx FIFO is empty (helps to synchronize reads) - Host strictly master the bus; thus like SPI, you can only have "write" and "exchange" operations (that is, a "read" consists of a dummy byte being sent to the EC in order to clock out the read data)
Transactions always start with a single 16-bit "verb" which defines the behavior of the remaining packets. Broadly speaking, write transactions to the EC consist of a verb that encodes a write, followed by the incoming data; read transactions consist of a verb that encodes a read, and then the host must monitor the hold
before attempting to exchange data with the EC to extract the read data.
The protocol also provisions a "reset" verb which drains all the FIFOs. The "reset" verb is meant to be used freely to re-sync the COM line to help work around any potential bugs or framing errors.
For the latest list of commands defined in the protocol, please refer to this file:
https://github.com/betrusted-io/com_rs/blob/main/src/lib.rs