2024-08-28 03:37 PM
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.