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

Thread: Switch from Teensyduino 1.36 to 1.41 causing issues

  1. #1

    Switch from Teensyduino 1.36 to 1.41 causing issues

    Hello all, I've been using a teensy 3.2 to stream audio from an acoustic microphone and contact microphone as stereo to audacity through USB, and to save the audio to an SD card at the same time. I wrote the code in Arduino 1.6.12/Teensy 1.36. When I transferred the sketch over to Arduino 1.8.5/Teensy 1.41 the audio stream which was previously acoustic mic on one channel, contact mic on the other started streaming the acoustic microphone at a higher pitch to both channels. Not sure why the sketch doesn't work on the new version of the IDE, not sure how to fix it.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,005
    See forum rule at top of page: Always post complete source code & details to reproduce any issue!

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,173
    Quote Originally Posted by yellowjacket20 View Post
    Not sure why the sketch doesn't work on the new version of the IDE, not sure how to fix it.
    I don’t know either. There certainly hasn’t been any change which would explain this problem. It must be something subtle, maybe a new bug, maybe something in your code depending on the old version in some unanticipated way. Subtle problems aren’t the sort of thing anyone can guess with only a description. If you want me to investigate, you really do need to compose a small but complete program I can run on a Teensy here.

  4. #4
    Hi guys, sorry about not posting code originally, had to pare down the code as much as possible, as this project is for my work and I couldn't just post the whole sketch as it was. Below is the part of the code relating to the issue I'm having.

    Code:
    //Teensy 3.2, Teensyduino 1.36, Arduino 1.6.12
    //USB Type: Audio
    //96 MHz optimize speed (overclock)
    
    //Libraries
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    #include <TimeLib.h>
    
    //BC127 I/O
    #define play_pause 4
    #define streaming 5
    
    //BC127 I2S Pins
    #define bt_clk 9
    #define bt_out 13
    #define bt_sync 23
    
    //VREG pin
    #define vreg 15
    
    //LEDs
    #define blue_led 20
    
    //SparkFun Navigation Switch
    #define steady_state 18
    #define activate 19
    
    //Switch activation/verification
    int switch_state;
    
    //Switch press debounce
    long t = 0;
    long debounce = 1000;
    
    //Audio streaming
    AudioInputI2Sslave       i2s_slave1;     //xy=105,63
    AudioOutputUSB           usb1;           //xy=439,164
    AudioConnection          patchCord3(i2s_slave1, 0, usb1, 0);
    AudioConnection          patchCord4(i2s_slave1, 1, usb1, 1);
    
    void setup() {
      //Pinmodes
      pinMode(steady_state, INPUT_PULLUP);
      pinMode(activate, INPUT_PULLUP);
      pinMode(streaming, INPUT);
      pinMode(vreg, INPUT_PULLUP);
      pinMode(play_pause, OUTPUT);
      pinMode(blue_led, OUTPUT);
    
      digitalWrite(blue_led,HIGH);
      digitalWrite(play_pause, LOW);
    
      //Start serial bus and set rate
      Serial.begin(9600);
    
      //Audio Memory Allocation
      AudioMemory(100);
    }
    
    void loop() {
      switch_state = digitalRead(activate);
      if (switch_state == HIGH && millis() - t > debounce) {
        //Flicker play_pause pin until BC127 is streaming
        if (!digitalRead(streaming)) {
          while (1) {
            digitalWrite(play_pause, HIGH);
            digitalWrite(blue_led, LOW);
            delay(500);
            digitalWrite(play_pause, LOW);
            digitalWrite(blue_led, HIGH);
            delay(500);
            if (digitalRead(streaming)) break;
          }
        }
        t = millis();
      }
    }
    So the device I'm working on is a teensy 3.2, to which is attached a BC127 Bluetooth receiver which receives the audio from 2 microphones attached to the paired transmitter. Channel 1 (Left) receives the audio from an acoustic microphone, Channel 2 (Right) receives the audio from a contact microphone, and both are streamed over usb to the computer (using audacity). I have a Sparkfun navigation switch attached so I can flicker the play/pause pin of the BC127 until it starts receiving audio from the transmitter. Running in (Arduino/Teensyduino) 1.6.12/1.36, everything is fine, I get each mic on the corresponding channel of the stereo stream in audacity. Running in 1.8.5/1.41 I get only the high end of the acoustic microphone on both channels. Hope I've provided enough info, I really appreciate the help.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,173
    Oh, now I can see I2S slave mode is part of this equation. Wouldn't have guessed that.

    Can you give me a link or details about the I2S hardware you're using?

  6. #6

Tags for this Thread

Posting Permissions

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