Showing posts with label Code. Show all posts
Showing posts with label Code. Show all posts

9.12.2008

Fix the following problems by 9/19

 

Problems:

1. USB's Hi Speed is not passed in eye diag.

2. current to battery is not enough.

3. D+ signal is wrong action. D+ should be low(0V) before and after connecting PC.

 

 





JOB STATUS:

* understand USB client's code architecture -> trace the USB device initial

* need complete environment to trace code -> wait PinHu for EVT1.2 board

* 3319Vendor said i have to put 50 to 04 register.. follow the table 5.1

9/12* Understand USB OTG -> what's status D+/D- ?

 

* confirm 3319 can be a switcher to change D+/D- line

    when RESETB=0(low active) and V1.8 = on... the 3319 is a switch. D+/D- -> SPKR_R/M / SPKR_L

*9/22

the cable cannot be longer than 2 M between device(client) to PC(Host) while testing Eye Diagnostic.

-> I added the code that makes a bigger eye, but it's still fail.

-> test active syc is ok?t

-> Check in code





 

3319

* Pin VDD3.3 should bypass a 2.2uF capacitor -> de capacitor is bigger than 2.2u which is okay.

* NXT[P->L]: indicates when the current byte has been accepted by the PHY.

* DIR[P->L]: Hi-> PHY to Link, Lo-> Link to PHY. Hi-> PHY cannot accept data from Link

* STP[L->P]: one clock cycle to stop the data stream

* CLKOUT[P->L]: 60MHz, ULPI signals are driven synchronous to the rising edge of this clock.

* VDD1.8: shoulde bypass 0.1uF

* GPIO9_2 to reset 3319d

* QUAL_SEL AND SUB_SEL??

 

* ULPI TxdCMD: sent command to 3319

 

* RxCMD:






Code present:

*ZyUSBOTG_ULPI:Init @(platformzylonite_mhlvsrcdriversotg_ulpiusbotg_ulpi.cpp)

    OTGCable, USBCLK, BUSMonitor 都繼承 ZyUSBOTG_ULPI

 

*UfnPdd_init()WINAPI @(platformcommonsrcsocpxa310_mvl_v1usb20fn.Usb20fn.cpp)

    CreateUSB20Device @(platformzylonite_mhlvsrcdriversusb20fnZylonite_usb20fn.cpp)

 


* what is status before plug in cable, and after?

* how is it programmed in code?

* every status maps to what signaling?

Set OTG status flow:
UfnMdd_Start() @publiccommonoakdriversusbfncontrollermddUfnmdd.cpp ->

USBOTG::IOControl(IOCTL_BUS_USBOTG_USBFN_ACTIVE) @publiccommonoakdriversusbotgmddUsbotg.cpp ->

USBOTG::OTGUSBFNNotfyActive() @publiccommonoakdriversusbotgmddUsbotg.cpp ->

USBOTG::EventNotficication() @publiccommonoakdriversusbotgmddUsbotg.cpp ->

USBOTG::EnterState() @publiccommonoakdriversusbotgmddUsbotg.cpp ->
ZyUSBOTG_ULPI::NewStateAction() @platformzylonite_mhlvsrdriverotg_upliUsbotg_lupi.cpp





SPEC
*what's Device A&B? -> A = Host, need to offer Vbus , B = peripheral


*Device detection:  D+ and D- signals have 15Kohm pull-down resistors at port end (hub end), FS devices have 1.5Kohm pull-up resistor on D+ (no resistor on D-), LS devices have 1.5Kohm pull-up resistor on D- (no resistor on D+) HS devices have 45ohm pull-down resistor on both D+ and D-.
No device attached:  D+ and D- float to 0V if not driven 

FS device attached:  D+ floats to 4.54V and D- floats to 0V if not driven


LS device attached:  D+ floats to 0V and D- floats to 4.54V if not driven




*pull-down resistance


    when A/B-device is idle or acting as Host, D+ -> pull low (R 14.25k -24.8k)     D- -> pull low (R 14.25k -24.8k)


    when A/B-device is acting as a peripheral, D+ disable pull-down(floating) and D-> pull-down, A prevent B-device's D- floating if the B-device becomes unplugged and B is the same that of A-device.


    During the interval of packet transmission, A/B-device is allowed to disable D+ and D- pull-down resistor 




*pull-up resistance


    A/B-device is operating as Peripheral, D+ -> pull-up


    During the interval of packet transmission, A/B-device is allowed to disable D+ pull-up resistor





*if one side is not OTG device, how does the protocol go?




*What's J, K state?

J state -> idle state -> D+>D-(differential 1) for FS, D+<D-(differential 0) for LS
K state -> D+<D-(differential 0) for FS, D+>D-(differential 1) for LS

*What's Session Request Protocol(SRP)?

B-device request A-device to provide Vbus to B-device by using SRP.


*What's Host Negotiation protocol(HNP)?


  1. A-device sends a SetFeature(b_hnp_enable) command.
  2. A-device suspend bus.
  3. B-device signals a disconnect to the A-device.(if B-device want to use bus)
  4. A-device interrupts this disconnect.(if A-device enable to switch)
  5. A-device turns on pull-up resistor on D+.

     A) A-device finishes using bus and stops all bus activity, (i.e. suspends the bus).
     A) A-device 用完bus 然後停止所有的bus 的運作,(例如suspends the bus)

    B) B-device detects that bus is idle for more than TA_AIDL_BDIS min and begins HNP by turning off pull-up on D+. This allows the bus to discharge to the SE0 state. If the bus was operating in HS mode, the B-device will first enter the full-speed mode and turn on its D+ pull-up resistor for at least TB_FS_BDIS min before turning off its pull up to start the HNP sequence.
    B) B-device 偵測到bus idle 超過 TA-AIDL_BDIS  min 之後開始 HNP , 透過關掉 D+的pull-up。 這麼做可以讓bus 進入 SE0 state(D+ and D- go low). 如果 bus 正在運作在 HS mode, B-device 會先進入 FS mode 並開啟 D+ pull-up 阻抗至少 TB_FS_BDIS min ,在關掉pull-up 阻抗去開始NHP程序之前.  

    Note: After B-device enters the FS mode and turns on its pull-up resistor; it waits to see if the data line goes high. If the data line does not go high within TWTRSTHS (from Table 7-14 in USB 2.0 specification [USB2.0]), then the B-device shall start its HS chirp. Otherwise, if the D+ line does go high for at least TB_FS_BDIS min, then the B-device may start HNP.
    注意: 在B-device 進入 FS mode 並開啟 pull-up 阻抗之後; 它會等並看看是否資料線是hi. 如果資料線沒有go high 至少 TWTRSTHS(在USB 2.0 的Table 7-14有提到), B-device 可能會開始它的 HS chirp。否則,如果D+ line 有go high 至少 TB_FS_BDIS min, 則B-device 開始 NHP.
 
    C) The A-device detects the SE0 on the bus and recognizes this as a request from the B-device to become Host. The A-device responds by turning on its D+ pull-up within TA_BDIS_ACON max of first detecting the SE0 on the bus.
    C) A-device 偵測到 SE0 並了解這個是 B-device 要變成 Host 的要求。A-device 回應,透過開啟 D+ pull-up 要在第一次偵測到 SE0 的 TA_BDIS_ACON 的最大值之間。

    D) After waiting long enough to insure that the D+ line cannot be high due to the residual effect of the B-device pull-up, (see Section 5.1.9), the B-device sees that the D+ line is high and D- line is low, (i.e. J state). This indicates that the A-device has recognized the HNP request from the B-device. At this point, the B-device becomes Host and asserts bus reset to start using the bus. The B-device must assert the bus reset (SE0) within TB_ACON_BSE0 max of the time that the A-device turns on its pull-up.
    D) 在等待一段長時間來確定 D+ 線不會是 hi 之後(由於B-device pull-up 的殘餘的影響 Section 5.1.9) ,  B-device 會看到D+>D-(例如 J State)。這說明了A-device 已經辦識到 HNP 的要求來自B-device。在這個時候, B-device 變成 Host 並reset bus 來開始使用bus. B-device 必須告知 bus reset (SE0) 在 TB_ACON_BES0的最大值之間, 這個時間是A-device 開啟它的pull-up 的時候。

    E) When the B-device completes using the bus, it stops all bus activity. (Optionally, the B-device may turn on its D+ pull-up when a FS idle condition is detected on the bus.)
    E) 當B-device  用完bus 時, 它停止所有bus 上的運作(B-device 可能會開啟 D+ pull-up 當偵測到 FS idle 在bus 上)

    F) A-device detects lack of bus activity for more than TA_BIDL_ADIS min and turns off its D+ pull-up. Alternatively, if the A-device has no further need to communicate with the B-device, the A-device may turn off VBUS and end the session.
    F) A-device 偵測到busy 沒有活動超過 TA_BIDL_ADIS min 然後就關掉 D+ pull-up. 如果A-device 沒有更進一步的需要來跟B-device 溝通的話,A-device 關掉Vbus 然後結束 session.

    G) B-device turns on its pull-up.
    G) B-device 開啟 pull-up.

    H) After waiting long enough to insure that the D+ line cannot be high due to the residual effect of the A-device pull-up, (see Section 5.1.9), the A-device sees that the D+ line is high (and D- line is low)indicating that the B-device is signaling a connect and is ready to respond as a Peripheral. At this point, the A-device becomes Host and asserts bus reset to start using the bus.
    H) 在等待一段長時間來確定 D+ 線不會是 hi 之後(由於A-device pull-up 的殘餘的影響 Section 5.1.9) ,  A-device 會看到D+ -> hi, (D- -> low)。這說明了B-device 正在連接並且準備好回應如同一個 Peripheral. 在這個時候, A-device 變成 Host 並reset bus 來開始使用bus.





 

7.30.2008

While I'm modifying the file, this file was changed already on Source Safe.

How can I do?

one way can do, to merge code before check in.

If my code base is too old from the code on Source Safe. How can I make sure that the code I merage won't affect to other people's, which causes complileing error.
  1. to update my code base
    1. get the lasest code on Source Safe and make sure it can be builded through the end
    2. merge my code which im developoing to the new code base and make sure it can be builded through the end
  2. check out the code what I want to merge
  3. merge 2 to my new code base and make sure it can be builded throough the end
  4. check in