1 2 Previous Next 16 Replies Latest reply on Sep 30, 2019 6:05 AM by ThLa_3669246

    Fast Charge + USB serial communication

    ThLa_3669246

      Hello,

       

      I'm using a CY4531 CCG3 EVK.

       

      I would like to acheive  serial communication between a tablet and a usb serial device (FTDI), while fast charging the tablet.

       

      I'm using the default notebook example charged with EZ-PD utility.

       

      the tablet is plugged on the USB-C port and the serial device on the USB 3 type  B port (J2).

       

      At this time with the default  notebook example, I can either :

      fast charge the tablet (CY4531 EVK is powered externally )

      or

      have the USB serial communication enabled (EVK is powered by the tablet)

       

      I would like to fast charge the tablet while the USB serial communication is enabled.

       

      I know this is possible because there is a commercial product doing such (LAVASynC 1U_OEM).

       

      I guess that the notebook example does not enable this feature.

      I would really appreciate some hints on how to acheive this .

       

      Best,

      Thomas.

        • 1. Re: Fast Charge + USB serial communication
          RajathB_01

          Hi Thomas,

           

          The USB3.0 Type-B connector J2 on the CY4531 is meant for connecting a host. Is your USB-serial device module self powered?

           

          Regards,

          Rajath

          • 2. Re: Fast Charge + USB serial communication
            ThLa_3669246

            Hi Rajath,

             

            Yes my USB serial device is self powered.

            I only need to power the tablet.

             

            Is it possible to modify the board so I can plug a device in J2 ?

             

            Thomas.

            • 3. Re: Fast Charge + USB serial communication
              RajathB_01

              Hi Thomas,

               

              If you take a look at the board schematics, you can see how the data lines are routed.

              I don't think it should be a problem with the EVK board when device is self powered. I believe this could be an issue with the tablet host application settings.

               

              For example, the tablet might be considering itself as a host (OTG host) only when it is also providing VBUS (to power the EVK). In case of charging (EVK powered externally), the tablet might be going into device mode.

               

              Since your case involves the tablet being host all the time (right?), there are 2 possible solutions:

              1. Figure out how to change the host settings - this will solve the issue on all platforms

              2. Initiate a data role swap from CCG3 whenever you find out CCG3 is host (tablet is device) - fixes the issue when using CY4531

               

              Can I also know what tablets you have tested with?

               

               

              Regards,

              Rajath

              • 4. Re: Fast Charge + USB serial communication
                ThLa_3669246

                Rajath,

                 

                Yes the tablet is always Host.

                I have a samsung tab A SM-T515.

                 

                *1. Figure out how to change the host settings - this will solve the issue

                on all platforms  *

                I'm not sure it's possible

                 

                *2. Initiate a data role swap from CCG3 whenever you find out CCG3 is host

                (tablet is device) - fixes the issue when using CY4531  *

                Does that mean I have to make changes in the example notebook firmware ? or

                is it possible by just changing the configuration with EZ-PD configuration

                utility ?

                 

                Thomas

                • 5. Re: Fast Charge + USB serial communication
                  RajathB_01

                  Thomas,

                   

                  I believe we can modify the behavior of CCG3 by just using the config table parameters in order to succeed becoming the data device ultimately. You can use EZ-PD Config tool and change the following parameters under Port Information:

                  1. Port role:                     Dual Role

                  2. Default port role:         Sink

                  3. DRP Preferred role:    Source

                  4. DR_Swap response:   NOT_SUPPORTED

                  5. PR_Swap response:   ACCEPT

                   

                  Let me know if this works. If it doesn't, we will need CC logs to analyze the PD communication and see what is going on during negotiation.

                   

                  Regards,

                  Rajath

                  • 6. Re: Fast Charge + USB serial communication
                    ThLa_3669246

                    Rajath,

                     

                    No luck with this configuration, same behaviour.

                     

                    How can I find the CC logs ?

                     

                    Thomas

                    • 7. Re: Fast Charge + USB serial communication
                      ThLa_3669246

                      I Just ordered an EZ-PD Analyzer, I will get back to you once I get it.

                       

                      Thomas

                      • 8. Re: Fast Charge + USB serial communication
                        ThLa_3669246

                        Hi Rajath,

                         

                        Here are 2 logs.

                         

                        first one is with the default configuration of the notebook firmware on the CY4531 

                         

                        The second one is with using LAVASynC board.

                         

                        On the second log we can see that there is a DR_Swap message just after the PS_RDY, this what I want to acheive with the CY4531.

                         

                        I tried multiple configuration, but no success yet.

                        • 9. Re: Fast Charge + USB serial communication
                          RajathB_01

                          Hi Thomas,

                           

                          You are right. We should be making a DR_Swap.

                           

                          Was the log captured for the scenario when CY4531 is externally powered and charges the tab? If yes, was the tablet indicating charging? Because I donot see much current on VBUS from the logs. You can also check it on CY4531 - the testpoint USB_C_PWR (near J7) will be ZERO if CCG3 is source and equals VBUS when sink.

                           

                          Regards,

                          Rajath

                          • 10. Re: Fast Charge + USB serial communication
                            ThLa_3669246

                            Hi Rajath,

                             

                            Yes it was externally powered and it is charging the tablet.

                            There is not much current because the tablet was at 100% battery at the moment of the log, but  it's indicating that it's charging, and I'm using a lab power supply and I can see the current going up when I plug the tablet on the board.

                             

                            About USB_C_PWR, should it be a true 0 or a bit higher or high-Z ? because there is 5V when it's sink but when it's source there is like 0,8V.

                             

                            Thomas.

                            • 11. Re: Fast Charge + USB serial communication
                              RajathB_01

                              Thomas Laurenson wrote:

                               

                              About USB_C_PWR, should it be a true 0 or a bit higher or high-Z ? because there is 5V when it's sink but when it's source there is like 0,8V.

                              It will be High-Z. 0.8 seems legit, we can take it as source.

                               

                              Please note that if a port starts as a power source, it will default into a data DFP which might be forcing tablet to stay in device mode.

                              We can issue a DR_Swap if we find out we are in the wrong data role. This requires changing firmware.

                              Another approach will be to start as a power sink, which means data UFP and then later swap out the power roles. This is usually possible with changing the config parameters which I sent.

                               

                              Regards,

                              Rajath

                              • 12. Re: Fast Charge + USB serial communication
                                ThLa_3669246

                                Rajath,

                                 

                                Joined, you will  find the config you told me to try and the associated log.

                                the scenario to get the log: the CY4531 is powered and running, with the USB serial deviced powered and plugged into J2, I start the logger and data appear as soon as I plug the tablet.

                                Still no succes here, the tablet is charged but no USB serial com.

                                 

                                I really think that the solution is to modify the firmware to issue a DR_swap manually.

                                In the SDK User Guide I found this:

                                6.2.6.5 Issue a DR_SWAP where required

                                /* Function to initiate a DR_SWAP if CCGx is UFP. */
                                 void dr_swap_if_required() 
                                {
                                      const dpm_status_t *dpm_stat = dpm_get_info (0); 
                                      dpm_pd_cmd_buf_t param; ccg_status_t status;      
                                     
                                     if (dpm_stat->cur_port_type == PRT_TYPE_UFP)
                                      {
                                           /* CCGx is UFP. Initiate DR_SWAP. We keep retrying while the PD port is in a busy state. */
                                                param.cmd_sop = SOP; 
                                                do {
                                                          status = dpm_pd_command (0, DPM_CMD_SEND_DR_SWAP, ¶m, cmd_callback);
                                                     } while (status == CCG_STAT_BUSY);
                                          }
                                }
                                

                                 

                                My guess is that i can use this example to swap to UFP  if port type is in DFP mode.

                                 

                                I installed the SDK and PSoC Creator, I started to explore the code but  I'm not sure where to make that DR_SWAP.

                                Do you have and idea where it should be the best to do ?

                                 

                                Thomas.

                                • 13. Re: Fast Charge + USB serial communication
                                  RajathB_01

                                  Thomas,

                                   

                                  You can call this after app_task(port) function in the for loop inside main function.

                                   

                                  Regards,

                                  Rajath

                                  • 14. Re: Fast Charge + USB serial communication
                                    ThLa_3669246

                                    Rajath,

                                     

                                    I added the dr_swap command like this, without success.

                                     

                                       while (1)
                                        {
                                            /* Perform DPM, APP and HPI tasks. */
                                            for (i = TYPEC_PORT_0_IDX; i < NO_OF_TYPEC_PORTS; i++)
                                            {
                                                dpm_task (i);
                                                app_task (i);
                                               
                                                /*test DR_SWAP */
                                              const dpm_status_t *dpm_stat=dpm_get_info(0);
                                              dpm_pd_cmd_buf_t param;
                                              ccg_status_t status;
                                              if(dpm_stat->cur_port_type == PRT_TYPE_DFP )
                                              {
                                                  param.cmd_sop=SOP;
                                                  do
                                                  {
                                                      status=dpm_pd_command(0,DPM_CMD_SEND_DR_SWAP,&param,NULL);
                                                  }while(status==CCG_STAT_BUSY);
                                              }
                                    
                                    
                                    #if CCG_HPI_ENABLE
                                                /* Handle any pending HPI commands. */
                                                hpi_task ();
                                    #endif /* CCG_HPI_ENABLE */
                                    
                                    
                                    #if CCG_UCSI_ENABLE
                                                /* Handle any pending UCSI commands. */
                                                ucsi_task ();
                                    #endif /* CCG_UCSI_ENABLE */
                                    
                                    
                                                /* Perform tasks associated with instrumentation. */
                                                instrumentation_task()
                                            }
                                    

                                     

                                    I joined the CC log. the chip seems to reset in loop.

                                     

                                    Thomas.

                                    1 2 Previous Next