Index: trunk/fw_g473rct/USBPD/App/usbpd_dpm_core.c
===================================================================
--- trunk/fw_g473rct/USBPD/App/usbpd_dpm_core.c	(revision 59)
+++ trunk/fw_g473rct/USBPD/App/usbpd_dpm_core.c	(revision 65)
@@ -96,5 +96,5 @@
   static const USBPD_PE_Callbacks dpmCallbacks =
   {
-    NULL,
+    USBPD_DPM_SetupNewPower,
     USBPD_DPM_HardReset,
     NULL,
@@ -103,6 +103,6 @@
     USBPD_DPM_GetDataInfo,
     USBPD_DPM_SetDataInfo,
+    USBPD_DPM_EvaluateRequest,
     NULL,
-    USBPD_DPM_SNK_EvaluateCapabilities,
     NULL,
     USBPD_PE_TaskWakeUp,
@@ -244,5 +244,5 @@
   UTIL_TIMER_Stop(&TimerPE0);
   uint32_t _timing =
-    USBPD_PE_StateMachine_SNK(USBPD_PORT_0);
+    USBPD_PE_StateMachine_SRC(USBPD_PORT_0);
   if (_timing != 0xFFFFFFFF)
   {
@@ -260,5 +260,5 @@
   UTIL_TIMER_Stop(&TimerPE1);
   uint32_t _timing =
-    USBPD_PE_StateMachine_SNK(USBPD_PORT_1);
+    USBPD_PE_StateMachine_SRC(USBPD_PORT_1);
   if (_timing != 0xFFFFFFFF)
   {
@@ -320,5 +320,5 @@
       {
         DPM_Sleep_time[port] =
-          USBPD_PE_StateMachine_SNK(port);
+          USBPD_PE_StateMachine_SRC(port);
         DPM_Sleep_start[port] = HAL_GetTick();
       }
@@ -327,5 +327,5 @@
     USBPD_DPM_UserExecute(NULL);
 
-  } while (1u == 1u);
+  } while (1u != 1u);
 #endif /* USE_STM32_UTILITY_OS */
 }
Index: trunk/fw_g473rct/USBPD/App/usbpd_pdo_defs.h
===================================================================
--- trunk/fw_g473rct/USBPD/App/usbpd_pdo_defs.h	(revision 59)
+++ trunk/fw_g473rct/USBPD/App/usbpd_pdo_defs.h	(revision 65)
@@ -34,6 +34,6 @@
 
 /* Define   ------------------------------------------------------------------*/
-#define PORT0_NB_SOURCEPDO         0U   /* Number of Source PDOs (applicable for port 0)   */
-#define PORT0_NB_SINKPDO           1U   /* Number of Sink PDOs (applicable for port 0)     */
+#define PORT0_NB_SOURCEPDO         1U   /* Number of Source PDOs (applicable for port 0)   */
+#define PORT0_NB_SINKPDO           0U   /* Number of Sink PDOs (applicable for port 0)     */
 #define PORT1_NB_SOURCEPDO         0U   /* Number of Source PDOs (applicable for port 1)   */
 #define PORT1_NB_SINKPDO           0U   /* Number of Sink PDOs (applicable for port 1)     */
@@ -85,5 +85,20 @@
 uint32_t PORT0_PDO_ListSRC[USBPD_MAX_NB_PDO] =
 {
-  /* PDO 1 */ (0x00000000U),
+  /* PDO 1 */
+  (
+    USBPD_PDO_TYPE_FIXED                 | /* Fixed supply PDO            */
+
+    USBPD_PDO_SRC_FIXED_SET_VOLTAGE(5000U)         | /* Voltage in mV               */
+    USBPD_PDO_SRC_FIXED_SET_MAX_CURRENT(3000U)     | /* Max current in mA           */
+    USBPD_PDO_SRC_FIXED_PEAKCURRENT_EQUAL          | /* Peak Current info           */
+
+    /* Common definitions applicable to all PDOs, defined only in PDO 1 */
+    USBPD_PDO_SRC_FIXED_UNCHUNK_NOT_SUPPORTED      | /* Unchunked Extended Messages */
+    USBPD_PDO_SRC_FIXED_DRD_SUPPORTED          | /* Dual-Role Data              */
+    USBPD_PDO_SRC_FIXED_USBCOMM_SUPPORTED      | /* USB Communications          */
+    USBPD_PDO_SRC_FIXED_EXT_POWER_NOT_AVAILABLE    | /* External Power              */
+    USBPD_PDO_SRC_FIXED_USBSUSPEND_NOT_SUPPORTED   | /* USB Suspend Supported		 */
+    USBPD_PDO_SRC_FIXED_DRP_NOT_SUPPORTED            /* Dual-Role Power             */
+  ),
 
   /* PDO 2 */ (0x00000000U),
@@ -105,19 +120,5 @@
 {
 
-  /* PDO 1 */
-  (
-    USBPD_PDO_TYPE_FIXED                 | /* Fixed supply PDO            */
-
-    USBPD_PDO_SNK_FIXED_SET_VOLTAGE(5000U)         | /* Voltage in mV               */
-    USBPD_PDO_SNK_FIXED_SET_OP_CURRENT(500U)     | /* Operating current in  mA            */
-
-    /* Common definitions applicable to all PDOs, defined only in PDO 1 */
-    USBPD_PDO_SNK_FIXED_FRS_NOT_SUPPORTED          | /* Fast Role Swap				 */
-    USBPD_PDO_SNK_FIXED_DRD_NOT_SUPPORTED          | /* Dual-Role Data              */
-    USBPD_PDO_SNK_FIXED_USBCOMM_NOT_SUPPORTED      | /* USB Communications          */
-    USBPD_PDO_SNK_FIXED_EXT_POWER_NOT_AVAILABLE    | /* External Power              */
-    USBPD_PDO_SNK_FIXED_HIGHERCAPAB_NOT_SUPPORTED   | /* Higher Capability           */
-    USBPD_PDO_SNK_FIXED_DRP_NOT_SUPPORTED            /* Dual-Role Power             */
-  ),
+  /* PDO 1 */ (0x00000000U),
 
   /* PDO 2 */ (0x00000000U),
Index: trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.c
===================================================================
--- trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.c	(revision 59)
+++ trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.c	(revision 65)
@@ -121,4 +121,23 @@
 
 /**
+  * @brief  Sets the required power profile, now it works only with Fixed ones
+  * @param  PortNum Port number
+  * @retval USBPD status
+*/
+USBPD_StatusTypeDef USBPD_PWR_IF_SetProfile(uint8_t PortNum)
+{
+/* USER CODE BEGIN USBPD_PWR_IF_SetProfile */
+  USBPD_StatusTypeDef      _status = USBPD_ERROR;
+  PWR_IF_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_PWR_IF_SetProfile");
+  if (BSP_ERROR_NONE == BSP_USBPD_PWR_VBUSSetVoltage_Fixed(PortNum, 5000, 3000, 3000))
+  {
+     _status = USBPD_OK;
+  }
+ 
+  return _status;
+/* USER CODE END USBPD_PWR_IF_SetProfile */
+}
+
+/**
   * @brief  Checks if the power on a specified port is ready
   * @param  PortNum Port number
@@ -152,4 +171,41 @@
   return status;
 /* USER CODE END USBPD_PWR_IF_SupplyReady */
+}
+
+/**
+  * @brief  Enables VBUS power on a specified port
+  * @param  PortNum Port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_PWR_IF_VBUSEnable(uint8_t PortNum)
+{
+/* USER CODE BEGIN USBPD_PWR_IF_VBUSEnable */
+  USBPD_StatusTypeDef _status = (USBPD_StatusTypeDef)HW_IF_PWR_Enable(PortNum, USBPD_ENABLE, CCNONE, USBPD_FALSE, USBPD_PORTPOWERROLE_SRC);
+  return _status;
+/* USER CODE END USBPD_PWR_IF_VBUSEnable */
+}
+
+/**
+  * @brief  Disable VBUS/VCONN the power on a specified port
+  * @param  PortNum Port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_PWR_IF_VBUSDisable(uint8_t PortNum)
+{
+/* USER CODE BEGIN USBPD_PWR_IF_VBUSDisable */
+  USBPD_StatusTypeDef _status = (USBPD_StatusTypeDef)HW_IF_PWR_Enable(PortNum, USBPD_DISABLE, CCNONE, USBPD_FALSE, USBPD_PORTPOWERROLE_SRC);
+  return _status;
+/* USER CODE END USBPD_PWR_IF_VBUSDisable */
+}
+
+/**
+  * @brief  Checks if the power on a specified port is enabled
+  * @param  PortNum Port number
+  * @retval USBPD_ENABLE or USBPD_DISABLE
+  */
+USBPD_FunctionalState USBPD_PWR_IF_VBUSIsEnabled(uint8_t PortNum)
+{
+  /* Get the Status of the port */
+  return USBPD_PORT_IsValid(PortNum) ? (USBPD_FunctionalState)HW_IF_PWR_VBUSIsEnabled(PortNum) : USBPD_DISABLE;
 }
 
@@ -207,7 +263,8 @@
 void USBPD_PWR_IF_GetPortPDOs(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId, uint8_t *Ptr, uint32_t *Size)
 {
+    if (DataId == USBPD_CORE_DATATYPE_SRC_PDO)
     {
-      *Size = PORT0_NB_SINKPDO;
-      memcpy(Ptr,PORT0_PDO_ListSNK, sizeof(uint32_t) * PORT0_NB_SINKPDO);
+      *Size = PORT0_NB_SOURCEPDO;
+      memcpy(Ptr,PORT0_PDO_ListSRC, sizeof(uint32_t) * PORT0_NB_SOURCEPDO);
     }
 /* USER CODE BEGIN USBPD_PWR_IF_GetPortPDOs */
@@ -269,15 +326,21 @@
   switch(PowerTypeStatus)
   {
-  case USBPD_PWR_BELOWVSAFE0V :
-    if (_vbus < USBPD_PWR_LOW_VBUS_THRESHOLD) _status = USBPD_TRUE;
-    break;
-  case USBPD_PWR_VSAFE5V :
-    if (_vbus >= USBPD_PWR_HIGH_VBUS_THRESHOLD) _status = USBPD_TRUE;
-    break;
-  case USBPD_PWR_SNKDETACH:
-    if (_vbus < USBPD_PWR_HIGH_VBUS_THRESHOLD) _status = USBPD_TRUE;
-    break;
-  default :
-    break;
+	  case USBPD_PWR_BELOWVSAFE0V :
+		  // Here we must make sure that voltage on Vbus is lower than 750mV,
+		  // but we do not monitor Vbus with ADC, so we just assume that voltage is Ok
+		  _status = USBPD_TRUE;
+		  break;
+	  case USBPD_PWR_VSAFE5V :
+		  // Here we must make sure that voltage on Vbus is higher than 2.8V,
+		  // but we do not monitor Vbus with ADC, so we just assume that voltage is Ok
+		  _status = USBPD_TRUE;
+		  break;
+	  case USBPD_PWR_SNKDETACH:
+		  // Here we must make sure that voltage on Vbus is lower than 2.8V,
+		  // but we do not monitor Vbus with ADC, so we just assume that voltage is Ok
+		  _status = USBPD_TRUE;
+		  break;
+	  default :
+		  break;
   }
   return _status;
Index: trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.h
===================================================================
--- trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.h	(revision 59)
+++ trunk/fw_g473rct/USBPD/App/usbpd_pwr_if.h	(revision 65)
@@ -217,4 +217,11 @@
 
 /**
+  * @brief  Sets the required power profile
+  * @param  PortNum Port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_PWR_IF_SetProfile(uint8_t PortNum);
+
+/**
   * @brief  Checks if the power on a specified port is ready
   * @param  PortNum Port number
@@ -223,4 +230,25 @@
   */
 USBPD_StatusTypeDef USBPD_PWR_IF_SupplyReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe);
+
+/**
+  * @brief  Enable VBUS power on a specified port
+  * @param  PortNum Port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_PWR_IF_VBUSEnable(uint8_t PortNum);
+
+/**
+  * @brief  Disable VBUS power on a specified port
+  * @param  PortNum Port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_PWR_IF_VBUSDisable(uint8_t PortNum);
+
+/**
+  * @brief  Checks if the power on a specified port is enabled
+  * @param  PortNum Port number
+  * @retval ENABLE or DISABLE
+  */
+USBPD_FunctionalState USBPD_PWR_IF_VBUSIsEnabled(uint8_t PortNum);
 
 /**
Index: trunk/fw_g473rct/USBPD/Target/usbpd_dpm_conf.h
===================================================================
--- trunk/fw_g473rct/USBPD/Target/usbpd_dpm_conf.h	(revision 59)
+++ trunk/fw_g473rct/USBPD/Target/usbpd_dpm_conf.h	(revision 65)
@@ -64,5 +64,5 @@
     .PE_SupportedSOP = USBPD_SUPPORTED_SOP_SOP    , /* Supported SOP : SOP, SOP' SOP" SOP'Debug SOP"Debug */
     .PE_SpecRevision = USBPD_SPECIFICATION_REV3,/* spec revision value                                     */
-    .PE_DefaultRole = USBPD_PORTPOWERROLE_SNK,  /* Default port role                                       */
+    .PE_DefaultRole = USBPD_PORTPOWERROLE_SRC,  /* Default port role                                       */
     .PE_RoleSwap = USBPD_FALSE,                  /* support port role swap                                  */
     .PE_VDMSupport = USBPD_FALSE,
@@ -72,4 +72,5 @@
     .PE_CapscounterSupport = USBPD_FALSE,       /* support caps counter                                    */
     .CAD_RoleToggle = USBPD_FALSE,               /* CAD role toggle                                         */
+    .CAD_DefaultResistor = 0x02u,
     .CAD_TryFeature = 0,              /* CAD try feature                                         */
     .CAD_AccesorySupport = USBPD_FALSE,         /* CAD accessory support                                   */
@@ -107,38 +108,8 @@
 {
   {
-    .PE_DataSwap = USBPD_FALSE,                  /* support data swap                                       */
+    .PE_DataSwap = USBPD_TRUE,                  /* support data swap                                       */
     .PE_VconnSwap = USBPD_FALSE,                 /* support VCONN swap                                  */
-    .PE_DR_Swap_To_DFP = USBPD_FALSE,                  /*  Support of DR Swap to DFP                                  */
-    .PE_DR_Swap_To_UFP = USBPD_FALSE,                  /*  Support of DR Swap to UFP                                  */
-     .DPM_SNKExtendedCapa =                        /*!< SNK Extended Capability        */
-	 {
-	   .VID                    = USBPD_VID,  /*!< Vendor ID (assigned by the USB-IF)                      */
-	   .PID                    = USBPD_PID,  /*!< Product ID (assigned by the manufacturer)               */
-	   .XID                    = USBPD_XID,  /*!< Value provided by the USB-IF assigned to the product    */
-	   .FW_revision            = 1,          /*!< Firmware version number                                 */
-	   .HW_revision            = 2,          /*!< Hardware version number                                 */
-       .SKEDB_Version          = USBPD_SKEDB_VERSION_1P0,  /*!<SKEDV Version (not the specification Version)
-                                                               based on @ref USBPD_SKEDB_VERSION          */
-       .LoadStep               = USBPD_SKEDB_LOADSTEP_150MA,/*!< Load Step based on @ref USBPD_SKEDB_LOADSTEP */
-       .SinkLoadCharac.b       =             /*!< Sink Load Characteristics                               */
-        {
-           .PercentOverload    = 0,          /*!< Percent overload in 10% increments Values higher than 25
-                                                  (11001b) are clipped to 250%. 00000b is the default.    */
-           .OverloadPeriod     = 0,          /*!< Overload period in 20ms when bits 0-4 non-zero          */
-           .DutyCycle          = 0,          /*!< Duty Cycle in 5% increments when bits 0-4 are non-zero  */
-           .VBusVoltageDrop    = 0,          /*!< Can tolerate VBUS Voltage drop                          */
-        },
-       .Compliance             = 0,          /*!< Compliance based on combination of @ref USBPD_SKEDB_COMPLIANCE */
-       .Touchtemp              = USBPD_SKEDB_TOUCHTEMP_NA,  /*< Touch Temp based on @ref USBPD_SKEDB_TOUCHTEMP   */
-       .BatteryInfo            = 0,          /*!< Battery info                                                   */
-       .SinkModes              = 0,          /*!< Sink Modes based on combination of @ref USBPD_SKEDB_SINKMODES  */
-       .SinkMinimumPDP        = 0,          /*!< The Minimum PDP required by the Sink to operate without
-                                                  consuming any power from its Battery(s) should it have one     */
-       .SinkOperationalPDP     = 0,          /*!< The PDP the Sink requires to operate normally. For Sinks with
-                                                  a Battery, it is the PDP rating of the charger supplied with
-                                                  it or recommended for it.                                      */
-       .SinkMaximumPDP         = 0,          /*!< The Maximum PDP the Sink can consume to operate and
-                                                  charge its Battery(s) should it have one                       */
-      },
+    .PE_DR_Swap_To_DFP = USBPD_TRUE,                  /*  Support of DR Swap to DFP                                  */
+    .PE_DR_Swap_To_UFP = USBPD_TRUE,                  /*  Support of DR Swap to UFP                                  */
 #if defined(USBPD_REV30_SUPPORT)
 #if _MANU_INFO
Index: trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.c
===================================================================
--- trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.c	(revision 59)
+++ trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.c	(revision 65)
@@ -36,5 +36,7 @@
 #endif /* _TRACE */
 /* USER CODE BEGIN Includes */
-
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 /* USER CODE END Includes */
 
@@ -182,32 +184,47 @@
 void USBPD_DPM_UserCableDetection(uint8_t PortNum, USBPD_CAD_EVENT State)
 {
-/* USER CODE BEGIN USBPD_DPM_UserCableDetection */
-DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_UserCableDetection");
-  // switch(State)
-  // {
-  // case USBPD_CAD_EVENT_ATTACHED:
-  // case USBPD_CAD_EVENT_ATTEMC:
-    // {
-      // if (USBPD_OK != USBPD_PWR_IF_VBUSEnable(PortNum))
-      // {
-        // /* Should not occur */
-        // HAL_Delay(6000);
-        // NVIC_SystemReset();
-      // }
-      // break;
-    // }
-  // case USBPD_CAD_EVENT_DETACHED :
-  // case USBPD_CAD_EVENT_EMC :
-  // default :
-    // {
-      // if (USBPD_OK != USBPD_PWR_IF_VBUSDisable(PortNum))
-      // {
-        // /* Should not occur */
-        // while(1);
-      // }
-      // break;
-    // }
-  // }
-/* USER CODE END USBPD_DPM_UserCableDetection */
+	/* USER CODE BEGIN USBPD_DPM_UserCableDetection */
+	DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_UserCableDetection");
+	switch(State)
+	{
+		case USBPD_CAD_EVENT_ATTACHED:
+		case USBPD_CAD_EVENT_ATTEMC:
+#ifdef DEBUG
+			printf("Cable attached\n");
+#endif
+			if (USBPD_OK != USBPD_PWR_IF_VBUSEnable(PortNum))
+			{
+				// Should not occur
+				while(1)
+				{
+#ifdef DEBUG
+					printf("ERRROR in USBPD_DPM_UserCableDetection!\n");
+#endif
+					HAL_Delay(2500U);
+				}
+			}
+			break;
+
+		case USBPD_CAD_EVENT_DETACHED:
+		case USBPD_CAD_EVENT_EMC:
+#ifdef DEBUG
+			printf("Cable disconnected\n");
+#endif
+			if (USBPD_OK != USBPD_PWR_IF_VBUSDisable(PortNum))
+			{
+				// Should not occur
+				while(1)
+				{
+#ifdef DEBUG
+					printf("ERRROR!\n");
+#endif
+					HAL_Delay(2500U);
+				}
+			}
+			break;
+		default:
+			break;
+	}
+	/* USER CODE END USBPD_DPM_UserCableDetection */
 }
 
@@ -241,43 +258,28 @@
 {
 /* USER CODE BEGIN USBPD_DPM_Notification */
-  /* Manage event notified by the stack? */
-  switch(EventVal)
-  {
-//    case USBPD_NOTIFY_POWER_EXPLICIT_CONTRACT :
-//      break;
-//    case USBPD_NOTIFY_REQUEST_ACCEPTED:
-//      break;
-//    case USBPD_NOTIFY_REQUEST_REJECTED:
-//    case USBPD_NOTIFY_REQUEST_WAIT:
-//      break;
-//    case USBPD_NOTIFY_POWER_SWAP_TO_SNK_DONE:
-//      break;
-//    case USBPD_NOTIFY_STATE_SNK_READY:
-//      break;
-//    case USBPD_NOTIFY_HARDRESET_RX:
-//    case USBPD_NOTIFY_HARDRESET_TX:
-//      break;
-//    case USBPD_NOTIFY_STATE_SRC_DISABLED:
-//      break;
-//    case USBPD_NOTIFY_ALERT_RECEIVED :
-//      break;
-//    case USBPD_NOTIFY_CABLERESET_REQUESTED :
-//      break;
-//    case USBPD_NOTIFY_MSG_NOT_SUPPORTED :
-//      break;
-//    case USBPD_NOTIFY_PE_DISABLED :
-//      break;
-//    case USBPD_NOTIFY_USBSTACK_START:
-//      break;
-//    case USBPD_NOTIFY_USBSTACK_STOP:
-//      break;
-//    case USBPD_NOTIFY_DATAROLESWAP_DFP :
-//      break;
-//    case USBPD_NOTIFY_DATAROLESWAP_UFP :
-//      break;
-    default:
-      DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: USBPD_DPM_Notification:%d", EventVal);
-      break;
-  }
+	// Manage event notified by the stack?
+	switch(EventVal)
+	{
+		case USBPD_NOTIFY_POWER_EXPLICIT_CONTRACT:	break;
+		case USBPD_NOTIFY_REQUEST_ACCEPTED:			break;
+		case USBPD_NOTIFY_REQUEST_REJECTED:			break;
+		case USBPD_NOTIFY_REQUEST_WAIT:				break;
+		case USBPD_NOTIFY_POWER_SWAP_TO_SNK_DONE:	break;
+		case USBPD_NOTIFY_STATE_SNK_READY:			break;
+		case USBPD_NOTIFY_HARDRESET_RX:				break;
+		case USBPD_NOTIFY_HARDRESET_TX:				break;
+		case USBPD_NOTIFY_STATE_SRC_DISABLED:		break;
+		case USBPD_NOTIFY_ALERT_RECEIVED:			break;
+		case USBPD_NOTIFY_CABLERESET_REQUESTED:		break;
+		case USBPD_NOTIFY_MSG_NOT_SUPPORTED:		break;
+		case USBPD_NOTIFY_PE_DISABLED:				break;
+		case USBPD_NOTIFY_USBSTACK_START:			break;
+		case USBPD_NOTIFY_USBSTACK_STOP:			break;
+		case USBPD_NOTIFY_DATAROLESWAP_DFP:			break;
+		case USBPD_NOTIFY_DATAROLESWAP_UFP:			break;
+		default:
+			DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: USBPD_DPM_Notification:%d", EventVal);
+			break;
+	}
 /* USER CODE END USBPD_DPM_Notification */
 }
@@ -295,4 +297,16 @@
   DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_HardReset");
 /* USER CODE END USBPD_DPM_HardReset */
+}
+
+/**
+  * @brief  Request the DPM to setup the new power level.
+  * @param  PortNum The current port number
+  * @retval USBPD status
+  */
+USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum)
+{
+/* USER CODE BEGIN USBPD_DPM_SetupNewPower */
+  return USBPD_PWR_IF_SetProfile(PortNum);
+/* USER CODE END USBPD_DPM_SetupNewPower */
 }
 
@@ -308,29 +322,31 @@
 {
 /* USER CODE BEGIN USBPD_DPM_GetDataInfo */
-  /* Check type of information targeted by request */
-  switch(DataId)
-  {
-//  case USBPD_CORE_DATATYPE_REQ_VOLTAGE:       /*!< Get voltage value requested for BIST tests, expect 5V*/
-//    *Size = 4;
-//    (void)memcpy((uint8_t *)Ptr, (uint8_t *)&DPM_Ports[PortNum].DPM_RequestedVoltage, *Size);
-    // break;
-//  case USBPD_CORE_DATATYPE_SRC_PDO:           /*!< Handling of port Source PDO                         */
-    // break;
-//  case USBPD_CORE_PPS_STATUS:                 /*!< PPS Status message content                          */
-    // break;
-//  case USBPD_CORE_SNK_EXTENDED_CAPA:          /*!< Retrieve of Sink Extended capability message content*/
-    // break;
-//  case USBPD_CORE_INFO_STATUS:                /*!< Information status message content                  */
-    // break;
-//  case USBPD_CORE_MANUFACTURER_INFO:          /*!< Retrieve of Manufacturer info message content       */
-    // break;
-//  case USBPD_CORE_BATTERY_STATUS:             /*!< Retrieve of Battery status message content          */
-    // break;
-//  case USBPD_CORE_BATTERY_CAPABILITY:         /*!< Retrieve of Battery capability message content      */
-    // break;
-  default:
-    DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_GetDataInfo:%d", DataId);
-    break;
-  }
+	// Check type of information targeted by request
+	switch(DataId)
+	{
+		//case USBPD_CORE_DATATYPE_REQ_VOLTAGE:       /*!< Get voltage value requested for BIST tests, expect 5V*/
+			//*Size = 4;
+			//(void)memcpy((uint8_t *)Ptr, (uint8_t *)&DPM_Ports[PortNum].DPM_RequestedVoltage, *Size);
+			//break;
+		case USBPD_CORE_DATATYPE_SRC_PDO:           /*!< Handling of port Source PDO                         */
+			USBPD_PWR_IF_GetPortPDOs(PortNum, DataId, Ptr, Size);
+			*Size *= 4;
+			break;
+		//case USBPD_CORE_PPS_STATUS:                 /*!< PPS Status message content                          */
+			// break;
+		//case USBPD_CORE_SNK_EXTENDED_CAPA:          /*!< Retrieve of Sink Extended capability message content*/
+			// break;
+		//case USBPD_CORE_INFO_STATUS:                /*!< Information status message content                  */
+			// break;
+		//case USBPD_CORE_MANUFACTURER_INFO:          /*!< Retrieve of Manufacturer info message content       */
+			// break;
+		//case USBPD_CORE_BATTERY_STATUS:             /*!< Retrieve of Battery status message content          */
+			// break;
+		//case USBPD_CORE_BATTERY_CAPABILITY:         /*!< Retrieve of Battery capability message content      */
+			// break;
+		default:
+			DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_GetDataInfo:%d", DataId);
+			break;
+	}
 /* USER CODE END USBPD_DPM_GetDataInfo */
 }
@@ -383,15 +399,23 @@
 
 /**
-  * @brief  Evaluate received Capabilities Message from Source port and prepare the request message
-  * @param  PortNum         Port number
-  * @param  PtrRequestData  Pointer on selected request data object
-  * @param  PtrPowerObjectType  Pointer on the power data object
-  * @retval None
-  */
-void USBPD_DPM_SNK_EvaluateCapabilities(uint8_t PortNum, uint32_t *PtrRequestData, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObjectType)
-{
-/* USER CODE BEGIN USBPD_DPM_SNK_EvaluateCapabilities */
-  DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_SNK_EvaluateCapabilities");
-/* USER CODE END USBPD_DPM_SNK_EvaluateCapabilities */
+  * @brief  Evaluate received Request Message from Sink port
+  * @param  PortNum Port number
+  * @param  PtrPowerObject  Pointer on the power data object
+  * @retval USBPD status : USBPD_ACCEPT, USBPD_REJECT, USBPD_WAIT, USBPD_GOTOMIN
+  */
+USBPD_StatusTypeDef USBPD_DPM_EvaluateRequest(uint8_t PortNum, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObject)
+{
+/* USER CODE BEGIN USBPD_DPM_EvaluateRequest */
+  /*
+    Set power data object to initialize value.
+    This parameter is used by the stack to start or not tPPSTimeout
+    (in case of USBPD_CORE_PDO_TYPE_APDO, stack will wait for periodic request
+    from the port partner in PPS mode).
+  */
+  *PtrPowerObject = USBPD_CORE_PDO_TYPE_FIXED;
+
+  DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_EvaluateRequest");
+  return USBPD_ACCEPT;
+/* USER CODE END USBPD_DPM_EvaluateRequest */
 }
 
@@ -827,7 +851,6 @@
 USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapabilityExt(uint8_t PortNum)
 {
-  USBPD_StatusTypeDef _status = USBPD_PE_Request_CtrlMessage(PortNum, USBPD_CONTROLMSG_GET_SNK_CAPEXT, USBPD_SOPTYPE_SOP);
-  DPM_USER_ERROR_TRACE(PortNum, _status, "GET_SINK_CAPA_EXT not accepted by the stack");
-  return _status;
+  DPM_USER_ERROR_TRACE(PortNum, USBPD_ERROR, "GET_SINK_CAPA_EXT not accepted by the stack");
+  return USBPD_ERROR;
 }
 
Index: trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.h
===================================================================
--- trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.h	(revision 59)
+++ trunk/fw_g473rct/USBPD/Target/usbpd_dpm_user.h	(revision 65)
@@ -47,8 +47,7 @@
   uint32_t PE_DR_Swap_To_UFP                              : 1U;  /*!< If supported, DR Swap to UFP can be accepted or not by the user else directly rejected */
   uint32_t Reserved1                                      :28U;  /*!< Reserved bits */
-  USBPD_SNKPowerRequest_TypeDef DPM_SNKRequestedPower;          /*!< Requested Power by the sink board                     */
+  uint32_t            Reserved_ReqPower[6];                       /*!< Reserved bits to match with Resquested power information            */
   USBPD_MIDB_TypeDef  DPM_ManuInfoPort;                         /*!< Manufacturer information used for the port            */
-USBPD_SKEDB_TypeDef DPM_SNKExtendedCapa;                        /*!< SNK Extended Capability           */
-uint8_t             ReservedSnkCapa[3];                       /*!< Reserved bits to match with SnkCapaExt information     */
+uint32_t          ReservedSnkCapa[6];                       /*!< Reserved bits to match with SnkCapaExt information     */
   uint16_t            ReservedManu;                             /*!< Reserved bits to match with Manufacturer information            */
 } USBPD_USER_SettingsTypeDef;
@@ -105,10 +104,10 @@
   */
 void                USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal);
+USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum);
 void                USBPD_DPM_HardReset(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole, USBPD_HR_Status_TypeDef Status);
 void                USBPD_DPM_ExtendedMessageReceived(uint8_t PortNum, USBPD_ExtendedMsg_TypeDef MsgType, uint8_t *ptrData, uint16_t DataSize);
 void                USBPD_DPM_GetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t *Size);
 void                USBPD_DPM_SetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t Size);
-void                USBPD_DPM_SNK_EvaluateCapabilities(uint8_t PortNum, uint32_t *PtrRequestData, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObjectType);
-uint32_t            USBPD_DPM_SNK_EvaluateMatchWithSRCPDO(uint8_t PortNum, uint32_t SrcPDO, uint32_t* PtrRequestedVoltage, uint32_t* PtrRequestedPower);
+USBPD_StatusTypeDef USBPD_DPM_EvaluateRequest(uint8_t PortNum, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObject);
 USBPD_StatusTypeDef USBPD_DPM_EvaluateVconnSwap(uint8_t PortNum);
 USBPD_StatusTypeDef USBPD_DPM_PE_VconnPwr(uint8_t PortNum, USBPD_FunctionalState State);
Index: trunk/fw_g473rct/USBPD/Target/usbpd_pwr_user.c
===================================================================
--- trunk/fw_g473rct/USBPD/Target/usbpd_pwr_user.c	(revision 59)
+++ trunk/fw_g473rct/USBPD/Target/usbpd_pwr_user.c	(revision 65)
@@ -29,4 +29,6 @@
 /* USER CODE BEGIN include */
 
+#include "gpio.h"
+
 /* USER CODE END include */
 
@@ -266,5 +268,8 @@
   else
   {
+	HAL_GPIO_WritePin(UCPD1_VBUS_GPIO_Port, UCPD1_VBUS_Pin, GPIO_PIN_RESET);
     PWR_DEBUG_TRACE(Instance, "ADVICE: Update BSP_USBPD_PWR_VBUSInit");
+	/* Need to keep DISCHARGE ON as soon as not powering VBUS on MB1397 */
+	//DISCHARGE_SET_ON();
   }
 
@@ -306,14 +311,15 @@
   /* USER CODE BEGIN BSP_USBPD_PWR_VBUSOn */
   /* Check if instance is valid       */
-  int32_t ret;
-
-  if (Instance >= USBPD_PWR_INSTANCES_NBR)
-  {
-    ret = BSP_ERROR_WRONG_PARAM;
-  }
-  else
-  {
-    ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
+  int32_t ret = BSP_ERROR_NONE;
+
+  if (Instance >= USBPD_PWR_INSTANCES_NBR)
+  {
+    ret = BSP_ERROR_WRONG_PARAM;
+  }
+  else
+  {
     PWR_DEBUG_TRACE(Instance, "ADVICE: Update BSP_USBPD_PWR_VBUSOn");
+	// Turning discharger off;
+	HAL_GPIO_WritePin(UCPD1_VBUS_GPIO_Port, UCPD1_VBUS_Pin, GPIO_PIN_SET);		// Turning Power Source on;
   }
   return ret;
@@ -332,14 +338,15 @@
   /* USER CODE BEGIN BSP_USBPD_PWR_VBUSOff */
   /* Check if instance is valid       */
-  int32_t ret;
-
-  if (Instance >= USBPD_PWR_INSTANCES_NBR)
-  {
-    ret = BSP_ERROR_WRONG_PARAM;
-  }
-  else
-  {
-    ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
+  int32_t ret = BSP_ERROR_NONE;
+
+  if (Instance >= USBPD_PWR_INSTANCES_NBR)
+  {
+    ret = BSP_ERROR_WRONG_PARAM;
+  }
+  else
+  {
     PWR_DEBUG_TRACE(Instance, "ADVICE: Update BSP_USBPD_PWR_VBUSOff");
+	HAL_GPIO_WritePin(UCPD1_VBUS_GPIO_Port, UCPD1_VBUS_Pin, GPIO_PIN_RESET);	// Turning Power Source off
+	// Turning on Discharge and waiting till Vbus voltage is at low level (750mV)
   }
   return ret;
@@ -480,6 +487,6 @@
   else
   {
-    ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
     PWR_DEBUG_TRACE(Instance, "ADVICE: Update BSP_USBPD_PWR_VBUSGetVoltage");
+	val = 5000U;
   }
   *pVoltage = val;
@@ -712,5 +719,5 @@
   /* USER CODE BEGIN BSP_USBPD_PWR_VBUSIsOn */
   /* Check if instance is valid       */
-  int32_t ret;
+  int32_t ret = BSP_ERROR_NONE;
   uint8_t state = 0U;
 
@@ -721,5 +728,6 @@
   else
   {
-    ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
+    if (HAL_GPIO_ReadPin(UCPD1_VBUS_GPIO_Port, UCPD1_VBUS_Pin) == GPIO_PIN_SET)
+		state = 1U;
     PWR_DEBUG_TRACE(Instance, "ADVICE: Update BSP_USBPD_PWR_VBUSIsOn");
   }
