- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/**
* @brief This function checks if power is present on VBus
*
* @param port Port index the function is performed for.
* @param volt Voltage in mV units.
* @param per Threshold margin.
*
* @return true if power is present on VBus, else returns false
*/
bool vbus_is_present(uint8_t port, uint16_t volt, int8_t per);
/**
* @brief This function gets the ADC level that corresponds to the actual
* voltage on vbus. It also takes into account the VBus monitor divider.
*
* @param port Port index. Caller should ensure to provide only valid values.
* @param adc_id ADC ID.
* @param volt Voltage in 50mV units.
* @param per Percentage margin on the voltage.
* @return Returns the ADC level.
*
* <B>Applicable devices:</B> CCG3, CCG4, CCG5, CCG3PA, CCG3PA2, CCG5C, CCG6.
*/
uint8_t pd_get_vbus_adc_level(uint8_t port, PD_ADC_ID_T adc_id, uint16_t volt,
int8_t per);
/**
* @brief This function gets the current comparator status.
*
* This function does not configure the ADC / comparator. It just returns the
* current state of the comparator. If true is returned, then the input voltage
* is greater than the reference and if false, the input voltage is lower than
* the reference.
*
* @param port Port index. Caller should ensure to provide only valid values.
* @param adc_id ADC ID.
* @return Returns the comparator output.
*
* <B>Applicable devices:</B> CCG3, CCG4, CCG5, CCG3PA, CCG3PA2, CCG5C, CCG6.
*/
bool pd_adc_get_comparator_status(uint8_t port, PD_ADC_ID_T adc_id);
vbus_is_present function call pd_get_vbus_adc_level and to pd_adc_get_comparator_status
/*
* Re-run calibration every time to ensure that VDDD or the measurement
* does not break.
*/
pd_adc_calibrate (port, APP_VBUS_POLL_ADC_ID);
level = pd_get_vbus_adc_level(port, APP_VBUS_POLL_ADC_ID, volt, per);
retVal = pd_adc_comparator_sample (port, APP_VBUS_POLL_ADC_ID, APP_VBUS_POLL_ADC_INPUT, level);
#if APP_SDK_FUNC_MSG_VALUE
WEIZ_DEBUG_PRINT(WZ_GEN_SDK_FLOW, "[%s] %x < APP_VBUS_POLL_ADC_INPUT %d\r\n", __func__,level*50,retVal);
#endif
in debug message i multiply level by 50 because * @param volt Voltage in 50mV units.
result on CY4532 EVK board base on CYPD3171
[FUNC]: [vbus_is_present] 190 < APP_VBUS_POLL_ADC_INPUT 0
[FUNC]: [vbus_is_present] 7d0 < APP_VBUS_POLL_ADC_INPUT 1
[FUNC]: [vbus_is_present] 7d0 < APP_VBUS_POLL_ADC_INPUT 1
[FUNC]: [vbus_is_present] bea < APP_VBUS_POLL_ADC_INPUT 0
[FUNC]: [vbus_is_present] e42 < APP_VBUS_POLL_ADC_INPUT 1
Q1 : i do not understand what vbus_is_present check VDDD or VBUS ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
According to PD spec,
Min value-4.75V
Max value-5.5V
Best Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
vbus_is_present() checks for VBUS, whether it is present within a specific range.
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what is the range ? by spec 4.75 -5.25 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
According to PD spec,
Min value-4.75V
Max value-5.5V
Best Regards,
Mallika