cancel
Showing results for 
Search instead for 
Did you mean: 

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?

VNado.1
Associate III
 
1 ACCEPTED SOLUTION

Accepted Solutions
  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

View solution in original post

6 REPLIES 6

Which STM32?

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

JW

Ons KOOLI
Senior III

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.

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

  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
Associate III
  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
Senior III

Hi VNado.1,

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

Best Regards,

Ons.