STM32G071 UCPD library bug or my bad?
Hello there, I have a custom board with STM32G071CB for USB Type C PD Source, dual port, RTOS, configured with CubeMX 5.3.0, after writing code on usbpd_dpm_user.c and start debugging, I suspected there are 2+1 strange behavior so I hope somebody can give me some insights why are these happening:
- in the code USBPD_SettingsTypeDef.CAD_DefaultResistor is set to 0x00u, from datasheet I am expecting UCPDx.CR.ANASUBMODE should be 1 but what I got from the debugger is 3.
- with UCPDx.CR.ANASUBMODE set to 3, UCPDx.SR.TYPEC_VSTATE_CC2 is always 1, even though the type-c connector is n.c.! modified UCPDx.CR.ANASUBMODE to 1 fixed everything (i.e. correct behavior for UCPDx cable detection).
- in USBPD_DPM_GetDataInfo I programmed like this:
switch (DataId)
{
/* Case Port Source PDO Data information */
case USBPD_CORE_DATATYPE_SRC_PDO :
*(uint32_t*)(Ptr) = 0x14019032;
*Size = 4;
break;
}I expected this will send a 5V, 500mA fixed source pdo to my usb-pd packet sniffer, that should be
611332900114, but what i get is
6103so I guess something in between my code and the wire filtered my PDO? What's wrong with my code?
