Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Teensy 3.2 DAC power mode

  1. #1
    Junior Member
    Join Date
    Dec 2019
    Posts
    1

    Teensy 3.2 DAC power mode

    Hello,

    I saw in the datasheet on pg 47 that the response time of the Teensy 3.2 DAC is 30us in high power mode, and 200us in low power mode.

    Apprently the power mode can be set with the following bit: DACx_C0:LPEN = 0. I tried using it but I can only address "DACx_C0=0" which turns off the DAC altogether.

    Is Teensy 3.2 by any chance set to high-power DAC mode by default?

    Thanks in advance.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,751
    My guess is that it by default in high powered mode, as I don't see anywhere in the code base that sets: DAC_C0_LPEN

    You did not give any reference on how you are using it? Are you using external library....

    But searching Teensyduino install, the only place in core\teensy3 that sets this register is in analog.c
    void analogWriteDAC0(int val)
    {
    Code:
    #if defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
    	SIM_SCGC2 |= SIM_SCGC2_DAC0;
    	if (analog_reference_internal) {
    		DAC0_C0 = DAC_C0_DACEN;  // 1.2V ref is DACREF_1
    	} else {
    		DAC0_C0 = DAC_C0_DACEN | DAC_C0_DACRFS; // 3.3V VDDA is DACREF_2
    	}
    	__asm__ ("usat    %[value], #12, %[value]\n\t" : [value] "+r" (val));  // 0 <= val <= 4095
    
    	*(volatile aliased_int16_t *)&(DAC0_DAT0L) = val;
    #elif defined(__MKL26Z64__)
    ...
    The defines like DAC_C0_DACEN are in the file kinetis.h.
    So mainly they set the enable bit and they may set the 1.2v reference bit...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •