cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate STUSB1602 to G474 in order to add USB-PD Dual Role support ?

YLV
Associate

Hello,

I am currently trying to install all the requirements in order to make the STUSB1602 work with my STMG474 custom board and FreeRTOS. And I tried for 2 entire days and I have still no code compiling.

All of my wiring is provided in the IOC down below.

First I tried to integrate the files from the library STSW-STUSB010 for P-NUCLEO-USB002 to my needs.

After adding FreeRTOS, I2C, SPI and CRC, here is what I did:

- I put the Middlewares/ST/STM32_USBPD_Library/Core into my Middlewares folder

- I put the Middlewares/ST/STM32_USBPD_Library/Devices/STUSB1602 into my Middlewares folder

- Add all scripts starting width usbpd_ from core folder from

- Removed or changed all the includes from stm32f0xxx... to stl32g4xx...

- Add all the missing includes when the file can't find more generally all usbpd typedefs

- Add defines in my project properties, else he doesn't define some constants

 - USBPD_PORT_COUNT to 1

 - USE_FULL_LL_DRIVER

 - _ERROR_RECOVERY

 - USBPDCORE_LIB_PD3_FULL

I finally added all the inc, libs and sources paths/

- Include paths:

 - Middlewares/ST/STM32_USBPD_Library/Core/inc

 - Drivers/BSP/Components/STUSB1602

 - Drivers/BSP/P-NUCLEO-USB002

 - Middlewares/ST/STM32_USBPD_Library/Devices/STUSB1602/inc

- Libs:

 - Middlewares/ST/STM32_USBPD_Library/Core/lib

Some functions impossible to find like:

- LL_TIM_IsActiveFlag_CC2

- LL_TIM_OC_SetCompareCH4

Else I followed a lot of manuals who tell how to adapt it:

- UM2063 ("STM32 USB-PD (Power Delivery software expansion) for STM32Cube" more recently called "STM32 TCPM Application")

- AN5225 ("Managing USB power delivery systems with STM32 microcontrollers)

The wiki didn't help either.

Isn't it possible to have :

- Middleware/STM32_USBPD_Library/Core for core components

- Middleware/STM32_USBPD_Library/Devices for hardware library adaptation

- Drivers/BSP/Components/STUSB1602 where I have the peripherals+registers

- One file to describe the hardware pins, why is it in Drivers/BSP/Components/P-NUCLEO-USB002/p-nucleo-usb002.h file ?

 And why can't I just use a SPI, RX/TX SPI DMA and I²c handles generated with my ioc? They will be intialized and

 all of that? It is much simpler than def

- And in the Core folder, get just one or two file like the:

 - usbpd_dpm_user.h/.c where it initialize the user code

 - usbpd_pdo_defs.h/.c where I can setup my source and sink PDO objects structures

- And eventually launch my main.c with the 4 custom steps:

 - USBPD_HW_IF_GlobalHwInit(); to init the hardware part from Drivers/BSP/Components/STUSB1602

 - USBPD_DPM_InitCore(); to launch the core sevice policy manager from Middlewares/ST/STM32_USBPD_Library/Core

 - USBPD_DPM_UserInit(); to launch the user parameters from Core/usbpd_dpm_user.h/.c folder and

 - USBPD_DPM_InitOS(); to add the thread to the list when FreeRTOS will start

And then you have you osKernelStart(); starting your os and running without anything else?

I can't merge this files together because I constantly get errors of fields not existing,

uintXX_t not found, usb pd typedef not found, usb pdo params fields missing (not compatible because not constant), etc...

Is there G4 STM32cube ready projects but using STUSB1602 chip (not the integrated USBPD integration)?

I tried with a clean project but it seems like the compiler is not ready to cooperate.

Thanks in advance.

5 REPLIES 5
NBALL
ST Employee

Hello

stm32G474 package for stusb1602 is under non regression verification.

It will be available in january.

please see private email sent.

Best regards

Nathalie

Hello,

Thank you for such a quick answer,

I just responded tou your email.

Best regards,

YLV

DBudi.2
Associate

Hi Nathalie,

i am also interested for stm32g474 package for stusb1602. Can i get as well an information as soon as it is available?

Thank you.

Kind regards,

db

Hello

I'm finalizing compliancy testing on package.

stsw-stusb014 package will be available soon.

Best regards

Nathalie

NBALL
ST Employee

Package available since this morning: https://www.st.com/en/embedded-software/stsw-stusb014.html#overview

Best regards

Nathalie