Skip to main content
VNado.1
Associate III
December 16, 2020
Solved

Can I use TIM7 for DAC1 Channel1 and TIM6 for DAC1 Channel2 (two different timers..) ? Second question, there is HAL_DAC_ConvCpltCallbackCh1 however I cannot find HAL_DAC_ConvCpltCallbackCh2, does it exist for the DAC1Channel2?

  • December 16, 2020
  • 6 replies
  • 1388 views

..

This topic has been closed for replies.
Best answer by waclawek.jan
  1. See the DAC chapter of given family's Reference Manual. Look at the registers. Is there a separate item to select trigger for both DAC channels? If yes, that means that you can use different trigger sources for the two different DAC channels.
  2. https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac.c#L223 : user can add his own code by customization of function pointer HAL_DAC_ConvCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2(). Note the extra "Ex" in the name and that whomever wrote that sentence, copy/pasted it from above and forgot to omit the "Half". HAL_DACEx_ConvCpltCallbackCh2() is indeed defined (as weak), and called in https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac_ex.c#L587

JW

6 replies

waclawek.jan
Super User
December 17, 2020

Which STM32?

If 'F2/'F4, then answer to first question is yes.

JW

VNado.1
VNado.1Author
Associate III
December 17, 2020

It is a L4+. I guess it also works?

Ons KOOLI
Associate
December 17, 2020

Hi VNado.1,

  1. Yes, you can. Please refer to the STM32CubeXX FW package, where XX is the product you are working with. You can find DAC examples.
  2. Yes it exists. Please refer to the hal_dac drivers in the STM32CubeXX FW package

Best Regards,

Ons.

waclawek.jan
waclawek.janBest answer
Super User
December 17, 2020
  1. See the DAC chapter of given family's Reference Manual. Look at the registers. Is there a separate item to select trigger for both DAC channels? If yes, that means that you can use different trigger sources for the two different DAC channels.
  2. https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac.c#L223 : user can add his own code by customization of function pointer HAL_DAC_ConvCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2(). Note the extra "Ex" in the name and that whomever wrote that sentence, copy/pasted it from above and forgot to omit the "Half". HAL_DACEx_ConvCpltCallbackCh2() is indeed defined (as weak), and called in https://github.com/STMicroelectronics/STM32CubeL4/blob/master/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac_ex.c#L587

JW

VNado.1
VNado.1Author
Associate III
December 17, 2020
  1. This is what I found in the manual,

"Dual DAC channel independent or simultaneous conversions

• External triggers for conversion

The DAC channels are triggered through the timer update outputs that are also connected to different DMA channels."

2. I also saw this, but I wasn't sure if it was an error or something I was missing out.

Thanks!

Ons KOOLI
Associate
December 18, 2020

Hi VNado.1,

In case your question is answered, please mark it by selecting the best answer.

Best Regards,

Ons.