cancel
Showing results for 
Search instead for 
Did you mean: 

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

Tarru
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

11 REPLIES 11
HFISTM
ST Employee

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

Tarru
Associate II

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

@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,

Tarru
Associate II

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?

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?

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

@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

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

Hi @HFISTM​ ,

Yes, this solution work perfectly fine.

I also figured it out a few days ago and tested it and it works great.

BTW Do You know maybe where I can find few (2-3) of this STM32G0x1 uC in TQFP48 to order? I am working on my new PD device but I do not know where I can order this processors. Every store is "out of stock" :\

Thanks!