Skip to main content
Associate II
August 28, 2024
Solved

STM32CubeIDE generates bad DMA init code for UCPD on G0B1

  • August 28, 2024
  • 3 replies
  • 1486 views

I'm using STM32CubeIDE to configure UCPD1 on STM32G0B1KET6N.  My firmware package is FW_G0 V1.6.2

I enable DMA: UCPD1_RX = DMA2 Channel 1, UCPD1_TX = DMA2 Channel 2

The generated code in MX_UCPD1_Init can't compile because the DMA init code is bad.  The section labelled /* UCPD1_RX Init */ should start with this:

LL_DMA_SetPeriphRequest(DMA2, LL_DMA_CHANNEL_1, LL_DMAMUX_REQ_UCPD1_RX);

... but it actually starts with this:

LL_DMA_SetPeriphRequest(DMA2_Channel1, DMA2_Channel1, LL_DMAMUX_REQ_UCPD1_RX);

Compare the first two parameters.  Luckily, the compiler chokes on this and it's obvious how to fix it.  There are 8 lines with this bug for the RX DMA, and 8 lines for the TX DMA.

I don't know if my other UCPD settings influence the bug:

UCPD mode = sink

Dead battery enabled

USB/UCPD1 interrupt enabled

DMA1 4-7 / DMA2 1-5 / DMAMUX1 interrupt enabled

Pins PB15, PA8, PA9, PA10 are all configured for their UCPD1 functions.

    Best answer by FBL

     

    Thank you for your feedback @GrahamAU 

    A new ticket is reported to MX team. Internal ticket number is 189793

    3 replies

    Technical Moderator
    August 29, 2024

    Hi @GrahamAU 

    Could you let me know which version of CubeMX you are using? I attempted to reproduce the issue on my end, and the code generation worked correctly. Attached my IOC file for reference.

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.Best regards,FBL
    GrahamAUAuthor
    Associate II
    August 29, 2024

    On MacOS:

    STM32CubeIDE

    Version: 1.16.0

    Build: 21983_20240628_1741 (UTC)

     

    I tried your .ioc and it works fine.  But then I changed the DMA channels to DMA2 (not DMA1) and I get my bug.  Give it a try.

    FBLBest answer
    Technical Moderator
    August 29, 2024

     

    Thank you for your feedback @GrahamAU 

    A new ticket is reported to MX team. Internal ticket number is 189793

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.Best regards,FBL
    Technical Moderator
    December 6, 2024

    Hello @GrahamAU ,

    I would inform you that this issue was fixed with STM32CubeMX V6.13.0 by setting the right parameters for the functions called inside the initiation function of UCPD1.

    Thank you for your contribution.

    "When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
    GrahamAUAuthor
    Associate II
    December 14, 2024

    Yep.  I've just upgraded to STM32CubeIDE 1.17.0 (CubeMX 6.13.0) and I can see that the problem is fixed.

    Thanks!