Changing from receptacle to plug in CCG2 CYPD2122-24LQXIT-notebook sample code

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
aldr_3203566
Level 4
Level 4
First like received

I have searched a little on this topic, but was not able to find any detailed specific answers.

I am attempting to change the receptacle to a plug (captive cable?) on the CCG2 evaluation kit.

While I wont physically swap out the connector, using a gender mender to change the gender of the connector for conformation purposes.

There are some sample applications, such as the charge through dongle, that use plug instead of a receptacle and I have looked at these, but, I believe it requires some electrical connection changes.

For instance, CC1 on the CCG2 is connected, but CC2 on the CCG2 is not connected.

Does VCONN on the CCG2 need to be connected?

Can this be confirmed what needs to be change to connect the CCG2 evaluation kit directly to a USB-C smart phone (think like a power bank solution with a fixed USB-C cable instead of a USB-C receptacle.

I have located several points in the logic of the CYPD2122-24LQXIT-notebook sample such as…

usbpd.h

/* Adapter Connection Configuration */

#if (ADAPTER_CONFIGURATION == TYPE_C_RECEPTACLE)

#define RECEPTACLE_SUPPORTED_INC

#endif

#if (ADAPTER_CONFIGURATION == CAPTIVE_CABLE)

#define CAPTIVE_CABLE_SUPPORTED_INC

#endif

/**

*  CC Configuration

*  DUAL_CC

*  SINGLE_CC

*/

#ifdef RECEPTACLE_SUPPORTED_INC

#define CC_CONFIGURATION                  (DUAL_CC)

#endif

#ifdef CAPTIVE_CABLE_SUPPORTED_INC

#define CC_CONFIGURATION                  (SINGLE_CC)

#define CABLE_DISCOVERY_DISABLED     

#endif   

main.c

#ifdef CC_CONFIG_SINGLE_INC

    gl_cable_dsc_disabled = true;

#endif

#ifndef CC_CONFIG_SINGLE_INC

cbl_discovery();

#endif

I have tried several modifications, including adapting the CYPD2134-24LQXI_power_adapter to the CCG2 evaluation kit, but the USB-C PD negation does not begin when the device is connected.

I am just looking for some brief guidance what would be required if I swapped the receptacle out for a plug on the CCG2 evaluation kit using the CYPD2122-24LQXIT-notebook sample code.

Some guidance would be greatly appreciated.

Sincerely,

Allan

0 Likes
1 Solution

Hello Allan

Thank you for the test outputs.

CCG2 shows Rp and Rd toggling on both the lines, this is the main reason causing the issue.

The problem is that CCG2 is toggling Rp and Rd on both the CC lines which happens in case of receptacle, this is causing the problem to initiate a PD contract. When a EMCA cable is used in place of a gender mender, the EMCA cable has an Ra termination on one of its CC lines hence only one CC line goes form the CCG2 end to the mobile end(this  also be seen using the analyzer when you put up an Rd or Ra termination on one of the CC lines)

When a gender mender is used both the CC lines are running from CCG2 end to mobile end,Rp and Rd is toggling on both the pins(CC1 and CC2) on both the side.

CCG2 receptacle hardware is not getting configured as a captive cable hardware where Rp and Rd should toggle on any one of the CC line and other CC line should put up Ra or lest unconnected.

Captive Cable firmware changes does not effect the hardware and CCG2 will still toggle Rp and Rd on both the lines leading to this issue again.

Using a gender mender is not recommended, But removing a CC line in the gender mender may solve the issue.

Best Regards

Yatheesh

View solution in original post

0 Likes
14 Replies
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Allan,

Any one of the CC lines from CCG2 to the Device is enough for the PD contract to take place. Vconn is needed only in case of EMCA cables to power the marker electronics inside it.

Can you are please confirm that are you using a gender mender(male to male) for experimenting this, if so the absence of Vconn line should not be a problem.

When you configure as a captive Cable i.e.

#define TYPE_C_RECEPTACLE   (1u)
#define CAPTIVE_CABLE       (0u)

Do you see any recordings in the CC logs?

Do try flipping and connecting the device and see if there is any changes.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

Thank you for your reply and sorry for the delay in the reply.

I am currently waiting for some additional hardware.

The gender mender method I was using was not reliable and placed an order for more proper hardware.

This seems like a good source for USB-C and other related breakout PCBs if anyone is interested

USB3.1-CM-CM-V1A, USB3.1 Type C Male to Male pass through adapter – eLabBay

As for the logs, I had made all the programming changes required in the header files I believe.

At first I wanted to confirm if there was anything that was precompiled into the library that would make it difficult to change from a receptacle to a plug.

Please wait for the new development hardware to arrive and I can more properly test and provide proper feedback.

The hardware may not arrive until the end of the week (over seas shipping) due to being to locate any hardware in country.

Sincerely,

Allan

0 Likes

Hello Allan

Altering the firmware should be enough for changing the functionality from receptacle to plug.

We will be waiting for the new hardware updates.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

Sorry for the delay, I received the hardware the the other day and needed time to properly test and prepare a response.

To confirm, the evaluation kit used is the CY4521 CCG2 Evaluation Kit Guide.

The kit is programmed from PSoC creator 4.2 using a MiniProg3 programmer.

After changing the the firmware to captive cable, using the modifications seen below, although the cable check is removed, confirmed with the CY4500 EZ-PD Protocol Analyzer, I am not seeing the PD communication start when the smart phone is connected directly to the EVK with a gender mender.

Although these modifications are in the attached text file, I will place them at the bottom of this message for easier reading.

I am attaching the firmware that I used to test with.  First is the firmware without any modifications, based on the following

Simple CCG2 example firmware for power bank

https://community.cypress.com/community/usb/ez-pd-type-c-usb/blog/2018/03/20/simple-ccg2-example-fir...

The second firmware has modifications done listed in the CYPD2122-24LQXI-notebook_captive_cable_modifications.txt file

I am not sure all of these modifications were necessary, but these modifications were copied from the CYPD2134-24LQXI_power_adapter firmware example in the CCG2 SDK.

This firmware has been updated to PSoC 4.2 and all associated components.

All the build results (and resulting HEX files) should remain intact.

I am including pictures of the two setups.

The USB-C cable used is a Apple brand Thunderbolt 3 USB-C cable with all pins and data pairs connected.

The two gender menders seen are straight through gender menders with all pins connected.

All pins are routed straight through, but of course not rated for high speed transfers.

CYPD2122-24LQXI-notebook_captive_cable_201903191553.zip

+ modified for captive firmware

+ modifications done are listed in CYPD2122-24LQXI-notebook_captive_cable_modifications.txt

+ packet capture 201903191543_captive_firmware_withcable.ccgx

+ connected using a cable, it is seen that the cable e-marker check does not occur in the above packet capture

CYPD2122-24LQXI-notebook_201903191553.zip

+ the original source as stated above for use with a receptacle

+ packet capture 201903191549_receptacle_firmware_withcable.ccgx

+ connected using a cable, it is seen that the e-marker cable check does occur

The packet captures are with a cable, as I could not see anything on the packet capture when connected directly with the gender mender.

As shown in one of the pictures I can verify the gender menders are working.  Using two gender menders with the cable results in a successful connection.

I have been able to successfully connect the smartphone without the cable in the captive setup, but, it occurs very rarely.  The PD communication does not begin for some reason.

I am not sure which device is responsible to begin the PD communications, perhaps both devices are waiting.

At the moment I only have this single Samsung Galaxy S8 smart phone to test with.

It does not show any connectivity problems when using a cable to connect the CCG2 evaluation kit.

Can you confirm these observations (PD communication rarely starts without a cable between the evaluation kit and the smart phone) if you have a gender mender available and a smart phone?

IMG_5803.JPG

IMG_5804.JPG

IMG_5805.JPG

IMG_5806.JPG

Details of the modifications done…

These modifications are in the CYPD2122-24LQXI-notebook_captive_cable_201903191553.zip project.

usbpd_config.h

Line 60 added

/* Adapter Configuration

   CAPTIVE_CABLE

   TYPE_C_RECEPTACLE */

#define ADAPTER_CONFIGURATION               (CAPTIVE_CABLE)

usbpd.h

Line 114 replaced

/* CC Configuration

   DUAL_CC

   SINGLE_CC */

#define   CC_CONFIGURATION                  (DUAL_CC)

with the following

/**

*  CC Configuration

*  DUAL_CC

*  SINGLE_CC

*/

#ifdef RECEPTACLE_SUPPORTED_INC

#define CC_CONFIGURATION                  (DUAL_CC)

#endif

#ifdef CAPTIVE_CABLE_SUPPORTED_INC

#define CC_CONFIGURATION                  (SINGLE_CC)

#define CABLE_DISCOVERY_DISABLED     

#endif   

main.c

Line 127 added

#ifdef CC_CONFIG_SINGLE_INC

    gl_cable_dsc_disabled = true;

#endif

0 Likes

Hello Allan,

The firmware changes seem fine.

Please try the below tests with the captive cable firmware:

1) When CCG2 is directly connected to mobile through gender mender, please do check the CC voltages(use an oscilloscope) on both the CC lines in the power adapter configuration(where CCG2 is always the source).

If the voltage is greater than 1.65 V(minimum voltage) then the cc line has not encountered an Rd termination on the device end even though its providing Rp on its side, in this case it has not been connected to the device(mobile) hence there cannot be a PD communication.

If the voltage is between 0.25V and 1.6V on any one of the CC line then that CC line has encountered an Rd termination and has been successfully connected. In this case the other CC line should have less than 0.2V.

2) Repeat the above steps using a cable between the gender mender and the mobile (this is to check if an EMCA cable's Ra termination is resulting in any changes)

3) Connect only the gender mender to CCG2 and  see the voltages on the CC lines on the gender mender pins(this is to check on which CC line Rp is put up), do the same to the device by connecting only the gender mender and checking the voltages.

4) Please do check by connecting a type C device(like the C to A dongle, type C notebook  or CCG EVK)  in place of mobile and see if there is any observation.

In the cc log file "201903191543_captive_firmware_withcable" we are able to see the contract being established. Is this the one occurring rarely? if yes, then try flipping the cables and see the observations.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

Thank you for your reply.

I will do the above procedures tomorrow morning when I have access to an oscilloscope and post the results.

I will also have additional USB Type-C devices to connect with as well.

I believe the CY4501 CCG1 Development Kit comes with a USB Type-C to type-A adapter and will perform some tests with this adapter also.

Both of the cc log files are WITH a cable attached.

Even though I have observed the contract negotiation without the cable once, it was when I did not have the EZ-PD analyzer connected and could not capture the results.

The two captures were to verify that the cable check (communication with the EMCA cable chip) was was taking place or not to confirm the captive cable changes in the firmware header files were having any effect.

Sincerely,

Allan

0 Likes

Hello Allan,

The voltages can also be measured using a simple multi-meter if the oscilloscope is not available.

You can use the oscilloscope to check the Rp and Rd toggling on CC lines on the CCG2 end as well as the device end.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

I have done a few simple tests with a tester, I will perform the tests in more detail on the oscilloscope tomorrow.

The following devices were available and used.

CY4501 CCG1 DVK, CY4503 CC1 CLIENT board (powered by mini-USB for these tests) (default factory firmware loaded)

+ Confirmed working by connecting to the included CCG1 HOST board)

CY4521 CCG2 EVK (with captive firmware loaded)

CY4521 CCG2 EVK USB type-C to USB type-A adapter

Samsung Galaxy S8 smart phone

1) When CCG2 is directly connected to mobile through gender mender, please do check the CC voltages(use an oscilloscope) on both the CC lines in the power adapter

configuration(where CCG2 is always the source).

With smart phone connected (without EMCA cable)

CC1 toggling between 1.1 and 1.6 volts

CC2 toggling between 1.1 and 1.6 volts

With smart phone connected (with EMCA cable, VBUS 4.97 volts, smart phone charging)

CC1 5.04 volts

CC2 1.735 volts

With smart phone connected cable flipped at smart phone connector) (with EMCA cable, VBUS 4.97 volts, smart phone charging)

CC1 5.04 volts

CC2 1.735 volts

With smart phone connected (cable flipped at EVK) (with EMCA cable)

CC1 1.735 volts

CC2 5.04 volts

If the voltage is greater than 1.65 V(minimum voltage) then the cc line has not encountered an Rd termination on the device end even though its providing Rp on its side, in this case it has not been connected to the device(mobile) hence there cannot be a PD communication.

If the voltage is between 0.25V and 1.6V on any one of the CC line then that CC line has encountered an Rd termination and has been successfully connected. In this case the other CC line should have less than 0.2V.

2) Repeat the above steps using a cable between the gender mender and the mobile (this is to check if an EMCA cable's Ra termination is resulting in any changes)

Without EMCA cable connected

CC1 toggling between 1.51 and 1.71 volts

CC2 toggling between 1.51 and 1.71 volts

With EMCA cable connected

CC1 toggling between 0.9 and 1.81 volts

CC2 toggling between 0.04 and 0.09 volts

With EMCA cable connected (cable flipped)

CC1 toggling between 0.04 and 0.09 volts

CC2 toggling between 0.9 and 1.81 volts

3) Connect only the gender mender to CCG2 and  see the voltages on the CC lines on the gender mender pins(this is to check on which CC line Rp is put up), do the same to the device by connecting only the gender mender and checking the voltages.

CCG2 EVK Without anything connected

CC1 toggling between about 0.9 and 1.1 volts

CC2 toggling between about 0.9 and 1.1 volts

With EMCA cable connected to CCG2 EVK, nothing connected at other end

CC1 0.05 volts

CC2 toggling between 0.9 and 1.2 volts

With EMCA cable connected to CCG2 EVK (cable flipped), nothing connected at other end

CC1 toggling between 0.9 and 1.2 volts

CC2 0.05 volts

4) Please do check by connecting a type C device(like the C to A dongle, type C notebook  or CCG EVK)  in place of mobile and see if there is any observation.

Performed the above testing with the CY4501 CCG1 DVK

CCG EVK connected with CY4503 CCG1 CLIENT BOARD (without EMCA cable, contract not established)

CC1 0.9 volts

CC2 0.9 volts

CCG2 EVK connected with CY4503 CCG1 CLIENT BOARD (with EMCA cable, contract established, VBUS 5.04 volts)

CC1 5.09 volts

CC2 1.64 volts

With USB type-C to type-A (adapter included in CCG2 EVK, VBUS 5.04 volts)

CC1 1.6 volts

CC2 0.050 volts

Sincerely,

Allan

0 Likes

Hi Yatheesh,

I just stumbled across something that might help explain some things.

The EZ-PD analyzer has the ability to apply the pulldown resistors I believe.

I have tried using this feature and these are the results.

I am attaching an image of the screen for better understanding.

スクリーンショット 2019-03-20 1.24.03.png

When I apply either Ra or Rd to either of the CC1 or CC2 lines the PD negotiation works correctly with the gender mender, without the EMCA cable.

Enabling Rp does not cause any change.

Perhaps a pull down resistor should be enabled on the CCG2 side?

I am including the EZ-PD capture file.

EDIT:

After some more testing, it seems manually manipulating this resistor value is not a good idea, it causes some odd side effects.

It appears to confuse both the CCG2 and the connected device.

However, since communication happens after enabling this setting, I seem to think that there is a missing pulldown when the EMCA cable is not present.

Sincerely,

Allan

0 Likes

Hi Yatheesh,

I have taken a number of measurements with the oscilloscope and also including pictures of the setup for easier understanding.

Below I will copy your questions and then fill in the answer in the appropriate section.

I hope this information covers these questions, if there is something not covered please let me know.

Please note the following:

Channel1 CC1

Channel2 CC2

Channel3 VBUS

Sincerely,

Allan

1) When CCG2 is directly connected to mobile through gender mender, please do check the CC voltages(use an oscilloscope) on both the CC lines in the power adapter configuration(where CCG2 is always the source).

If the voltage is greater than 1.65 V(minimum voltage) then the cc line has not encountered an Rd termination on the device end even though its providing Rp on its side, in this case it has not been connected to the device(mobile) hence there cannot be a PD communication.

IMG_5812.JPG TEK00004.PNG

2) Repeat the above steps using a cable between the gender mender and the mobile (this is to check if an EMCA cable's Ra termination is resulting in any changes)

The below pictures are the Galaxy S8 with nothing connected.

IMG_5814.JPG TEK00006.PNG

The below pictures are with the Galaxy S8 connected to the EMCA cable only.

IMG_5815.JPG tek00007.png

The below pictures are with the Galaxy S8 connected to the EMCA cable only, EMCA cable flipped at the red gender mender.

IMG_5815.JPG TEK00008.PNG

The below pictures are connected with the EMCA cable.

PD contract is established.

IMG_5809.JPG TEK00000.PNG

The below pictures are the same except the EMCA is flipped at the red gender mender.

PD contract is established.

IMG_5810.JPG TEK00001.PNG

3) Connect only the gender mender to CCG2 and  see the voltages on the CC lines on the gender mender pins(this is to check on which CC line Rp is put up), do the same to the device by connecting only the gender mender and checking the voltages.

Below pictures are the CCG2 EVK with nothing connected.

IMG_5813.JPG TEK00005.PNG

Below pictures are the CCG2 EVK with an EMCA cable connected.

IMG_5811.JPG TEK00002.PNG

Same as above but with the EMCA cable flipped at the red gender mender.

IMG_5811.JPG TEK00003.PNG

4) Please do check by connecting a type C device(like the C to A dongle, type C notebook  or CCG EVK)  in place of mobile and see if there is any observation.

CCG2 EVK connected to MacBook Pro laptop.

IMG_5818.JPG TEK00017.PNG

CCG2 EVK connected to MacBro laptop with EMCA cable.

PD contract established.

IMG_5819.JPG TEK00018.PNG

CCG2 EVK connected to MacBro laptop with EMCA cable, EMCA cable flipped at the red gender mender.

PD contract established.

IMG_5820.JPG tek00019.png

MacBook Pro with nothing connected

IMG_5821.JPG TEK00020.PNG

MacBook Pro with EMCA cable.

IMG_5822.JPG TEK00021.PNG

MacBook Pro with EMCA cable, EMCA cable flipped at the red gender mender.

IMG_5824.JPG TEK00022.PNG

CCG2 EVK connected to USB type-C to USB type-A dongle (included in CCG2 EVK).

VBUS measured 5V.

IMG_5816.JPG TEK00011.PNG

CCG2 EVK connected to USB type-C to USB type-A dongle (included in CCG2 EVK), EMCA cable flipped at the red gender mender.

VBUS measured 5V.

IMG_5825.JPG TEK00010.PNG

0 Likes

Hello Allan

Thank you for the test outputs.

CCG2 shows Rp and Rd toggling on both the lines, this is the main reason causing the issue.

The problem is that CCG2 is toggling Rp and Rd on both the CC lines which happens in case of receptacle, this is causing the problem to initiate a PD contract. When a EMCA cable is used in place of a gender mender, the EMCA cable has an Ra termination on one of its CC lines hence only one CC line goes form the CCG2 end to the mobile end(this  also be seen using the analyzer when you put up an Rd or Ra termination on one of the CC lines)

When a gender mender is used both the CC lines are running from CCG2 end to mobile end,Rp and Rd is toggling on both the pins(CC1 and CC2) on both the side.

CCG2 receptacle hardware is not getting configured as a captive cable hardware where Rp and Rd should toggle on any one of the CC line and other CC line should put up Ra or lest unconnected.

Captive Cable firmware changes does not effect the hardware and CCG2 will still toggle Rp and Rd on both the lines leading to this issue again.

Using a gender mender is not recommended, But removing a CC line in the gender mender may solve the issue.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

Thank you for the suggestion.

The recommendation to disconnect CC2 has resolved the issue.

I am still investigating an issue with the Galaxy S8 not providing power on VCONN sometimes when connected (CCG2 dead battery condition).

VCONN seems to float around 0.5V and 1.5V (perhaps data is being sent through this pin, but I have not connected it up to the oscilloscope to verify this).

However, adding the EMCA cable between the CCG2 and Galaxy S8 does not show this issue with VCONN.

I am still investigating this issue.  Wiggling the connector will resolve the issue so I can not be sure it is a physical problem with the receptacle in the Galaxy S8 or not.

The connector pins are such fine pitch its is also very likely wiggling the connector cases some pins to short and reset something inside the Galaxy S8.

The order that pins make connection could also be a factor.  I have not looked at the physical USBC connector in close detail to determine which pins are connecting first upon insertion.  Usually ground pins are longer to connect first in other connectors such as USB type-A.

I am now debating to connect the VCONN1 pin to the CC2 (VCONN) pin on the USBC plug.

At this time I think I will add a zero ohm resistor between the VCONN pin and the 3V3 regulator so I can alter the VCONN pin connection without a PCB redesign.

Also, connecting the 3V3 regulator that powers the CCG2 to both the CONSUMER and PROVIDER paths through diodes has also added stability as the CCG2 will now be powered by either source.

Have you have experienced this behavior with VCONN not being powered sometimes when connecting a plug or dongle to a smart phone?

I don't experience this problem with the MacBook Pro.

Sincerely,

Allan

0 Likes

Hello Allan,

In EMCA cables there are electronic marker chips inside which will provide an Ra termination and VCONN will be powered and it in-turn powers the marker electronics inside the cable. After the cable is enumerated the host may shut down the VCONN power.

When the VCONN line is left open(unconnected) the voltage depends on the receptacle side  (termination it is providing).

VCONN line should not run from end to end in a non EMCA cable or else both the cc lines will simultaneously encounter toggling of Rp and Rd on both sides and PD contract may not take place (just like the issue you were facing with the gender mender where both the CC lines were running from end to end).

We can see VCONN not being powered when using a dongle as there no electronic makers inside it.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

Thank you for the explanation with the VCONN issue, this makes sense.

I will try to work out the remaining issue with VCONN and test on a more diverse variety of devices.

Since this discussion about VCONN will change the topic I will close this topic as it is solved and try to study the issue with VCONN.

Thank you for the excellent assistance and helpful feedback!

Sincerely,

Allan

0 Likes