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

Thread: teensy3.6 frezzes qhen acessing the dac registers

Threaded View

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    1

    teensy3.6 frezzes qhen acessing the dac registers

    I'm trying to code the DACs in the Teensy 3.6 to a synthesizer.

    The problem is that when I write in any of the registers to control the DAC module, the Teensy just stops responding!

    Does anyone know if it is needed to initialize something before accessing the registers?

    The example code is below:
    Code:
    void setDACPos(byte pos){ DAC0_C2 = (pos << 4 )| 15 ; } generateDacBuffer(); void setup() { DAC0_DAT0L = 0; Serial.println("asdasd"); generateDacBuffer(); setDACPos(0); DAC0_C1 = 1 | 1 <<6; DAC0_C0 = 1<<6 | 1 << 5 | 1 << 4; } int counter = 0; void loop() { setDACPos(counter); // selects the value to output from the buffer at counter position counter++; if(counter == 16){ counter = 0; } delay (1000); } void generateDacBuffer(){ short deltaValue = 100; short startValue= 200; short* regs =(short*) 0x400CC000; // adress to the first buffer register = DAC0_DAT0L // also craches if i use variable DAC0_DAT0L short value = startValue; for(int i = 0; i < 16; i++){ // crashes below *regs = holder;// also craches if i use variable DAC0_DAT0L . example : DAC0_DAT0L = 255; value += deltaValue; regs++; } }
    Thancks in advance
    Last edited by Frank B; 02-13-2021 at 12:36 PM. Reason: Added [code] [/code]tags

Posting Permissions

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