cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get connection to STM32CubeMonitor-UCPD with NUCLEO-G474RE and X-NUCLEO-USBPDM1

S.Cross
Associate II

After following the instructions in AN5418 and the corresponding Youtube video I am still struggling to get a connection with my NUCLEO-G474RE board to the UCPD monitor.

When i am flashing the precompiled binary files, which i downloaded for the X-NUCLEO-USBPDM1, i can access the board via the UCPD monitor, so the connection between PC and NUCLEO board can be established.

Following the hints for using the STM32G4 series, instead of the STM32G0 series in AN5418 (e.g. using USART1, instead of LPUART1, and several other changes) and building my own code, i can get no connection to the UCPD monitor.

Has anyone a similar setup, or the possibility to get the original code, which is the source of the precompiled binary files? Or can me give some hints for this setup?

Thank you and best regards

1 ACCEPTED SOLUTION

Accepted Solutions

Hello

Thanks for this constructive remark !

Then, we will integrate a modification in CubeMX (V6.0.0) to be able to call USBPD_DPM_Run in the main while loop (in NO RTOS Mode) and remove the do {} while(1) code in the function.

Something like this:

int main(void)
{
(...)
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
    /* Start USBPD Processes*/
    USBPD_DPM_Run();
 
    /* USER CODE BEGIN 3 */
  }
 
And 
 
=> usbpd_dpm_core.c
void USBPD_DPM_Run(void)
{
  //do
  //{
(...)
  //}
  //while (1u == 1u);
}
 

View solution in original post

5 REPLIES 5
Yohann M.
ST Employee

Dear @S.Cross​ 

Please find an application I did in using USART1 as well.

I hope, it will help you to compare with your own project.

Regards,

Yohann

Thank you for your reply! Apparently using an RTOS is essential to get the USBPD DPM working on the STM32G474RE. Now i have been succesful in getting a connection between the NUCLEO-G474RE and the STM32CubeMonitor-UCPD, BUT using the LPUART1 as tracing connection, instead of USART1.

I checked your comment and I confirm a pb during the generation in NRTOS mode.

Please try the following patch (after disabling FreeRTOS in your CubeMX environment):

int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_USBPD_Init();
  MX_ADC1_Init();
  /* USER CODE BEGIN 2 */
 
  /* USER CODE END 2 */
 
  /* USBPD initialisation ---------------------------------*/
  USBPD_DPM_Run();  /* Start the USBPD processes in NRTOS mode */

Thank you for your reply! I already tried this setup in NRTOS mode, but then i can not execute any code in the main loop, because the USBPD_DPM_Run() starts an infinite loop. So RTOS is required, if i want to do something in the main loop, right?

Hello

Thanks for this constructive remark !

Then, we will integrate a modification in CubeMX (V6.0.0) to be able to call USBPD_DPM_Run in the main while loop (in NO RTOS Mode) and remove the do {} while(1) code in the function.

Something like this:

int main(void)
{
(...)
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
    /* Start USBPD Processes*/
    USBPD_DPM_Run();
 
    /* USER CODE BEGIN 3 */
  }
 
And 
 
=> usbpd_dpm_core.c
void USBPD_DPM_Run(void)
{
  //do
  //{
(...)
  //}
  //while (1u == 1u);
}