Showing results for 
Search instead for 
Did you mean: 

X-NUCLEO-SRC1M1 USB-PD Example and custom UART implementation

Associate II

HI all,

I am currently trying to port the STM32 USB-PD Example to another Board with other firmware. And still running into issues, I am unable to solve :\

1. I can not receive UART Data via HAL_UART_RECEIVE_IT, as the callback is not called.

2. I can not use PA1 as GPIO as it is turned off during initialization of the UCPD Library and can not be used afterwards.


1. I start the reception of Data via UART at program start after HAL UART Initialization via HAL_UART_RECEIVE_IT for 1byte. In the HAL_UART_RxCpltCallback, I start the reception for another Byte and add the byte to my rxBuffer and check, if a termination char was received. I have used this before. If I create an empty program, this works well, so the HW should be fine.

If I add the above code (start receive and callback) to the USB-C PD Example the callback is called once at startup (with received Byte = 0x00) and then never again when data is sent to the device.

I already tried playing with the priorities (via HAL_NVIC_SetPriority) but with no success. Any Ideas where this could be from?

2. The function "MX_USBPD_Init()" calls the following code in usbpd_dpm_core.c:

/* CAD SET UP : Port 0 */ CHECK_CAD_FUNCTION_CALL(USBPD_CAD_Init(_port_index, &CAD_cbs, &DPM_Settings[_port_index], &DPM_Params[_port_index]));

Before the function call, MODER1 of GPIOA is 0x1 (output), after the function call, MODER1 is 0x3 (analog).
If I re-configure MOODER1 to 0x1 again, it works.

For me, everything works now, just not sure if this is intended? This pin is not configured anywhere as analog, neither in the BSP Config nor in cubeMX.






Guenael Cadier
ST Employee

Hi @krbmr 

What is the initial STM32 USB-PD Example that you are using as basis (for USBPD implementation) ?
Could you share your final one project for comparison ? If not possible, could you share at least the following H files (tracer_emb_conf.h and usbpd_devices_conf.h) that should be included into your Inc/ folder.