8 Replies Latest reply on Jan 6, 2020 11:49 PM by JaVu_4007791

    How can i force charge a device

    JaVu_4007791

      Hi,

       

      In continuation to my previous thread "Unable to charge a dead battery tablet"

       

      How can i force charge a device (say with 5V 1Amp) by CCG3 PD and not get a Yellow warning icon.

        • 1. Re: How can i force charge a device
          ShifangZ_26

          Hi ,

           

          From previous threads you have been filled, the root cause is the device is not enable Rd on CC line. Is this issue was resolved? If the CC line have assert Rd, the Source (CCG3) will enable 5V on VBUS.

           

          Best Regards,

          Lisa

          • 2. Re: How can i force charge a device
            JaVu_4007791

            Hi,

             

            The issue "Unable to charge a dead battery tablet" is not resolved & looking for a solution.

             

            I am thinking of doing a force charge to the tablet, until the tablet asserts Rd. After which the tablet will perform a normal charging based on negotiation.

             

            Could you please suggest if this is a viable solution or is there a better way to handle this?

             

            Regards

            Jai

            • 3. Re: How can i force charge a device
              ShifangZ_26

              Hi Jai,

               

              If you want to force 5V on VBUS before the Rd is present on CC line, this is not follow Type-C SPEC -- VSAFE0V and compliance issues with other standard Type-C device.  Please kindly aware above information.

               

              If you still want to enable it. you can enable the VBUS_P_CTRL in the firmware directly.

               

              Best Regards,

              Lisa

              • 4. Re: How can i force charge a device
                JaVu_4007791

                Hi Lisa,

                 

                Thanks for the clarification. Yes it is not a standard method to do. I have tried this logic and i am able to charge the bad tablets too.

                 

                My fix:

                //This method force charges for 30 seconds and then resets itself

                void deadBatteryTimerCallback(uint8_t aPort, timer_id_t aTimerId)

                {

                        psrc_set_voltage(TYPEC_PORT_0_IDX, VSAFE_5V); //force charge with 5V

                        vbus_fet_on(0);

                        vbus_discharge_off(0);

                        timer_start(0, CONNECT_TIMER, 30000, noTypeCConnectionTimerCallback); // this leads to CySoftwareReset();

                }

                 

                void uscanAppEventHandler(uint8_t aPort, app_evt_t evt, const void* dat)

                {

                ...

                 

                case APP_EVT_CONNECT:

                ...

                            if (gPwrOn)

                            {

                                if (deadBatteryTimer == 0) //get into this loop only once

                                {              

                                    deadBatteryTimer= 1; // do not get into this loop again

                                    timer_start(0, DEAD_BATTERY_TIMER, 10000, deadBatteryTimerCallback); // force charge, if DEAD_BATTERY_TIMER is not stopped in 10 secs (for bad tablets)

                                }

                            }

                            break;

                 

                case APP_EVT_PKT_RCVD:

                ...

                     timer_stop(0, DEAD_BATTERY_TIMER); //good tablet, no need to run deadBatteryTimerCallback

                     break;

                 

                case APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE:

                ...

                     timer_stop(0, DEAD_BATTERY_TIMER);  //good tablet, no need to run deadBatteryTimerCallback

                     break;

                }

                 

                 

                Slightly different approach & want to check the feasibility:

                 

                Please find the attached PD analyzer log taken for charging a bad samsung (not chargeable through hub) tablet with a samsung charger. As i already said Samsung charger is always able to charge the bad tablets successfully.

                 

                The charger seems performing HARD RESET here. Could you guide me with an example to perform the same HARD RESET. I did not find this logic implemented in the examples CYPD3123-40LQXI_ctd_us & CYPD3125-40LQXI_notebook using lower level API's pd_prot_send_hard_reset().

                 

                Would be happy with your quick reply.

                 

                Thanks & Regards,

                Jai Shankar

                • 5. Re: How can i force charge a device
                  ShifangZ_26

                  Hi Jai,

                   

                  If you are using CCG3 PD, the API you can use for Hard Reset is:

                   

                  /**

                  * @brief Try to send a HardReset to the port partner.

                  * @param port PD port index.

                  * @param reason Reason for the hard reset.

                  * @return ccg_status_t

                  */

                  ccg_status_t dpm_send_hard_reset(uint8_t port, uint8_t reason);

                   

                  Best Regards,

                  Lisa

                  • 6. Re: How can i force charge a device
                    MichaelF_56

                    A response to the last response was sent via email to the community manager alias.  Re-posting here for continuity.

                     

                    Hi ShifangZ_26

                     

                    We are using CYPD3125 Notebook solution version 3.0.2.905 as a reference, the following API is not available in my source.

                    ccg_status_t dpm_send_hard_reset(uint8_t port, uint8_t reason);

                     

                    Should we use the following API ??

                    dpm_prot_reset(0, HARD_RESET);

                     

                    Could you provide an example code snippet for hard resetting the port partner.

                     

                    Regards

                    JaVu_4007791

                    • 7. Re: How can i force charge a device
                      ShifangZ_26

                      Hi JaVu_4007791,

                       

                      Strong recommend you use latest firmware of CYPD3125 notebook. The correct install link is:https://www.cypress.com/documentation/software-and-drivers/ez-pd-host-software-development-kit 

                       

                      For old SDK you are using, recommend you use:

                      dpm_pd_command ( 0, DPM_CMD_SEND_HARD_RESET, Null, Null);

                       

                      Best Regards,

                      Lisa

                      • 8. Re: How can i force charge a device
                        JaVu_4007791

                        Hi Lisa,

                         

                        Thanks for your suggestion to migrate to latest FW.

                        I have tried to port my project to the latest FW & i am having a error during linking. Looking for you help. Thanks.

                         

                        Here is the error log:

                         

                        --------------- Build Started: 01/07/2020 13:14:37 Project: UsbHub, Configuration: ARM GCC 5.4-2016-q2-update Debug ---------------

                        The code generation step is up to date.

                        The compile step is up to date, no work needs to be done.

                        arm-none-eabi-ar.exe -rs .\CortexM0\ARM_GCC_541\Debug\UsbHub_1.a .\CortexM0\ARM_GCC_541\Debug\Bootloadable_1.o .\CortexM0\ARM_GCC_541\Debug\PDSS_PORT0_RX_CLK.o .\CortexM0\ARM_GCC_541\Debug\PDSS_PORT0_TX_CLK.o .\CortexM0\ARM_GCC_541\Debug\PDSS_PORT0_SAR_CLK.o .\CortexM0\ARM_GCC_541\Debug\I2CM.o .\CortexM0\ARM_GCC_541\Debug\I2CM_I2C_INT.o .\CortexM0\ARM_GCC_541\Debug\I2CM_I2C.o .\CortexM0\ARM_GCC_541\Debug\I2CM_I2C_BOOT.o .\CortexM0\ARM_GCC_541\Debug\I2CM_I2C_MASTER.o .\CortexM0\ARM_GCC_541\Debug\I2CM_PM.o .\CortexM0\ARM_GCC_541\Debug\I2CM_BOOT.o .\CortexM0\ARM_GCC_541\Debug\PDSS_PORT0_SWAP_CLK.o .\CortexM0\ARM_GCC_541\Debug\I2CM_SCBCLK.o .\CortexM0\ARM_GCC_541\Debug\I2CM_sda.o .\CortexM0\ARM_GCC_541\Debug\I2CM_sda_PM.o .\CortexM0\ARM_GCC_541\Debug\I2CM_scl.o .\CortexM0\ARM_GCC_541\Debug\I2CM_scl_PM.o .\CortexM0\ARM_GCC_541\Debug\I2CM_SCB_IRQ.o .\CortexM0\ARM_GCC_541\Debug\CyFlash.o .\CortexM0\ARM_GCC_541\Debug\CyLib.o .\CortexM0\ARM_GCC_541\Debug\cyPm.o .\CortexM0\ARM_GCC_541\Debug\cyutils.o .\CortexM0\ARM_GCC_541\Debug\CyLFClk.o .\CortexM0\ARM_GCC_541\Debug\cy_em_eeprom.o .\CortexM0\ARM_GCC_541\Debug\CyBootAsmGnu.o

                        arm-none-eabi-ar.exe: creating .\CortexM0\ARM_GCC_541\Debug\UsbHub_1.a

                        arm-none-eabi-gcc.exe -Wl,--start-group -o C:\Users\jaisankar.vurimi\Desktop\temp\PortHubProject\v4.2\Version_4_4_0_Ported_01\UsbHub\UsbHub.cydsn\CortexM0\ARM_GCC_541\Debug\UsbHub_1.elf .\CortexM0\ARM_GCC_541\Debug\app.o .\CortexM0\ARM_GCC_541\Debug\pdo.o .\CortexM0\ARM_GCC_541\Debug\psink.o .\CortexM0\ARM_GCC_541\Debug\psource.o .\CortexM0\ARM_GCC_541\Debug\swap.o .\CortexM0\ARM_GCC_541\Debug\vdm.o .\CortexM0\ARM_GCC_541\Debug\uscan_usb.o .\CortexM0\ARM_GCC_541\Debug\uscan_i2c.o .\CortexM0\ARM_GCC_541\Debug\uscan_app.o .\CortexM0\ARM_GCC_541\Debug\boot.o .\CortexM0\ARM_GCC_541\Debug\flash.o .\CortexM0\ARM_GCC_541\Debug\gpio.o .\CortexM0\ARM_GCC_541\Debug\system.o .\CortexM0\ARM_GCC_541\Debug\timer.o .\CortexM0\ARM_GCC_541\Debug\utils.o .\CortexM0\ARM_GCC_541\Debug\config.o .\CortexM0\ARM_GCC_541\Debug\main.o .\CortexM0\ARM_GCC_541\Debug\hal_ccgx.o .\CortexM0\ARM_GCC_541\Debug\pdss_hal.o .\CortexM0\ARM_GCC_541\Debug\usb.o .\CortexM0\ARM_GCC_541\Debug\cyfitter_cfg_1.o .\CortexM0\ARM_GCC_541\Debug\cybootloader.o .\CortexM0\ARM_GCC_541\Debug\cymetadata.o .\CortexM0\ARM_GCC_541\Debug\Cm0Start.o .\CortexM0\ARM_GCC_541\Debug\UsbHub_1.a -mcpu=cortex-m0 -mthumb -l ccgx_hpi -l ccgx_pd3 -L Generated_Source\PSoC4 -L .\lib\ccg3 -Wl,-Map,.\CortexM0\ARM_GCC_541\Debug/UsbHub_1.map -T .\cm0g_1.ld -specs=nano.specs -Wl,--gc-sections -flto -Os -g -ffunction-sections -finline-functions -Os -flto -ffat-lto-objects -Wl,--end-group

                        ERROR: No interrupt vector