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

Thread: Flash memory disturbs Dac audio output

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

    Flash memory disturbs Dac audio output

    I'm making a simple application playing notes from a flash memory to the Dac output.
    The flash memory is an 16 Mbit direct add-on to my Teensy 3.2 from Pesky product.

    Everything plays as expected apart from a weak tone (a few hundred Hertz) in the background that is not on the file in the memory.
    It continues as long as file is read from the memory.

    Does anyone have any idea how to get rid of the disturbing sound?
    The memory uses pin 13 as SCK which at the same time is the LED-pin. Can that be the problem?

    Tomas

    Simple example sketch:
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SerialFlash.h>
    #include <Bounce.h>
    
    // Create the Audio components.  These should be created in the
    // order data flows, inputs/sources -> processing -> outputs
    //
    AudioPlaySerialflashRaw     bas0;
    
    AudioMixer4        mix1;    
    AudioOutputAnalog  dac;     // play to on-chip DAC
    
    // Create Audio connections between the components
    //
    AudioConnection c1(bas0, 0, mix1, 0);
    AudioConnection c3(mix1, 0, dac, 0);
    
    //Using 16Mbit SPI Flash memory add-ons for Teensy from Pesky products
    // SPI flash
    #define MOSI              11   // kets
    #define MISO              12
    #define SCK               13
    #define CSPIN             10   // kets
    
    
    void setup() {
      Serial.begin(9600);
    
      // Audio connections require memory to work.  For more
      // detailed information, see the MemoryAndCpuUsage example
      AudioMemory(30);
      
      //Set up SPI
      SPI.setMOSI(MOSI);
      SPI.setMISO(MISO);
      SPI.setSCK(SCK);
      if (!SerialFlash.begin(CSPIN)) {
        while (1) {
          Serial.println("Unable to access SPI Flash chip");
          delay(1000);
        }
      }
    
    
      // by default the Teensy 3.1 DAC uses 3.3Vp-p output
      // if your 3.3V power has noise, switching to the
      // internal 1.2V reference can give you a clean signal
      //dac.analogReference(INTERNAL);
    
      mix1.gain(0, 0.3);
    }
    
    void loop() {
      bas0.play("C1.RAW");
      delay(5000);
    }
    Last edited by Frank B; 04-02-2019 at 10:12 AM. Reason: added 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
  •