cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering the DAC DMA with HRTIM

SMile.1
Associate

Hello,

I am trying to trigger the DAC1 DMA off of the HRTIM Master channel using the hrtim_dac_trg signals on an STM32G474, but I am not getting any output on my DAC pin. The timer does seem to be running (I can see MCNTR incrementing in the debugger), and can verify I've got MCR.DACSYNC = 0x01. I also have CR.TSEL1 on DAC1 set to dac_chx_trg15 (0x0F). I have also tried enabling TIM6 w/ TRGO, and changing nothing aside from changing TSEL1 to dac_chx_trg7 I was able to see the waveform on my DAC output, which leads me to believe I am missing something in my HRTIM configuration which is causing hrtim_dac_trig to not trigger. I've attached screengrabs of the MX configuration & the HRTIM master and common register values as seen at runtime in the debugger. If there's any other relevant info I can provide let me know.

Any input would be very welcome, thanks!

0693W000003BQESQA4.png

0693W000003BPvpQAG.png

3 REPLIES 3
victagayun
Senior III

Hello, I am also looking for the same functionality but it seems HRTIM cannot trigger DAC at any setup I do.

There may be a similar project located in

Repository\STM32Cube_FW_H7_V1.9.0\Projects\NUCLEO-H743ZI\Examples\HRTIM\HRTIM_DAC_ADC_Interconnect

I haven't tried it yet so let me know how it goes.

What I did was I external trigger the DAC, and feed the HRTIM output to that external trigger.

It was a waste of 3 IOs, 1 HRTIM output and 2 DAC external inputs.

DmitryRozh
Associate

Hi all,

I also have this issue! Maybe someone (from ST) could post a very simple project with the HRTIM triggering DAC? It is very annoying to lose EXTI9 pin, and it makes trigger jitter definitely higher.

Regards,

Dmitry

riversnails
Associate

I don't know if you're still looking for this feature, but here's the answer.

As far as the operating procedure is concerned

-Hardware Settings
1. Enables the timer to be used among the timers in hrtim.
2. Set the timer to advanced.
3. Sets the period of hrtim to the period of dac trigger.
(I'm referring to the period value.)
(Please set the prescaler ratio for the periodic resolution.)
4. Set mode to free-running.
5. Use dacsyncro to set the dac to trigger.
6. Enables the roll-over function.
(It is tied to the reset update item of the item.)

If you set it up like this, you can see that it looks roughly like the picture below.

setting1.PNG

(I used stm32f334k to confirm that the detailed items may be different, but the functions for using the dac trigger are all the same.)

-Software Settings
1. Initialize with the init code generated through cube mx.
2. Run with HAL_HRTIM_WaveformCountStart function.


This will now output the dac trigger signal.


At this time, I don't see the item setting roll-over in your writing, but I think the cubemx for the stm32g474 project at the time seems incomplete.

In the current version, there are two basic/advanced modes as shown in the picture below.

When you set it to advanced mode, you can see in the picture below that you have a new item to set up roll-over.

advanced.PNG

reset.PNG


(stm32g474RE DOCS)
It is described in the section 27.3.21 DAC triggers in the Reference manual.
If you read this description, you will get a dac trigger output whenever an update event occurs for a timer with DACSYNC set.

A list of update events used here can be found in Table 231.

figure 255. shows the OR dac trigger of multiple timers by using compare to reset the timer (roll-over update).

The way I explained to you is to use roll-over to generate an update event. This setting is to generate an update event every reset and a constant dac trigger signal every cycle.

Eventually, you can generate an update event in many other ways, but using the roll-over function is the simplest way.