cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32G431KBU3 - USBPD] - Problem when trying to use another ADC

CGonz.5
Associate II

Dear all,

I wanted to develop a USB Power Delivery SINK project using my STM32G431KBU3 MCU.

For that reason, I have designed a custom PCB and follwed carefully ST's WiKi:

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:STM32_Advance_USB-Power_Delivery_Sink

I have successfully created an advanced SINK aplication in which I can negotiate Up to 6 different PDOs. I have used ADC2 Channel2 to read VBUS regarding my PCB demanded that.

The point is, everything works OK but, when trying to use ADC1 for other purposes of my aplication, USBPD negotiation stops working. Only configuring ADC1 in CUBE makes USBPD stops working. I didn't use ADC1 functions yet.

When sniffing USBPD trace, I can notice that something is wrong with ADC2 Channel2, the one which monitors VUSB.

So, my question is, are ADC1 and ADC2 not compatible in this USBPD SINK application? Is there any way to use ADC1 without stopping ADC2 and USBPD app??

Thank you in avance!

12 REPLIES 12
CGonz.5
Associate II

Dear Heol,

I tried to confgure all that 3 analog inputs like this:

0693W00000JPhGcQAL.png0693W00000JPhGrQAL.png 

I started a new project without FreeRTOS, and this configuration works fine. I have my 3 channels stored continously in a 3 position, 32-bit array.

When I use exactly the same configuration but using my USBPD application and freeRTOS, DMA is corrupted: USBPD is nos responding and DMA is not storing anything in my array (I am reading that array by UART).

It seems that something is happening when using another DMA channel added to USBPD application.

Find attached my stm32g4xx_hal_msp.c file.

Thank you in advance,

Tania GUERRERO
Associate

Dear Heol,

Thanks for your outstanding support.

Case can be closed, since there is no other open topic on this request.

Thanks and Best Regards,

Tania

CGonz.5
Associate II

Dear Heol, Tania,

Issue was solved some time ago by using ADC1 channels 1, 2 and 3 with continous reading by DMA to map all my 3 parameters. I passed ADC1 channel1 reading to my PD application and channels 2 and 3 to read other magnitudes.

ADC2 was unusable at the same time thatn ADC1 if I want FreeRTOS PD application running properly, so there must be an incompatibility issue there.

Thank you for your support, you can close the thread with no problem.

Regards,

Carlos.