I am trying to generate a periodic signal with the DAC on the STM32G474 using DMA. There are tons of examples of this, and I´ve done the same in the past with an STM32L4 and F4 with no issues. However, I´m not sure if there is a problem in the STM32G4 line or a bug in the libraries/HAL code generation. I set up a simple example, just with a circular buffer of 2 samples at a slow rate, but I never get anything out, it generates on start a DMA transfer error and disables DMA.
I have tried different pins and channels. In the STM32G4, the DMA streams are multiplexed so you can use any as long as you are not using the same for other peripherals. I tried starting the timer first, including delays, calling HAL_DAC_Start() before HAL_DAC_Start_DMA() (which is redundant). Setting a value manually to the DAC works with no problem. I have tried also using Timer2. I´m using STM32CubeIDE 1.3.1 and the code is generated with STM32CubeMX 5.6.1, the latest versions.
The main.c is here, it includes all configuration: https://pastebin.com/F90s3iBz