Message Rejected for this Port Configuration on the STM32 x-cube-tcpp example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-10 07:00 AM
Good afternoon together
I got myself a Nucleo with the STM32G474RE and a shield X-NUCLEO-SNK1M1 to develop a USB-C PD interface (sink), now I cloned the example from Github, built and downloaded it. The cable and the power plug are recognised, but if I select a specific PDO, I get the following message "Message Rejected from this Port Configuration" (see picture). And no PDO is selected. How should I configure the port, if this is not already set in the example?
Solved! Go to Solution.
- Labels:
-
STM32G4 Series
-
TCPP
-
USB-PD
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-17 07:57 AM
Hello @nikolai2111 ,
Thank you for the details, I understand your problem.
In your case if you look at the very end of the trace where the message is rejected, you will see "ADVICE: update USBPD_DPM_RequestMessageRequest", which means that you are trying to use a function which is not implemented yet on this simple example. This is user code that you can make according to your needs.
If you search for the actual USBPD_DPM_RequestMessageRequest function, you will find a short explanation on what you could do with your implementation.
As a quick example to just make what you were trying to do on STM32CubeMonitorUCPD work, you can try this code:
USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage)
{
USBPD_StatusTypeDef _status = USBPD_ERROR;
/* USER CODE BEGIN USBPD_DPM_RequestMessageRequest */
uint32_t voltage, allowablepower;
USBPD_SNKRDO_TypeDef rdo;
USBPD_PDO_TypeDef pdo;
USBPD_CORE_PDO_Type_TypeDef pdo_object;
USBPD_USER_SettingsTypeDef *puser = (USBPD_USER_SettingsTypeDef *)&DPM_USER_Settings[PortNum];
USBPD_DPM_SNKPowerRequestDetailsTypeDef request_details;
rdo.d32 = 0;
/* selected SRC PDO */
pdo.d32 = DPM_Ports[PortNum].DPM_ListOfRcvSRCPDO[(IndexSrcPDO - 1)];
voltage = RequestedVoltage;
allowablepower = (puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits * RequestedVoltage) / 1000U;
if (USBPD_TRUE == USER_SERV_SNK_EvaluateMatchWithSRCPDO(PortNum, pdo.d32, &voltage, &allowablepower))
{
/* Check that voltage has been correctly selected */
if (RequestedVoltage == voltage)
{
request_details.RequestedVoltageInmVunits = RequestedVoltage;
request_details.OperatingCurrentInmAunits = (1000U * allowablepower)/RequestedVoltage;
request_details.MaxOperatingCurrentInmAunits = puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits;
request_details.MaxOperatingPowerInmWunits = puser->DPM_SNKRequestedPower.MaxOperatingPowerInmWunits;
request_details.OperatingPowerInmWunits = puser->DPM_SNKRequestedPower.OperatingPowerInmWunits;
USER_SERV_SNK_BuildRDOfromSelectedPDO(PortNum, (IndexSrcPDO - 1), &request_details, &rdo, &pdo_object);
_status = USBPD_PE_Send_Request(PortNum, rdo.d32, pdo_object);
}
}
/* USER CODE END USBPD_DPM_RequestMessageRequest */
DPM_USER_ERROR_TRACE(PortNum, _status, "REQUEST not accepted by the stack");
return _status;
}
Make sure you also export the USER_SERV_SNK_BuildRDOfromSelectedPDO and USER_SERV_SNK_EvaluateMatchWithSRCPDO functions in usbpd_user_services.h (meaning removing "static"), as you will now be calling them from a different file.
As a generic rule, where you find "ADVICE" in the trace is where you should add some code in order to implement the functionalities you need.
Hope this solves your problem,
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-10 07:45 AM
Hello @nikolai2111
You are seeing this message because your sink PDO doesn't match the Src PDOs. You will have to change the sink PDO in the application by changing them in cubeMX or directly in file usbpd_pdo_def.h.
What are your SRC PDO ? Could you share the trace ?
Please have a look at the wiki for trace & PDO description : WIKI
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-10 08:06 AM
Thank you for your quick reply!
Sorry, the images were not uploaded/attached. However, I have manually adjusted them to the PDO of the source via the UCPD Monitor / Port Configuration / Sink Capabilities.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-13 08:02 AM
Now after further investigation I noticed that only after a hard(-ware) reset the correct PDO is selected? Is this how it is supposed to be?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-17 07:57 AM
Hello @nikolai2111 ,
Thank you for the details, I understand your problem.
In your case if you look at the very end of the trace where the message is rejected, you will see "ADVICE: update USBPD_DPM_RequestMessageRequest", which means that you are trying to use a function which is not implemented yet on this simple example. This is user code that you can make according to your needs.
If you search for the actual USBPD_DPM_RequestMessageRequest function, you will find a short explanation on what you could do with your implementation.
As a quick example to just make what you were trying to do on STM32CubeMonitorUCPD work, you can try this code:
USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage)
{
USBPD_StatusTypeDef _status = USBPD_ERROR;
/* USER CODE BEGIN USBPD_DPM_RequestMessageRequest */
uint32_t voltage, allowablepower;
USBPD_SNKRDO_TypeDef rdo;
USBPD_PDO_TypeDef pdo;
USBPD_CORE_PDO_Type_TypeDef pdo_object;
USBPD_USER_SettingsTypeDef *puser = (USBPD_USER_SettingsTypeDef *)&DPM_USER_Settings[PortNum];
USBPD_DPM_SNKPowerRequestDetailsTypeDef request_details;
rdo.d32 = 0;
/* selected SRC PDO */
pdo.d32 = DPM_Ports[PortNum].DPM_ListOfRcvSRCPDO[(IndexSrcPDO - 1)];
voltage = RequestedVoltage;
allowablepower = (puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits * RequestedVoltage) / 1000U;
if (USBPD_TRUE == USER_SERV_SNK_EvaluateMatchWithSRCPDO(PortNum, pdo.d32, &voltage, &allowablepower))
{
/* Check that voltage has been correctly selected */
if (RequestedVoltage == voltage)
{
request_details.RequestedVoltageInmVunits = RequestedVoltage;
request_details.OperatingCurrentInmAunits = (1000U * allowablepower)/RequestedVoltage;
request_details.MaxOperatingCurrentInmAunits = puser->DPM_SNKRequestedPower.MaxOperatingCurrentInmAunits;
request_details.MaxOperatingPowerInmWunits = puser->DPM_SNKRequestedPower.MaxOperatingPowerInmWunits;
request_details.OperatingPowerInmWunits = puser->DPM_SNKRequestedPower.OperatingPowerInmWunits;
USER_SERV_SNK_BuildRDOfromSelectedPDO(PortNum, (IndexSrcPDO - 1), &request_details, &rdo, &pdo_object);
_status = USBPD_PE_Send_Request(PortNum, rdo.d32, pdo_object);
}
}
/* USER CODE END USBPD_DPM_RequestMessageRequest */
DPM_USER_ERROR_TRACE(PortNum, _status, "REQUEST not accepted by the stack");
return _status;
}
Make sure you also export the USER_SERV_SNK_BuildRDOfromSelectedPDO and USER_SERV_SNK_EvaluateMatchWithSRCPDO functions in usbpd_user_services.h (meaning removing "static"), as you will now be calling them from a different file.
As a generic rule, where you find "ADVICE" in the trace is where you should add some code in order to implement the functionalities you need.
Hope this solves your problem,
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-11-19 05:14 AM
Dear @HFISTM
Thank you very much!
I see now that I thought the example was already usable for simple PD tasks and configuration.
I have not implemented it yet, but will do so in the coming days.
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-10 04:15 AM - edited 2023-11-20 08:36 AM
I used this code for my G071RBT6 nucleo board with a 4 PDOs power supply (2 fixed and 2 APDOs), and the only PDO that can be requested is the first. Can't even request the one that it initializes with (the highest powered, 4th PDO, 11V@2.25A). I request the PDOs listed in UCPD Monitor but I get "request not accepted by the stack". It seems like the board can't recognize the received PDOs even though I can see them on UCPD Monitor and they're exact to specification. Maybe the PDOs are received by UCPD but ill-defined on the code/STM32CubeMX.
I already understood from the USB IF specification that the 4 byte value defines the PDO bit by bit.
I got to request the two APDOs but not quite, as I can only request them with their maximum voltages. Why can't I request them with lower voltages aka inside their operating range?
And why can't I request the second fixed PDO? It doesn't make sense.
Can't seem to understand what could be happening. Can someone shed me some light?
Here are my CubeMX definitions:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-10 11:59 PM
Hello @FelipeFRL ,
Could you please send your trace ? It will be hard to help without it.
As I can see from your cube MX screenshot is that you declared that your board would take one of the following power profile:
- 5V 3A
- 9V 2.77A
- APDO 3.3-5.9V 3A
- APDO 3.3-11V 2.25A
I assume that these are your maximum source capabilities (It could be seen in the trace). I suspect that you are not able to select a PDO because you request exactly the maximum of your source and the source declines the request.
Maybe try to lower the requested current to see if that helps. Again, we will need to look at the trace when you ask for a PDO and get the not accepted message to see what's really happening.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-11 04:22 AM - edited 2023-11-20 08:36 AM
Thanks for the fast reply!
The thing is, it ONLY accepts the APDOs requests when I request them at maximum voltage, and only then. I can't request them at a lower voltage, like their minimum 3.3V or any other voltage on the operational range.
Another issue, am I able to measure the current with this hardware (STM32G071RBT6 NUCLEO Board w/ SN1M1 Expansion Board) or do I need an external IC to sense curent with the ADC? If i can without another IC, where can I find the basic code to implement this?
Anyway, here are my traces and the port communication window in UCPD Monitor. At first it requested the highest powered PDO which is 11V@2.25A, then I requested manually the 5V fixed PDO, then 9V fixed PDO and at last the two APDOs with lower voltage than the maximum and I got "request not accepted by the stack".
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-11 04:39 AM
Thank you for your images but unfortunately there is a lot of the trace missing (source capa for example), could you please share it in .cpd format ? Please refer to this wiki.
According to the image you shared, each time you requested the power profile the source accepted it. Did it not worked (except from the message you got on ucpd monitor) ?
You can measure the current drawn on VBUS by completing the BSP_USBPD_PWR_VBUSGetCurrent function
Regards