Statemachine for call-back functions registered to struct app_cbk_t

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
JaVu_4007791
Level 1
Level 1

Hello,

I am working on a USB hub based application & using CYPD3125 Notebook solution project as a reference.

1. Does a successful execution of dpm_update_port_config() invoke eval_pr_swap()?? If no, what event calls eval_pr_swap()?

2. In a similar way i would like to know the state-machine/call-events for the functions registered to the app_cbk_t structure.

Thanks in Advance

Jai

0 Likes
1 Solution

Hello Jai

The dpm_stop will invoke a function to stop the Type C operations i.e. stop the H/W block.

This type C stop function in-turn invokes a disable function which disables the type C interface i.e remove Rp, Rd and disable the type C state machine: This disable function removes Rp, Rd terminations including the resistive ones, then disables VCONN on both the CC channels (vconn_disable is called here), psrc_disable(Disables the VBUS power ) is called and if CCG is not source only then psnk_disable(Set VBUS FET Off) is called, then it stops all type C timers.

Best Regards

Yatheesh

View solution in original post

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

Hello Jai

dpm_update_port_config() will not invoke eval_pr_swap,instead it will disable and reconfigure the port to the mentioned port role.

app_cbk_t structure reference details and the call backs can be found in the latest API Reference Guide(version 3.3.0).

link for the latest API reference guide: https://www.cypress.com/file/397576/download  

Best Regards

Yatheesh

0 Likes

Hello Yatheesh,

Thanks for the quick reply.

1. As you know, as part of the application we are registering 20+ call-back functions to app_cbk_t structure. And in the application we have many dpm_xxx() calls. As per my understanding, calls to dpm_xxx() API's by the application in-turn invokes these registered call-back functions, Correct me if i am wrong. Here i would want to understand how my registered call-back functions are getting invoked, on what action/api call/event, Hence i had requested for a state-machine diagram.

I did not find this level of information in API Reference Guide(version 3.3.0).

2. One more question, does a call to dpm_stop() api invoke psrc_disable()??

3. What will invoke psnk_disable() & vconn_disable()?? Of-coarse questions 2 & 3 leads are subset of qestion 1.

Regards,

Jai

0 Likes

Hello Jai

The dpm calls will not invoke the call_back functions from the app_cbk_t structure. Sorry to say that the source code details cannot be shared and it is only for internal reference.

As mention above dpm_stop() will not invoke psrc_disable().

vconn_disable() is called when VCONN OCP(over current protection) is enbled.

psnk_disable() is called to turn off the VBUS FET.

Best Regards

Yatheesh

0 Likes

Hi Yatheesh,

The following is the behavior in my application while :

Hub acting as a PRT_TYPE_DFP drawing power from Host device & when the AC power to the Hub is ON -> ISR (Power Pin) -> dpm_stop() is called.

Soon after dpm_stop() execution, the following functions are invoked:

psrc_disable() -> psnk_disable() -> vconn_disable() -> CCG3 controller reboots.

The CCG3 controller rebooting is not an expected behavior. The reason for the reboot seems to be because of both power's psrc_disable() & psnk_disable() are disabled. However, psrc_disable() & psnk_disable() is not being called in my application, they are being invoked by the library.

Can you help to understand how the call-back functions psrc_disable() & psnk_disable() gets invoked in my case?

I believe your point "The dpm calls will not invoke the call_back functions from the app_cbk_t structure." is not correct as the call-back functions of app_cbk_t structure are meant to be called by library directly/indirectly through dpm calls. The following code snippet is from main.c of sdk example which also tells that the call-backs are for DPM.

/*

* Application callback functions for the DPM. Since this application

* uses the functions provided by the stack, loading the stack defaults.

*/

const app_cbk_t app_callback =

{

...

}

Awaiting for your response.

Thanks & Regards

Jai

0 Likes

Hello Jai

The dpm_stop will invoke a function to stop the Type C operations i.e. stop the H/W block.

This type C stop function in-turn invokes a disable function which disables the type C interface i.e remove Rp, Rd and disable the type C state machine: This disable function removes Rp, Rd terminations including the resistive ones, then disables VCONN on both the CC channels (vconn_disable is called here), psrc_disable(Disables the VBUS power ) is called and if CCG is not source only then psnk_disable(Set VBUS FET Off) is called, then it stops all type C timers.

Best Regards

Yatheesh

0 Likes