2024-04-02 12:48 AM - edited 2024-04-02 01:24 AM
Hi STMicroelectronics Team,
I'm using a STEVAL-2STPD01 USB PD Board with STM32G071RBT6 NUCLEO-G071RB controller board. I'm using it in a Source Mode.
I'm trying to get the Input Power value (field = "send free text") which was entered in the STM32Cubemonitor-UCPD software out of the software so that I can set the USB Sink according to the input power (since it is having an option of power sharing between the two USB type-c ports).
Since the Source Capabilities at the two Type-C sink port depends on the Input power, this information is required.
Can you guys help me, how can I get that value out of the software (STM32Cubemonitor-UCPD).
Yes. I know that I can be able to see that information in Trace window, But I want to extract that information from software to process it externally.
Regards,
Mohan Krishna N D
2024-04-03 06:26 AM
Hello @tenxermohan
Did you have a look at the Wiki ?
There is an example on how to use the "send free text" feature.
Regards,
Nicolas
2024-04-05 12:48 AM
Hey @Nicolas P.
Thanks for the comment.
I did read the wiki page. But the concern is to extract the data user has entered in the Free text area iof STM32CubeMonitor-UCPD software.
I want that information to set the sink Voltage and Current automatically.
Regards,
Mohan Krishna N D
2024-04-05 03:10 AM
Hello @tenxermohan
I'm not sure to fully understand your need.
The freetext section if for you to customize any action in your firmware and trigger it by sending a "free text" in cubemonitor UCPD.
If you want to have a mechanism to select the right voltage (meaning to request a given PDO from a source), you can use the already build in feature of cubeMonitor to do it: https://www.st.com/resource/en/user_manual/um2468-stm32cubemonitorucpd-software-tool-for-usb-typec-powerdelivery-port-management-stmicroelectronics.pdf
Could you please elaborate on your use case ? Are you building a source or a sink ? It will be the sink that asks for a specific voltage from the source (if supported by the source), not the other way around.
As a reminder, we have wikis on how to build Sink, Source, and DRP with CubeMX:
https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:STM32_Advance_USB-Power_Delivery_Sink
https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Source
https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Dual_Role
Regards
2024-04-10 05:13 AM
Hi @HFISTM
Thanks for the reply.
Ok, here is the thing.
I'm building a Source. I'm using STEVAL-2STPD01 board as a source which can supply required power according to the sink's request.
I'm trying to automate this thing.
Once the input power has been entered into the STM32Cubemonitor-UCPD (free text area), I need to take that information and I need to set the Sink requests according to that.
here I'm using Mikroe USB C PD 3 Click to act as a sink.
So, I wanted to take input from the software that what is the value entered into software, so that I can send command to My PD3 sink to set the voltage accordingly, hence the power negotiation will be success.
Any help/suggestions are appreciated.
Regards,
Mohan
2024-04-10 05:44 AM
Hello @tenxermohan,
Thank you for you explanation, it seems clearer to me.
On thing you could do is to create a function that will be called when the freetex is received, to control the click-board sink depending on the freetext value:
USBPD_StatusTypeDef processFreeText(uint8_t PortNum, uint8_t * pData, uint16_t Size);
{
if (memcmp(pData, "I want 5V", Size) == 0)
{
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, PortNum, 0, "5V asked", strlen("5V asked"));
mickroePD3Click_Request(5); // example
}
if (memcmp(pData, "I want 9V", Size) == 0)
{
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, PortNum, 0, "9V asked", strlen("9V asked"));
mickroePD3Click_Request(9); // example
}
if (memcmp(pData, "I want 15V", Size) == 0)
{
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, PortNum, 0, "15V asked", strlen("15V asked"));
mickroePD3Click_Request(15); // example
}
return USBPD_OK;
}
You will have to register this function to be called upon freetext reception by calling this coed at the start of your application:
GUI_RegisterCallback_FreeText(processFreeText);
Does this answer your request ?
Best regards
2024-04-11 04:36 AM
Hey @HFISTM
Thanks for your valuable input.
I will try to implement this and get back to you with the results.
regards,
Mohan
2024-04-12 03:02 AM
Hey @HFISTM
In addition to this, from wiki, I could only be able to get information about
But there is no wiki page nor a document regarding
NUCLEO-G071RBT6 and the STEVAL-2STPD01 board.
Because even the code which we need to add once CODE GENERATION. is done, will also going to be different depending on the type of extension board we use.
Can you guys help me in configuring the NUCLEO-G071RBT6 and the STEVAL-2STPD01 board as SOURCE.
Regards,
Mohan Krishna N D
2024-04-12 04:44 AM
Hello @tenxermohan,
If you want a specific example with this board I'll sugest you to have a look at the code example that was provided with it: STSW-2STPD01
But please be aware that it may not be as up to date as the wiki you linked, as PowerDelivery is a specification that evoluates quickly, especially for the middleware version. You may find more recent MW versions on GitHub
The application structure should be the same, but without CubeMX, you should be able to mix the two if needed.
Best regards