cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G071RB: USB PD application, REQUEST_DISCARDED debug message from PE.

KLim.2
Associate II

Hello

I am building an USB PD application.

- MCU: STM32G071RB

- Tool: STM32CubeIDE (Firmware version 1.6.1)

I am using 2 USB PD ports (UCPD1 and UCPD2).

The power role of UCPD1 is DRP, and UCPD2 is Sink.

And I am reading debug messages through STM32CubeMonitor-UCPD.

In my application, 2 UCPDs on the STM32 run at the same time once both ports are connected.

Sometimes, on the Sink port, I see the "REQUEST_DISCARDED" message (Type: NOTIF).

The timing I see the message is after "REQUEST" sent, "GOODCRC" received, "ACCEPT" received, and "GOODCRC" sent.

Message exchanges are normal, but PE reports "REQUEST_DISCARDED" even though message exchanges are successful.

And then, the Sink sends a "SOFT_RESET" message, and sends "HARD_RESET" eventually.

Since it is invisible to me where the "REQUEST_DISCARDED" message comes from (probably it happens in the STM32 static library), I have no idea what is happening inside.

Would it be a timing issue because 2 PEs are running at the same time or a control register have some peculiar values?

I would like to know cases that "REQUEST_DISCARDED" message is issued.

Please let me know if anyone has any idea.

Thanks

7 REPLIES 7
Nicolas P.
ST Employee

Hello @KLim.2​ ,

it could be helpful if you could attach your .cpd file here, so that we can help you.

Have you checked the Wiki ?

It would help to check if sequence before the discard is ok, and also check the timings.

Thanks and regards,

Nicolas

Hello @nicolas P​ ,

 

I have Dual-Role (UCPD1) and Sink (UCPD2) port in my application.

I am sending Request data message in several cases, and encounter "REQUEST_DISCARDED" occasionally.

The below is what I see when that happens.

 

I added a snippet and screenshot of the debug messages.

(If you don't recognize functions or values in the snippet, they are created by myself.)

 

I have no idea how I can debug this error.

 

============ In my code =============================0693W00000YAUqDQAX.png 

Hello @KLim.2​ 

Are you using the G0 eval board, that has one DRP port, and a sink only port ?

This looks interesting, but I have questions. You say that port 1 is DRP, and port 2 is sink only.

But, in your test description you say that DRP port (port 1) request a power role swap. Is it to port 2, the sink port, or another DRP device ?

How can the sink only port be source ?

To check the full sequence, it would be clearer if you could share the trace .cpd file (see Wiki), so that we have in the same file the power role swap, and all the capability messages.

Hello @Nicolas P​ ,

Each port is connected to a different device.

DRP port (Port 1) sends PR Swap control messages to another DRP device, and Sink port (Port 2) sends Request data messages to the other device attached.

And, the Sink port issues the messages depending on a power role of the DRP port.

I attached a .cpd file.

Please see timestamp from 1024146 to the end to check a error sequence.

The previous attached cpd file was deleted automatically.

I attached the file in ZIP format.

Hello @KLim.2​ 

Thanks for the trace.

It confirms the screenshot you've shared in your second post.

Looking at your code :

case USBPD_NOTIFY_STATE_SNK_READY:
    	if (GetRequestState() == REQUEST_MSG_READY)
	{
    		/* Sink Port: Send a Request message to get a new contract */
    		if (GetRequestDO() != 0) {
    			SendRequest();
    		}
    		else
    		{
    			UpdateRequestState(REQUEST_MSG_SENT);
    			SendRequestDefault();
    		}

If I understand correctly, you want to send a request whenever a port is in SNK_READY.

In the trace we see that port 1 (the DRP one) is in sink_ready, but the request is sent on port 2 (the sink only port). Is it what you want to do ?

Don't you need to specify which port will send the request ?

For the moment I don't understand why there is a discard.

Hi @Nicolas P​ ,

Your understanding is correct.

SendRequest() and SendRequestDefault() send a Request message on the Sink port side. The port number is specified inside of the functions.

In which cases is the REQUEST_DISCARDED message generated?

Where do 'NOTIF' type messages come from?

If they are from PE layer, it is going to be very difficult for me to find the error since I believe the messages are generated by the USBPD core library.

(I am using USBPDCORE_PD3_FULL_CM0PLUS_wc32.a.)