Go Down

Topic: Arduino Due Audio Library DAC Bug (Read 650 times) previous topic - next topic

GadgetFreak

Hi, first post so please be nice  :smiley-eek:

I am helping a friend out with a vector tube clock project, but have been having issues with the slow speed of DAC 0 / 1 writes on the Due so I started looking at using the Audio Sample library and the associated DACClass in the arch/sam/DAC.cpp.

In DAC.cpp the 'DACClass::begin' has the following lines:

   // DAC refresh/startup timings:
   // refresh        - 0x08 (1024*8 dacc clocks)
   // max speed mode -    0 (disabled)
   // startup time   - 0x10 (1024 dacc clocks)
   dacc_set_timing(dac, 0x08, 0, DACC_MR_STARTUP_1024);

The bug is that it uses the DACC_MR_STARTUP_1024 which is defined in component_dacc.h as (0x10u << 24)
But in dacc.c where 'dacc_set_timing' is defined this startup parameter is again shifted using DACC_MR_STARTUP_Pos which is defined as 24. The other uses of 'dacc_set_timing' in the libraries correctly use '0x10'.

I would therefore suggest that the above line should be changed to:
dacc_set_timing(dac, 0x08, 0, 0x10);


Go Up