cancel
Showing results for 
Search instead for 
Did you mean: 

Dual USBPD: "Stack Port 0" and "User Port 0 Parameters" tabs missing in IDE 1.16

EStua.1
Associate III

This is very easy to reproduce:

- Create a new STM32 project using a PD-compatible MCU e.g. STM32G071CBT6 

- Enable both UCPD1 and UCPD2 as dual-role ports. Add DMA for Rx/Tx for each port.

- Enable FreeRTOS

- Enable USBPD with default port configuration "Port 0: UCPD1; Port 1: UCPD2", "Full stack", TIM1

- Looking at the "Configuration" window only Port 1 is configurable (see attached)

 

14 REPLIES 14
EStua.1
Associate III

Hi Mahmoud, Carl_G,

Unfortunately this is still pretty broken partly due to missing tabs but also due to ST's hardcoding port 0 as a SNK. You can easily reproduce this by the following:

- Configure UCPD1 as a SRC

- Configure UCPD2 as a DR

- Under port configuration, set Port 0 - UCPD2 (DR), Port 1 - UCPD1 (SRC). The tab for Port 0 SNK config is missing.

 

You might suggest ok well why don't you change the config around, so that Port 0 - UCPD1 (SRC), Port 1 - UCPD12 (DR)? Well that's broken because of the hardcoded SNK Port 0 check in .USBPD_PWR_IF_Init().

See attached.

 

 

 

Hi Estua.1,

The "hardcoded" source that you show is considered user code and you must modify it yourself. You can tell because it is between

 

USBPD_StatusTypeDef USBPD_PWR_IF_Init(void)
{
/* USER CODE BEGIN USBPD_PWR_IF_Init */
  return USBPD_ERROR;
/* USER CODE END USBPD_PWR_IF_Init */
}

 

 

 

re hardcoded - ah ok must have got that from an ST example a while back. 

 

re broken PD config - The tab is still missing so this is still an open bug.

 

re DRP - I haven't found an ST example. If you enable CAD there's a 50/50 chance of an another DRP being detected as SNK/SRC and the role change request isn't ideal. Our work around is to disable the CAD toggle in CAD_StateMachine_DRP depending on our adaptor state. i.e. if ADAP is connected, set CAD to SRC otherwise CAD SNK. This isn't a good solution so I'm hoping someone else has a better idea.

I have implemented SNK only then change to SRC only when my power is available when using other hardware. In practice this did not work well. DRP followed by a transition to SRC if necessary was much less error prone. Anyway, I had moved that question to another thread almost as soon as I posted it...

https://community.st.com/t5/stm32-mcus-embedded-software/usbpd-driver-drp-behavior/m-p/751786/highlight/true#M57865 

@EStua.1 Why isn't that a good solution? How do you make it go to SRC? Or do you just let it toggle and prevent it from toggling to SNK?