how to use defined values like DACC_MR

Hello Raalst. You literally made my day by posting this. I have been trying to get the Due's DAC to work in freerun mode for a long time now without success. Thanks for posting the code. I know this is an old post of yours but I was wondering if I could pick your brain a little.

I was analyzing the code you posted on Mar 2, 2013 and I have a few questions.

1- In line #79 you used the command "pmc_enable_periph_clk(dACC_ID)" I didn't know it was required to turn on the DACC_CLK manually. Can you post any info about where you found this info. As far as I know this was not mentioned in the data sheet for the SAM3X.

2- You accessed the DAC by building up from the base address, but I had previously had some luck using commands like ADC->ADC_MR = 0x08 when addressing the ADC but not with the DAC. Do you know of any reason this wouldn't work. (i.e. commands like DACC->DACC_MR = 0x03000002 etc.)

3- Why did you set the startup time to it's maximum value?

4- The DAC is in freerun mode so why did you need to read the EOC flag?

I am currently working on a project which requires the due's ADC and DAC to be in freerun mode because analogWrite is way too slow. When it comes to programming I am a newbie but eager to learn. Thanks in advance for any help you can give.