2026-03-31 4:00 AM - edited 2026-03-31 4:01 AM
Hello
I have my own board with STM32G071KBT6 microcontroller. I successfully comunicate with charger by PD protocol and I receive up to 21 V (PPS). But I need above 21V. I have power bank with AVS up to 28V and USB cable with e-marker (up to 240W). How to configure the stack to receive EPR parameters? I have no TCPP IC, but I use my own protection circuit. In the trace the EPR commands isn't present. I use STM32CubeIDE 2.1.1 and STM32CubeMX 6.17.0.
Thanks a lot and best regards
2026-04-20 10:28 PM - edited 2026-04-22 10:58 PM
OK, but how to do it? My trace is below.
CAD 2 1 USBPD_CAD_STATE_DETACHED 563
CAD 4 1 USBPD_CAD_STATE_ATTACHED_WAIT 564
CAD 123 1 USBPD_CAD_STATE_ATTACHED 565
NOTIF 123 1 USBSTACK_START 566
DEBUG 123 1 ADVICE: USBPD_DPM_Notification:104 567
EVENT 123 1 EVENT_ATTACHED 568
DEBUG 123 1 ADVICE: update USBPD_DPM_UserCableDetection 569
DEBUG 123 1 ADVICE: update USBPD_DPM_SetDataInfo:2 570
DEBUG 123 1 ADVICE: update USBPD_DPM_SetDataInfo:6 571
PE 124 1 PE_SNK_STARTUP 572
PE 124 1 PE_SNK_WAIT_FOR_CAPABILITIES 573
IN 149 1 SOP PD3 s:030 H:0x71A1 (id:0, DR:DFP, PR:SRC) SRC_CAPABILITIES DATA: 2C9181282CD102002CC103002CB10400F44106003C21DCC03C21A4C1
Option: EPW DRP
[1] Fixed : 5V - 3A
[2] Fixed : 9V - 3A
[3] Fixed : 12V - 3A
[4] Fixed : 15V - 3A
[5] Fixed : 20V - 5A
[6] Programmable : [3.3V - 11V] - 3A
[7] Programmable : [3.3V - 21V] - 3A
574
OUT 149 1 SOP s:002 H:0x0081 (id:0, DR:UFP, PR:SNK) GOODCRC 575
DEBUG 149 1 Received: 28 bytes 576
DEBUG 149 1 PDO[1] = 5000 mV, 3000 mA, 15 W 577
DEBUG 150 1 PDO[2] = 9000 mV, 3000 mA, 27 W 578
DEBUG 150 1 PDO[3] = 12000 mV, 3000 mA, 36 W 579
DEBUG 150 1 PDO[4] = 15000 mV, 3000 mA, 45 W 580
DEBUG 150 1 PDO[5] = 20000 mV, 5000 mA, 100 W 581
DEBUG 150 1 APDO [6] - max voltage: 11000 mV 582
DEBUG 150 1 APDO [7] - max voltage: 21000 mV 583
PE 150 1 PE_SNK_EVALUATE_CAPABILITY 584
PE 152 1 PE_SNK_SEND_REQUEST 585
OUT 152 1 SOP PD3 REQUEST s:006 H:0x1082 (id:0, DR:UFP, PR:SNK) DATA: F4D14753
ObjectPosition:5
GiveBack:0
CapabilityMismatch:0
USBCommunicationCapable:1
NoUSBSuspend:1
UnchunkedExtendedMessagesSupported:0
MaximumOperatingCurrent:5000mA
OperatingCurrent:5000mA 586
IN 153 1 SOP s:002 H:0x0161 (id:0, DR:DFP, PR:SRC) GOODCRC 587
PE 153 1 PE_SNK_SELECT_CAPABILITY 588
IN 155 1 SOP PD3 ACCEPT s:002 H:0x03A3 (id:1, DR:DFP, PR:SRC) 589
OUT 155 1 SOP s:002 H:0x0281 (id:1, DR:UFP, PR:SNK) GOODCRC 590
NOTIF 156 1 POWER_STATE_CHANGE 591
DEBUG 156 1 ADVICE: USBPD_DPM_Notification:90 592
NOTIF 156 1 REQUEST_ACCEPTED 593
DEBUG 156 1 ADVICE: USBPD_DPM_Notification:1 594
PE 156 1 PE_SNK_TRANSITION_SNK 595
IN 453 1 SOP PD3 PS_RDY s:002 H:0x05A6 (id:2, DR:DFP, PR:SRC) 596
OUT 453 1 SOP s:002 H:0x0481 (id:2, DR:UFP, PR:SNK) GOODCRC 597
NOTIF 453 1 POWER_STATE_CHANGE 598
DEBUG 453 1 ADVICE: USBPD_DPM_Notification:90 599
NOTIF 453 1 POWER_EXPLICIT_CONTRACT 600
PE 453 1 PE_STATE_READY 601
NOTIF 453 1 STATE_SNK_READY 602
DEBUG 454 1 ADVICE: USBPD_DPM_Notification:32 603
PE 454 1 PE_STATE_SEND_EPRMODE 604
DEBUG 454 1 ADVICE: update USBPD_DPM_GetDataInfo:30 605
OUT 454 1 SOP s:006 PD3 H:0x128A (id:1, DR:UFP, PR:SNK) EPR_MODE
EPR_MODE : 01000000
Action: 01
0x01 Enter Sink only
0x02 Enter Acknowledged Source only
0x03 Enter Succeeded Source only
0x04 Enter Failed Source only
0x05 Exit Sink or Source
Data: 00
0x00 - Unknown cause
0x01 - Cable not EPR capable
0x02 - Source failed to become VCONN source
0x03 - EPR Mode Capable bit not set in RDO
0x04 - Source unable to enter EPR Mode at this time
0x05 - EPR Mode Capable bit not set in PDO
606
IN 455 1 SOP s:002 H:0x03A1 (id:1, DR:DFP, PR:SRC) GOODCRC 607
PE 455 1 PE_STATE_WAIT_EPRMODE_ACK 608
IN 456 1 SOP s:006 PD3 H:0x17AA (id:3, DR:DFP, PR:SRC) EPR_MODE
EPR_MODE : 02000000
Action: 02
0x01 Enter Sink only
0x02 Enter Acknowledged Source only
0x03 Enter Succeeded Source only
0x04 Enter Failed Source only
0x05 Exit Sink or Source
Data: 00
0x00 - Unknown cause
0x01 - Cable not EPR capable
0x02 - Source failed to become VCONN source
0x03 - EPR Mode Capable bit not set in RDO
0x04 - Source unable to enter EPR Mode at this time
0x05 - EPR Mode Capable bit not set in PDO
609
OUT 456 1 SOP s:002 H:0x0681 (id:3, DR:UFP, PR:SNK) GOODCRC 610
DEBUG 457 1 ADVICE: update USBPD_DPM_SetDataInfo:23 611
NOTIF 457 1 NOTIFY_EPRMODE_ACK 612
DEBUG 457 1 ADVICE: USBPD_DPM_Notification:113 613
IN 472 1 SOP s:006 PD3 H:0x11AA (id:0, DR:DFP, PR:SRC) EPR_MODE
EPR_MODE : 03000000
Action: 03
0x01 Enter Sink only
0x02 Enter Acknowledged Source only
0x03 Enter Succeeded Source only
0x04 Enter Failed Source only
0x05 Exit Sink or Source
Data: 00
0x00 - Unknown cause
0x01 - Cable not EPR capable
0x02 - Source failed to become VCONN source
0x03 - EPR Mode Capable bit not set in RDO
0x04 - Source unable to enter EPR Mode at this time
0x05 - EPR Mode Capable bit not set in PDO
614
OUT 472 1 SOP s:002 H:0x0081 (id:0, DR:UFP, PR:SNK) GOODCRC 615
PE 473 1 PE_STATE_WAIT_EPRMODE_STATUS 616
DEBUG 473 1 ADVICE: update USBPD_DPM_SetDataInfo:23 617
NOTIF 473 1 NOTIFY_EPRMODE_SUCCEEDED 618
DEBUG 473 1 ADVICE: USBPD_DPM_Notification:114 619
PE 473 1 PE_SNK_WAIT_FOR_CAPABILITIES 620
IN 475 1 SOP s:030 PD3 H:0xF3B1 (id:1, DR:DFP, PR:SRC) EXT_EPR_SOURCE_CAPA EXT:CNu0Ch1CReq0DSiz32 [ CHUNK BEGIN ] DATA: 2C9181282CD102002CC103002CB10400F44106003C21DCC03C21 621
OUT 475 1 SOP s:002 H:0x0281 (id:1, DR:UFP, PR:SNK) GOODCRC 622
OUT 476 1 SOP s:006 PD3 H:0x9491 (id:2, DR:UFP, PR:SNK) EXT_EPR_SOURCE_CAPA EXT:CNu1Ch1CReq1DSiz0 DATA: 0000 623
IN 478 1 SOP s:002 H:0x05A1 (id:2, DR:DFP, PR:SRC) GOODCRC 624
IN 479 1 SOP s:014 PD3 H:0xB5B1 (id:2, DR:DFP, PR:SRC) EXT_EPR_SOURCE_CAPA EXT:CNu1Ch1CReq0DSiz36 [ CHUNK END ]
EPR SOURCE CAPA
[1] Fixed : 5V - 3A
[2] Fixed : 9V - 3A
[3] Fixed : 12V - 3A
[4] Fixed : 15V - 3A
[5] Fixed : 20V - 5A
[6] EPR : [11V - 3.3V] - 60W
[7] EPR : [21V - 3.3V] - 60W
[8] Fixed : 28V - 5A
[9] EPR : [28V - 15V] - 140W
DATA: A4C1F4C188008C9630D2 625
OUT 479 1 SOP s:002 H:0x0481 (id:2, DR:UFP, PR:SNK) GOODCRC 626
DEBUG 480 1 Received: 28 bytes 627
DEBUG 480 1 PDO[1] = 5000 mV, 3000 mA, 15 W 628
DEBUG 480 1 PDO[2] = 9000 mV, 3000 mA, 27 W 629
DEBUG 480 1 PDO[3] = 12000 mV, 3000 mA, 36 W 630
DEBUG 480 1 PDO[4] = 15000 mV, 3000 mA, 45 W 631
DEBUG 480 1 PDO[5] = 20000 mV, 5000 mA, 100 W 632
DEBUG 480 1 APDO [6] - max voltage: 11000 mV 633
DEBUG 480 1 APDO [7] - max voltage: 21000 mV 634
DEBUG 481 1 EPR - received: 4 bytes 635
DEBUG 481 1 Called: 1 x 636
DEBUG 481 1 0x0088C1F4 637
DEBUG 481 1 EPR - max voltage: 6800 mV 638
PE 481 1 PE_SNK_EVALUATE_CAPABILITY 639
PE 482 1 PE_SNK_SEND_REQUEST 640
DEBUG 482 1 ADVICE: update USBPD_DPM_GetDataInfo:29 641
OUT 482 1 SOP PD3 EPR_REQUEST s:010 H:0x2689 (id:3, DR:UFP, PR:SNK) DATA: F4D1475300000000
ObjectPosition:5
GiveBack:0
CapabilityMismatch:0
USBCommunicationCapable:1
NoUSBSuspend:1
UnchunkedExtendedMessagesSupported:0
MaximumOperatingCurrent:5000mA
OperatingCurrent:5000mA 642
IN 484 1 SOP s:002 H:0x07A1 (id:3, DR:DFP, PR:SRC) GOODCRC 643
PE 484 1 PE_SNK_SELECT_CAPABILITY 644
IN 485 1 SOP PD3 ACCEPT s:002 H:0x07A3 (id:3, DR:DFP, PR:SRC) 645
OUT 485 1 SOP s:002 H:0x0681 (id:3, DR:UFP, PR:SNK) GOODCRC 646
NOTIF 486 1 POWER_STATE_CHANGE 647
DEBUG 486 1 ADVICE: USBPD_DPM_Notification:90 648
NOTIF 486 1 REQUEST_ACCEPTED 649
DEBUG 486 1 ADVICE: USBPD_DPM_Notification:1 650
PE 486 1 PE_SNK_TRANSITION_SNK 651
IN 781 1 SOP PD3 PS_RDY s:002 H:0x09A6 (id:4, DR:DFP, PR:SRC) 652
OUT 781 1 SOP s:002 H:0x0881 (id:4, DR:UFP, PR:SNK) GOODCRC 653
NOTIF 781 1 POWER_STATE_CHANGE 654
DEBUG 781 1 ADVICE: USBPD_DPM_Notification:90 655
NOTIF 781 1 POWER_EXPLICIT_CONTRACT 656
PE 781 1 PE_STATE_READY 657
NOTIF 781 1 STATE_SNK_READY 658
DEBUG 781 1 ADVICE: USBPD_DPM_Notification:32 659
PE 781 1 PE_STATE_SEND_EPRMODE 660
DEBUG 781 1 ADVICE: update USBPD_DPM_GetDataInfo:30 661
OUT 781 1 SOP s:006 PD3 H:0x188A (id:4, DR:UFP, PR:SNK) EPR_MODE
EPR_MODE : 01000000
Action: 01
0x01 Enter Sink only
0x02 Enter Acknowledged Source only
0x03 Enter Succeeded Source only
0x04 Enter Failed Source only
0x05 Exit Sink or Source
Data: 00
0x00 - Unknown cause
0x01 - Cable not EPR capable
0x02 - Source failed to become VCONN source
0x03 - EPR Mode Capable bit not set in RDO
0x04 - Source unable to enter EPR Mode at this time
0x05 - EPR Mode Capable bit not set in PDO
662
IN 783 1 SOP s:002 H:0x09A1 (id:4, DR:DFP, PR:SRC) GOODCRC 663
PE 783 1 PE_STATE_WAIT_EPRMODE_ACK 664
IN 1747 1 HRST 665
NOTIF 1747 1 HARDRESET_RX 666
DEBUG 1747 1 ADVICE: USBPD_DPM_Notification:30 667
PE 1747 1 PE_HARD_RESET_RECEIVED 668
PE 1747 1 PE_SNK_HARD_RESET_WAIT_VSAFE_0V 669
GUI 0 BOARD RESET BY USER 670
CAD 4 1 USBPD_CAD_STATE_ATTACHED_WAIT 671
OK, I have checked it. The message is chunked - below:
391 IN 1042 1 SOP s:030 PD3 H:0xF3B1 (id:1, DR:DFP, PR:SRC) EXT_EPR_SOURCE_CAPA EXT:CNu0Ch1CReq0DSiz32 [ CHUNK BEGIN ] DATA: 2C9181282CD102002CC103002CB10400F44106003C21DCC03C21
392 OUT 1042 1 SOP s:002 H:0x0281 (id:1, DR:UFP, PR:SNK) GOODCRC
393 OUT 1043 1 SOP s:006 PD3 H:0x9491 (id:2, DR:UFP, PR:SNK) EXT_EPR_SOURCE_CAPA EXT:CNu1Ch1CReq1DSiz0 DATA: 0000
394 IN 1044 1 SOP s:002 H:0x05A1 (id:2, DR:DFP, PR:SRC) GOODCRC
395 IN 1046 1 SOP s:014 PD3 H:0xB5B1 (id:2, DR:DFP, PR:SRC) EXT_EPR_SOURCE_CAPA EXT:CNu1Ch1CReq0DSiz36 [ CHUNK END ] / EPR SOURCE CAPA / [1] Fixed : 5V - 3A / [2] Fixed : 9V - 3A / [3] Fixed : 12V - 3A / [4] Fixed : 15V - 3A / [5] Fixed : 20V - 5A / [6] EPR : [11V - 3.3V] - 60W / [7] EPR : [21V - 3.3V] - 60W / [8] Fixed : 28V - 5A / [9] EPR : [28V - 15V] - 140W / DATA: A4C1F4C188008C9630D2
During the test I have discovered, that "EPR" variable in my code (below) takes on the different value depending on the "x" variable. I.e. x=1 -> EPR=0xD230968C, so Max_voltage_100mV*100=28000. Once I have 4 bytes (Size = 4). How to recognize all PDO and APDO values?
case USBPD_CORE_DATATYPE_RCV_SRC_PDO_EPR:
{
uint32_t x=1;
uint32_t EPR_1=0;
uint32_t EPR_2=0;
uint32_t EPR_3=0;
uint32_t EPR_4=0;
uint32_t EPR=0;
DPM_USER_DEBUG_TRACE(PortNum, "EPR - received: %lu bytes", Size);
EPR_1=0;
EPR_2=0;
EPR_3=0;
EPR_4=0;
EPR=0;
EPR_1=(uint32_t)Ptr[x*4U+0U]<<0;
EPR_2=(uint32_t)Ptr[x*4U+1U]<<8;
EPR_3=(uint32_t)Ptr[x*4U+2U]<<16;
EPR_4=(uint32_t)Ptr[x*4U+3U]<<24;
EPR=EPR_1|EPR_2|EPR_3|EPR_4;
DPM_USER_DEBUG_TRACE(PortNum, "0x%08lX", EPR);
uint32_t Max_Voltage_100mV=(EPR>>17);
Max_Voltage_100mV = Max_Voltage_100mV&0b00000000000000000000000111111111;
DPM_USER_DEBUG_TRACE(PortNum, "EPR - max voltage: %lu mV", (Max_Voltage_100mV*100));
}
Best regards
Jaroslaw
2026-04-23 7:53 AM
OK @Jaroslaw_T since USBPD_CORE_DATATYPE_RCV_SRC_PDO_EPR only exposes the first 4 bytes of the reassembled extended payload and source is sending properly chunked messages, the limitation appears to be in the middleware. Could you confirm reproducing using latest version of stm32-mw-usbpd-core v5.4? If possible to reproduce on one of our reference boards to confirm the issue is not linked to your hardware setup.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-04-23 10:28 PM - edited 2026-04-23 11:12 PM
Yes, @FBL I have using the last USPPD core (v5.4) from GITHUB.
I have modified my code and I found:
for "x" = 0 - I have information about EPR PDO,
for "x" = 1- I have information about EPR APDO
But how to recognize the max number of "x"?
My code after changing:
case USBPD_CORE_DATATYPE_RCV_SRC_PDO_EPR:
{
uint32_t x=0;
uint32_t EPR_1=0;
uint32_t EPR_2=0;
uint32_t EPR_3=0;
uint32_t EPR_4=0;
uint32_t EPR=0;
DPM_USER_DEBUG_TRACE(PortNum, "EPR - received: %lu bytes", Size);
EPR_1=0;
EPR_2=0;
EPR_3=0;
EPR_4=0;
EPR=0;
EPR_1=(uint32_t)Ptr[x*4U+0U]<<0;
EPR_2=(uint32_t)Ptr[x*4U+1U]<<8;
EPR_3=(uint32_t)Ptr[x*4U+2U]<<16;
EPR_4=(uint32_t)Ptr[x*4U+3U]<<24;
EPR=EPR_1|EPR_2|EPR_3|EPR_4;
if((EPR&0b11000000000000000000000000000000UL)!=0b11000000000000000000000000000000UL)
{
DPM_USER_DEBUG_TRACE(PortNum, "0x%08lX", EPR);
EPR_Voltage=(EPR>>10);
EPR_Voltage=EPR_Voltage&0b00000000000000000000001111111111;
EPR_Voltage=EPR_Voltage*50;
EPR_Current=EPR&0b00000000000000000000001111111111;
EPR_Current=EPR_Current*10;
DPM_USER_DEBUG_TRACE(PortNum, "EPR = %lu mV, %lu mA", EPR_Voltage, EPR_Current);
}
if((EPR&0b11000000000000000000000000000000UL)==0b11000000000000000000000000000000UL)
{
DPM_USER_DEBUG_TRACE(PortNum, "0x%08lX", EPR);
uint32_t Max_Voltage_100mV=(EPR>>17);
Max_Voltage_100mV = Max_Voltage_100mV&0b00000000000000000000000111111111;
DPM_USER_DEBUG_TRACE(PortNum, "EPR - max voltage: %lu mV", (Max_Voltage_100mV*100));
}
}
break;
In the next step I have used global variable Number_Of_EPR_PDO:
main.c
uint8_t Number_Of_EPR_PDO = 0;
main.h
extern uint8_t Number_Of_EPR_PDO;
And in usbpd_dpm_user.c I have information about 1 PDO (Number_Of_EPR_PDO = 1)
case USBPD_CORE_DATATYPE_RCV_SRC_PDO_EPR:
{
Number_Of_EPR_PDO++;
uint8_t x=0;
uint32_t EPR_1=0;
uint32_t EPR_2=0;
uint32_t EPR_3=0;
uint32_t EPR_4=0;
uint32_t EPR=0;
DPM_USER_DEBUG_TRACE(PortNum, "EPR - received: %lu bytes, %d PDOs", Size, Number_Of_EPR_PDO);1507 DEBUG 1050 1 EPR - received: 4 bytes, 1 PDOs
Best regards
Jaroslaw
2026-04-27 11:16 PM
Hello community
I have done another test.
In trace I have 9 positions - last one is AVS 15 - 28V, 140W:
2707 IN 1048 1 SOP s:014 PD3 H:0xB5B1 (id:2, DR:DFP, PR:SRC) EXT_EPR_SOURCE_CAPA EXT:CNu1Ch1CReq0DSiz36 [ CHUNK END ] / EPR SOURCE CAPA / [1] Fixed : 5V - 3A / [2] Fixed : 9V - 3A / [3] Fixed : 12V - 3A / [4] Fixed : 15V - 3A / [5] Fixed : 20V - 5A / [6] EPR : [11V - 3.3V] - 60W / [7] EPR : [21V - 3.3V] - 60W / [8] Fixed : 28V - 5A / [9] EPR : [28V - 15V] - 140W / DATA: A4C1F4C188008C9630D2So I have tried to choose 9 position:
DPM_USER_DEBUG_TRACE(PortNum, "AVS mode");
rdo.d32=0;
rdo.AVSRDO.EPR_Capable=1U;
rdo.AVSRDO.ObjectPosition=9;
rdo.AVSRDO.OutputVoltageIn25mV=960;
rdo.AVSRDO.OperatingCurrentIn50mAunits=60U; //3A
rdo.AVSRDO.NoUSBSuspend=USBPD_ENABLE;
rdo.AVSRDO.USBCommunicationsCapable=USBPD_ENABLE;
rdo.AVSRDO.CapabilityMismatch=0;
*PtrPowerObjectType=USBPD_CORE_PDO_TYPE_AVSPDO;
*PtrRequestData=rdo.d32;
But the stack sent strange values:
2720 PE 1050 1 PE_SNK_EVALUATE_CAPABILITY
2721 DEBUG 1052 1 AVS mode
2722 PE 1052 1 PE_SNK_SEND_REQUEST
2723 DEBUG 1052 1 ADVICE: update USBPD_DPM_GetDataInfo:29
2724 OUT 1052 1 SOP PD3 EPR_REQUEST s:010 H:0x2689 (id:3, DR:UFP, PR:SNK) DATA: 3C80479300000000 / ObjectPosition:1 / GiveBack:0 / CapabilityMismatch:0 / USBCommunicationCapable:1 / NoUSBSuspend:1 / UnchunkedExtendedMessagesSupported:0 / MaximumOperatingCurrent:600mA / OperatingCurrent:4800mA
2725 IN 1054 1 SOP s:002 H:0x07A1 (id:3, DR:DFP, PR:SRC) GOODCRC
2726 PE 1054 1 PE_SNK_SELECT_CAPABILITY
2727 IN 1055 1 HRST
2728 NOTIF 1055 1 HARDRESET_RX
Why?
Best regards
Jaroslaw