Skip to main content
Visitor II
January 11, 2022
Solved

I am looking for simplest way to request voltage from USB-PD SOURCE using STM32G0B1RE as a SINK.

  • January 11, 2022
  • 4 replies
  • 4593 views

Hello,

I am working on the STM32G0B1RE processor as a USB-PD SINK.

I would like to ask what is the easiest and fastest method (preferably using CubeMX) to request higher voltages from the USB-PD port (for example 9V or 12V)? Can anyone share the simplest code to request a different voltage from USB-PD than 5V?

Thank you and best regards.

    This topic has been closed for replies.
    Best answer by HFISTM

    Hello @Jakub Pepliński​  and thank you for your analysis.

    You are indeed right, this issue will be updated on our side.

    Meanwhile, to fix it, you can try to add this line:

    #if defined (FLASH_OPTR_DBANK) || defined(FLASH_DBANK_SUPPORT)

    instead of:

    #if defined (FLASH_OPTR_DBANK)

    in file usbpd_gui_memmap.h, line 51.

    This is due to a different flash flag name between G0 series, and it should be updated in the template accordingly.

    Can you confirms that it works for you with this fix ?

    Thank you,

    Regards

    4 replies

    ST Employee
    January 11, 2022

    Hello @Jakub Pepliński​ 

    Please see this wiki for your request: https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:STM32_Advance_USB-Power_Delivery_Sink

    It explains how to create a simple PD sink, using CubeMX.

    To select 9V or 12V, you will need to follow the complete wiki, including the advanced section.

    Best regards

    TarruAuthor
    Visitor II
    January 20, 2022

    Hello @HFISTM​ 

    Thank You for your help. I took Your advice and used information from this wiki.

    Almost everything is working with only one little issue :) I think that this is a BUG in HAL Library.

    As I said - I am using NUCLEO-G0B1RE (not NUCLEO-G071RB like in this tutorial on wiki). The difference is that STM32G0B1RE has dual bank flash memory.

    Now - when You try to use STM32CubeMonitor-UCPD and save some information in Flash using "Save all in target" there is a problem and this is not working

    In file bsp_gui.c, in function 'BSP_GUI_SaveDataInFlash(void)' - https://github.com/STMicroelectronics/STM32CubeG0/blob/03cb8e9ec0cbefad623caebe47359df0bab1d05e/Utilities/GUI_INTERFACE/bsp_gui.c#L258

    First there is set :

    erase_init.Banks = FLASH_BANK_2;

    Then Flash page is erased:

    if (HAL_OK != HAL_FLASHEx_Erase(&erase_init, &page_error))
    {
     status = GUI_ERASE_ERROR;
    }

    The page which is erased is last page of second bank.

    And then Flash memory should be write:

    if (HAL_OK != HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, GUI_FLASH_MAGIC_NUMBER, MagicNumber))
    {
     status = GUI_WRITE_ERROR;
    }

    but address to be write is GUI_FLASH_MAGIC_NUMBER which is last page of first bank (and this page is not erased).

    Look at the picture below. Everything should be clear then:

    0693W00000JMg0wQAD.png

    Visitor II
    January 22, 2022

    @Jakub Pepliński​ ,

    I am also developing with this solution, SINK:15V/3A extended capability output.

    Does this problem resolve?

    Or could somebody help to resolve this?

    Thanks,

    TarruAuthor
    Visitor II
    January 25, 2022

    Hi @Lmatt.1​ ,

    I will try to help You :)

    First of all - this issue which I described before - it's only affects processors with double flash memory banks (like STM32G0B1RE - with flash size >128kB). Please look at "RM0444 Rev 5" document, page 68 - "FLASH main features". What is the uC You are working on?

    Secondly - this problem is only relevant if You would like to save parameters in "Port Configuration" tab in STM32CubeMonitor-UCPD application.

    Is this Your case?

    TarruAuthor
    Visitor II
    January 25, 2022

    Hi @Lmatt.1​ ,

    I will try to help You :)

    First of all - this issue which I described before - it's only affects processors with double flash memory banks (like STM32G0B1RE - with flash size >128kB). Please look at "RM0444 Rev 5" document, page 68 - "FLASH main features". What is the uC You are working on?

    Secondly - this problem is only relevant if You would like to save parameters in "Port Configuration" tab in STM32CubeMonitor-UCPD application.

    Is this Your case?

    Visitor II
    January 25, 2022

    Thanks, i use STM32D0B1RE.

    You mean to add PDOs in UCPD Monitor's PORT CONFIGURE?

    For the EVM boards X-NUCLEO-STM32G0B1RE + X-NUCLEO-USBPDM1 work well.

    Maybe I have not met the probem so far.

    But, I'm not sure,maybe later will.

    0693W00000JNCMqQAP.png

    TarruAuthor
    Visitor II
    January 25, 2022

    @Lmatt.1​ 

    Ok, maybe I'm not fully understand - so this is working for You or not? :)

    You wrote earlier "Or could somebody help to resolve this?" but now You are writing "... work well" and "I have not met the probem so far".

    So... is there any problem? :D

    ST Employee
    January 28, 2022

    Hello, The X-NUCLEO-USBPDM1 allows to negotiate PDOs using Power Delivery.

    Now, with the X-NUCLEO-SNK1M1 and X-CUBE-TCPP you can also request voltage from USB-PD SOURCE using STM32G0B1RE as a SINK.

    Additional feature in X-NUCLEO-SNK1M1 is that you can also request 5V/3A when used with any NUCLEO-64 to easily add USB-C connector to any STM32.

    Of course it can also request any PDO up to 100W with NUCLEO-G071RB, NUCLEO-G474RE and NUCLEO-G0B1RE.

    You have example code in the X-CUBE-TCPP for both configuration.

    Here's the Quick Start Guide for this board: https://www.st.com/resource/en/product_presentation/x-nucleo-snk1m1_quick_start_guide.pdf

    Visitor II
    February 18, 2022