2016年4月19日 星期二

USB Type-C Port Controller


USB Org defined the Port Controller and its architecture in Oct 2015. The Type-C
port Manager is moved out from PD controller.  The MCU or EC(embeded
controller) can be the Type-C port Manager, it can control many Type-C Port
Controllers by I2C at the same time.


The TCPM (Type-C Port Manger) is used to decide these Type-C PD port function
and behavior, The TCPC (Type-C Port Controller) is passive and is used for Type-C
logic and PD data transceiver. Many registers are defined in TCPC spec, the TCPM
can read /write these register to get status of Type-C port and control TCPC.


The following are how the TCPM and TCPC finish the Type-C connection and 
VBUS 5V to HighVoltage transition.  

DRP Type-C port initialize and CC connection.



1. Before the connection. TCPC set TCPC to be DRP.
Write ROLE_CONTROLROLE_CONTROL.DRP = 1b ;TCPM set TCPC to be DRP. 
ROLE_CONTROL.CC2=01b or 10b ;set initial status of CC1 and CC2 to be Rp or Rd.
ROLE_CONTROL.CC1=01b or 10b  
ROLE_CONTROL.CC1=ROLE_CONTROL.CC2
POWER_CONTROL.AutoDischargeDisconnect=0 ;set no autodischarge when CC Disconnect.
Write COMMAND.Look4Connection TCPM wrote Look4Connection to TCPC to ask TCPC start to detect connection according to Role_Control register setting and toggle Rp/Rd.
Set CC_STATUS.Looking4Connection=1b ;After TCPC received Look4Connection command, the TCPC register CC_STATUS.Looking4Connection would be "1b". And then TCPC start to toggling the CC.

2. After the connection.
Potential_Connect_as_Source ; When TCPC to be Source
Either CC line = Src.Rd or both CC lines = Src.Ra ; if  One of the CC pin voltage is vRd or both CC pin voltage are vRa.
for >tTCPCFilter  ;Debounce time(4~500us)
Set Source Status
CC_STATUS.Looking4Connnection=0b ;TCPC stop to detect connection.
CC_STATUS.ConnectResult=0b ; TCPC set this CC pin is to be Rp.


Potential_Connect_as_Sink ;When TCPC to be Sink
Either CC line != Snk.Open ;if  One of the CC pin voltage >vRa. 
for >tTCPCFilter  ;Debounce time(4~500us)
CC_STATUS.Looking4Connection=0b ;TCPC stop to detect connection.
CC_STATUS.ConnectResult=1b  ;TCPC set CC to be Rd.

3. TCPC alert the TCPM 
TCPC Set ALERT.CcStatus=1b   ;TCPC Alert register's b0 =>CC status=1 mean the status of CC has been changed.
TCPM read ALERT      ;TCPM detect Alert and then read the Alert register
TCPM check if "ALERT.CcStatus=1b?" ;check if the status of CC have been changed
Yes=>TCPM check if "C_STATUS.Looking4Connection=0 ?" ; If yes, check if TCPC stop to detect connection. If yes, enter debounce time.
Read CC_STATUSDebounce for tCCDebounce  ;Debounce time (100ms~200ms)
Write ROLE_CONTROL.CC1 & CC2 per decision ;TCPM set TCPC's Role_control register CC1 or CC2 to be Ra,Rd or Rp.
Write TCPC_CONTROl.PlugOrientation  ;TCPM set PlugOrientation of TCPC_control register to be CC1 or CC2. 
Write POWER_CONTROL.AutoDischargeDisconnect=1 & POWER_CONTROL.EnableVconnConnection
;TCPM enable TCPC VBUS Autodischarge, The TCPC would discharge VBUS when the VBUS was under vSafe0V(max) or VBUS_STOP_Discharge_Threshold. TCPM set TCPC to output VCONN if one of CC is Ra.
Write Alert.CcStatus=0b ;Clear the CcStatus of Alert register.

4.Connection Established, TCPM monitor the Alert signal




Support USB PD and change the VBUS voltage.



1. Currently the TCPC is output VBUS 5V
Sourcing 5V over VBUS ;VBUS output 5V
POWER_STATUS.SourcingVBUS=1  ;the status SourcingVBUS=1 mean this TCPC output VBUS 5V now.
POWER_STATUS.SourcingHighVoltage=0  ;the SourcingHighVoltage=0 mean the VBUS is 5V not high voltage now. 

2. After TCPM accepted the request from far end Sink side for High voltage VBUS. TCPM would send Vendor Defined command to set the target voltage of HighVoltage. 

3.Write command.SourceVbusHighVoltage ;TCPM write SourceVbusHighVoltage to command register 

4.After TCPC received the SourceVbusHighVoltage, TCPC change the VBUS from 5V to HighVoltage.And then..
 TCPC set POWER_STATUS.SourcingHighVoltage=1  ;TCPC set register Power_Status SourcingHighVoltage bit to be "1b"。
 TCPC set ALERT.PowerStatus     ;TCPC set register Alert Power status bit to be "1b".

5.TCPM read alert register and recognize the TCPC has finished the HighVoltage VBUS transition.




1.USB 3.1 spec http://www.usb.org/developers/docs/

6 則留言:

enemy 提到...

hi
在pd 3.0新增authentication。
1.請問如果驗證沒過的話,能不能傳資料?還是只會限制不能跑pd?
原本的5V/3A應該還是可以跑吧?
2.如果pd 2.0與3.0互接,那2.0會驗證不過,也能跑5V/3A嗎?

謝謝

KevinZheng USB&DSP&Firmware 提到...

Hi Enemy
1. Authentication認證機制,是讓Type-C連接的兩個裝置可以相互辨識,
至於辨識有過跟沒過,要做什麼行為,應該是裝置的製造商自行去定義吧。
2.驗証不過,要看製造商希望要有什麼樣的行為來保護。也可以定義成
只供電,不傳data。或是只供5V,不供5V以上的電壓。

Cc 提到...

Hi Zheng Kevin,

觀看spec後遇到一些問題,想請教一下。

1. 想要切高電壓的話,似乎必須先使用vendor define command通訊切何種電壓,
再下command要求提高High5V,如此是否代表TCPC已經無法通用所有的TCPM?
無法由TCPM控制外部Power至想要的電壓嗎?

2. PD的spec對power的監控頗為複雜,有時候要求4.75以上,有時要求判斷高電壓,有時要求0.8V以下,
但是TCPC沒有辦法應付這麼多的需求,只能從VBUS_VOLTAGE得知目前的電壓,但此選項又是Optional,
擔心會遇到不支援的TCPC,請問要如何處理?可以由TCPM自行監控VBUS嗎?

麻煩指導,謝謝!

KevinZheng USB&DSP&Firmware 提到...

Hi Chark

1.每個裝置的電源系統不同,各家TCPC控制電源輸出的方式不同,也有的TCPC不能控制
電源,這部分TCTC的spec並沒有去定義。所以TCPM才需要用各家自行定義的command
來控制電源。在TCPC spec裡,寫到80~FF暫存器位址是留給各家TCPC vendor去定義。

2.VBUS_Voltage是將VBUS電壓由類比轉成數位,放在暫存器裡。這個功能並不是必需的。
TCPC內部的類比比較器自然會去偵則VBUS電壓是否異常。可以請參考TCPC SPEC
"3.1 Port Power Control for VBUS and VCONN",這是require。

Cc 提到...

Hi Zheng Kevin,

感謝你的回答,但仍有些許問題,謝謝!

1. 根據你的回覆,TCPC看起來必須綁定TCPM,無法做到同一份TCPM可以吃所有的TCPC。
因為各家的Vendor define都不一樣,所以如果換TCPC,必須修改TCPM。
看起來跟最初始希望可以任意更換不同IC的出發點似乎不一樣

2. 3.1 Port Power Control for VBUS and VCONN之前有研究,但是不管是Voltage High/low alarm都是Option,如果遇到不支援的TCPC就無法使用。

由於PD流程大多需要得知是否Safe0V以下,或是是否4.75V以上或以下,那要如何動態得知是否?
目前找不到回報VBUS 0V以下的reg,只有VBUS present能代表是否safe5V以下。

KevinZheng USB&DSP&Firmware 提到...

Hi Chark
1.TCPC的Spec裡,有option的項目,就會產生差異。另外這也表示,USB制定者認為
這不是TCPC必要的功能,就要看你們的產品需不需要這個功能。例如你們需要有個
option項目,你們可以找有含這個功能的TCPC,或是由TCPM來做。TCPC不是完全
標準化的東西,你可以去Google各家出的TCPC IC。

2.ALERT Register、POWER_CONTROL和POWER_STATUS都是Required。

你可以看TCPC spec內的TCPM與TCPC在各種工作項目的流程圖,在上面TCPC要做的事
,需要的功能與暫存器,應該都是required。