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

Thread: Problems setting up Teensy D Audio board on Teensy 4.0

  1. #1
    Junior Member
    Join Date
    Sep 2019
    Posts
    19

    Problems setting up Teensy D Audio board on Teensy 4.0

    I have connected my Teensy 4.0 to an Audio shield Revision D
    and I get no headphone output using the recommended guitar test.

    The Audio shield is mounted on top of the Teensy 4 using female headers
    pointing down onto the pins soldered to the Teensy 4 . I have checked the
    continuity from below the pins on the Teensy to the top surface of the
    Audio shield and all conduct. (This way if more connections are required then using
    the female headers it allows me to separate the 2 boards and connect extra pins.)
    N.B. Only the 16 pins given in the diagram below have been implemented.
    Is that correct ?
    Without the Audio shield the Teensy works perfectly accepting many
    of my previous C programs and the examples e.g. Blink and uses the
    serial channel.
    With the shield the guitar sketch downloads but when I open the
    serial channel in Tools it fails not recognising the serial channel.

    I believe my soldering to be ok and I have resoldered any junctions that
    could be dry.

    Can any one help ?

    Click image for larger version. 

Name:	teensy4_audio_pins.jpg 
Views:	11 
Size:	69.4 KB 
ID:	17907
    Click image for larger version. 

Name:	0[2].jpg 
Views:	25 
Size:	125.8 KB 
ID:	17906Click image for larger version. 

Name:	0[3].jpg 
Views:	32 
Size:	62.4 KB 
ID:	17908Click image for larger version. 

Name:	0[1].jpg 
Views:	27 
Size:	137.4 KB 
ID:	17909

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,792
    This really looks like it should work. At least in these photos, I can't see anything wrong.

    I can at least answer this:

    Only the 16 pins given in the diagram below have been implemented.
    Is that correct ?
    Yes, that is correct.

    In fact, the Synthesis > Guitar example should play sound on the headphones using only pins 7, 18, 19, 20, 21, 23, GND, & 3.3V. The other pins aren't needed for that example to run. Pins 6, 8, 10, 11, 12, 13, 15 aren't used in any way by that example, which is why it's recommended as a first test.

    This is really getting into wild guesswork... but have you tried running the example without it plugged into the breadboard? I recall we've had at least 1 case before where a breadboard had some hidden internal problem (many of them are very cheaply made) and things magically worked when it wasn't plugged in.

  3. #3
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Paul, I've bought 2 audio boards, 3 Teensy 4.0 's and numerous headers from both Cool Components and PJRC Nothing works - even removed from the breadboard. Is there anyway that I could make a final purchase of a soldered and tested pair of Teensy + Audio shield from PJRC. My interest lies in programming not construction.
    Brian Fish

  4. #4
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    Brian,

    I've had some unusual results with Teensy 4/Audioboard that I haven't got to the bottom of yet - some sketches run consistentley others do not. I've used the Audioboard with other Teensy 3.xs and this inconsistency is unusual.

    I know you are assuming a hardware fault but can I ask a question and ask you to try something with the software:
    - are you using the Arduino IDE and if so what version and is it PC or Mac.
    - can you try the example Audio/Tutorial/Part_01_02_Hardware_Test (you should get a beep and a message on the serial port if it works

    Cheers, Paul

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,792
    One more quick sanity check is the DC voltage on the 3 headphone pins, relative to GND on Teensy. If the SGTL5000 chip is running properly, you should see about 1.5V on each pin.

    Here's one running on my desk right now. My multimeter measures 1.54 volts between any of the pins and the shell of the USB connector (GND).

    Click image for larger version. 

Name:	DSC_0636_web.jpg 
Views:	7 
Size:	130.6 KB 
ID:	17947

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    I have a T4 Audio board Rev D and the testing I've done has worked well - including hardware test with Beep on Two T4's.

    Post specifics for repro of other sketches examples and can give them a try.
    Click image for larger version. 

Name:	20191017_005614r.jpg 
Views:	4 
Size:	52.3 KB 
ID:	17948Click image for larger version. 

Name:	20191017_005637r.jpg 
Views:	5 
Size:	77.3 KB 
ID:	17949
    Just assembled this T4 into a castellated T_3.6 format board and female header Rev D audio seems to work.


    Quote Originally Posted by PaulStoffregen View Post
    One more quick sanity check is the DC voltage on the 3 headphone pins, relative to GND on Teensy. If the SGTL5000 chip is running properly, you should see about 1.5V on each pin.

    Here's one running on my desk right now. My multimeter measures 1.54 volts between any of the pins and the shell of the USB connector (GND).
    ...
    I get 1.58 volts on the three … it is running the hardware test sketch

  7. #7
    Junior Member
    Join Date
    Sep 2019
    Posts
    19

    Reply from Brian 44

    Quote Originally Posted by houtson View Post
    Brian,

    I've had some unusual results with Teensy 4/Audioboard that I haven't got to the bottom of yet - some sketches run consistentley others do not. I've used the Audioboard with other Teensy 3.xs and this inconsistency is unusual.

    I know you are assuming a hardware fault but can I ask a question and ask you to try something with the software:
    - are you using the Arduino IDE and if so what version and is it PC or Mac.
    - can you try the example Audio/Tutorial/Part_01_02_Hardware_Test (you should get a beep and a message on the serial port if it works

    Cheers, Paul
    Houtson & Paul, I use a PC Win 10, 1.4.10 Version of Arduino overwritten with Teensyduino 1.48 for windows selecting ONLY the Audio library. The other libraries are unchecked.
    I tried the Part_01_02_ Hardware Test. No Beep.( My computer didn't recognise the USB serial line which is usual for running any sketch using the Audio shield)
    There was no DC voltage on the headphone pins but 3.3V was present on the audio chip.
    Hope this helps. I am returning Teensy+Audio board to Paul today for him to assess the hardware.
    Thanks, Brian Fish

  8. #8
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    I'm still having some issues, I've tried it now with 2 T4 and Audioboard combo with same results which ends in no Audio and 0V between GND and headphones (Paul's test from above).

    A repeatable sequence for me that highlights the issue is:
    1. Load the beep test (Audio/Tutorial/Part_01_02_Hardware_Test and below) all is well - DC voltage at headphone, beeps and serial indicating running
    2. Unplug from USB and plug back in everything remains good, Teensy reboots and beeps away
    3. Load the second sketch which is a simple wave shape effect and again all is well - DC voltage at headphone, beeps and serial indicating running
    4. Unplug from USB and plug back in and I have the issue- no DC voltage, no tone, serial indicates it is running

    From that point the only way I get it running again is start at 1 (reload the beep test) which again runs fine

    Might be something wrong with the test sketch or my setup but if anyone can try or point out anything obvious that's be appreciated, strange that it works the first time until I pull the USB.

    For this I'm using Arduino 1.8.1, Teensy 1.48 on MacOS 10.13.

    Code and pictures below, thanks Paul



    Bleep test
    Code:
    // Advanced Microcontroller-based Audio Workshop
    //
    // http://www.pjrc.com/store/audio_tutorial_kit.html
    // https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
    // 
    // Part 1-2: Test Hardware
    //
    // Simple beeping is pre-loaded on the Teensy, so
    // it will create sound and print info to the serial
    // monitor when plugged into a PC.
    //
    // This program is supposed to be pre-loaded before
    // the workshop, so Teensy+Audio will beep when
    // plugged in.
    
    #include <Audio.h>
    #include <Wire.h>
    #include <SD.h>
    #include <SPI.h>
    #include <SerialFlash.h>
    #include <Bounce.h>
    
    AudioSynthWaveform    waveform1;
    AudioOutputI2S        i2s1;
    AudioConnection       patchCord1(waveform1, 0, i2s1, 0);
    AudioConnection       patchCord2(waveform1, 0, i2s1, 1);
    AudioControlSGTL5000  sgtl5000_1;
    
    Bounce button0 = Bounce(0, 15);
    Bounce button1 = Bounce(1, 15);
    Bounce button2 = Bounce(2, 15);
    
    int count=1;
    int a1history=0, a2history=0, a3history=0;
    
    void setup() {
      AudioMemory(10);
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(2, INPUT_PULLUP);
      Serial.begin(115200);
      sgtl5000_1.enable();
      sgtl5000_1.volume(0.3);
      waveform1.begin(WAVEFORM_SINE);
      delay(1000);
      button0.update();
      button1.update();
      button2.update();
      a1history = analogRead(A1);
      a2history = analogRead(A2);
      a3history = analogRead(A3);
    }
    
    
    
    
    void loop() {
      Serial.print("Beep #");
      Serial.println(count);
      count = count + 1;
      waveform1.frequency(440);
      waveform1.amplitude(0.9);
      wait(250);
      waveform1.amplitude(0);
      wait(1750);
    }
    
    void wait(unsigned int milliseconds)
    {
      elapsedMillis msec=0;
    
      while (msec <= milliseconds) {
        button0.update();
        button1.update();
        button2.update();
        if (button0.fallingEdge()) Serial.println("Button (pin 0) Press");
        if (button1.fallingEdge()) Serial.println("Button (pin 1) Press");
        if (button2.fallingEdge()) Serial.println("Button (pin 2) Press");
        if (button0.risingEdge()) Serial.println("Button (pin 0) Release");
        if (button1.risingEdge()) Serial.println("Button (pin 1) Release");
        if (button2.risingEdge()) Serial.println("Button (pin 2) Release");
        int a1 = analogRead(A1);
        int a2 = analogRead(A2);
        int a3 = analogRead(A3);
        if (a1 > a1history + 50 || a1 < a1history - 50) {
          Serial.print("Knob (pin A1) = ");
          Serial.println(a1);
          a1history = a1;
        }
        if (a2 > a2history + 50 || a2 < a2history - 50) {
          Serial.print("Knob (pin A2) = ");
          Serial.println(a2);
          a2history = a2;
        }
        if (a3 > a3history + 50 || a3 < a3history - 50) {
          Serial.print("Knob (pin A3) = ");
          Serial.println(a3);
          a3history = a3;
        }
      }
    }

    Second Sketch that works to start then fails after USB removed
    Code:
    #include <Audio.h>
    
    
    AudioSynthWaveform       waveform;
    AudioEffectWaveshaper    waveshape1;
    AudioOutputI2S           i2s2;
    AudioConnection          patchCord1(waveform, 0, waveshape1, 0);
    AudioConnection          patchCord2(waveshape1, 0, i2s2, 0);
    AudioConnection          patchCord3(waveshape1, 0, i2s2, 1);
    AudioControlSGTL5000     sgtl5000_1;
    
    const float wave_shape_flat[2] = {
      -1.0,
      1.0
    };
    
    const float wave_shape_chebyshev_3rd [257] =
    { 
      -1.0,-0.9375,-0.8671875,-0.796875,-0.734375,-0.671875,-0.609375,-0.546875,-0.484375,-0.4296875,-0.375,-0.3203125,
      -0.265625,-0.2109375,-0.15625,-0.109375,-0.0546875,-0.0078125,0.0390625,0.078125,0.125,0.1640625,0.2109375,0.25,
      0.2890625,0.328125,0.359375,0.3984375,0.4296875,0.46875,0.5,0.53125,0.5546875,0.5859375,0.6171875,0.640625,0.6640625,
      0.6953125,0.71875,0.734375,0.7578125,0.78125,0.796875,0.8203125,0.8359375,0.8515625,0.8671875,0.8828125,0.890625,
      0.90625,0.921875,0.9296875,0.9375,0.953125,0.9609375,0.96875,0.96875,0.9765625,0.984375,0.984375,0.9921875,0.9921875,
      0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.984375,0.984375,0.9765625,0.9765625,0.96875,
      0.9609375,0.953125,0.9453125,0.9375,0.9296875,0.921875,0.90625,0.8984375,0.890625,0.875,0.8671875,0.8515625,0.8359375,
      0.828125,0.8125,0.796875,0.78125,0.765625,0.75,0.734375,0.71875,0.703125,0.6796875,0.6640625,0.6484375,0.6328125,0.609375,
      0.59375,0.5703125,0.5546875,0.53125,0.515625,0.4921875,0.46875,0.453125,0.4296875,0.40625,0.3828125,0.359375,0.34375,0.3203125,
      0.296875,0.2734375,0.25,0.2265625,0.203125,0.1796875,0.15625,0.1328125,0.109375,0.0859375,0.0625,0.0390625,0.015625,0,
      -0.0234375,-0.046875,-0.0703125,-0.09375,-0.1171875,-0.140625,-0.1640625,-0.1875,-0.2109375,-0.234375,-0.2578125,-0.28125,
      -0.3046875,-0.328125,-0.3515625,-0.3671875,-0.390625,-0.4140625,-0.4375,-0.4609375,-0.4765625,-0.5,-0.5234375,-0.5390625,
      -0.5625,-0.578125,-0.6015625,-0.6171875,-0.640625,-0.65625,-0.671875,-0.6875,-0.7109375,-0.7265625,-0.7421875,-0.7578125,
      -0.7734375,-0.7890625,-0.8046875,-0.8203125,-0.8359375,-0.84375,-0.859375,-0.875,-0.8828125,-0.8984375,-0.90625,-0.9140625,
      -0.9296875,-0.9375,-0.9453125,-0.953125,-0.9609375,-0.96875,-0.9765625,-0.984375,-0.984375,-0.9921875,-0.9921875,-1,-1,-1,-1,
      -1,-1,-1,-1,-1,-0.9921875,-0.9921875,-0.984375,-0.9765625,-0.9765625,-0.96875,-0.9609375,-0.9453125,-0.9375,-0.9296875,-0.9140625,
      -0.8984375,-0.890625,-0.875,-0.859375,-0.84375,-0.828125,-0.8046875,-0.7890625,-0.765625,-0.7421875,-0.7265625,-0.703125,
      -0.671875,-0.6484375,-0.625,-0.59375,-0.5625,-0.5390625,-0.5078125,-0.4765625,-0.4375,-0.40625,-0.3671875,-0.3359375,-0.296875,
      -0.2578125,-0.21875,-0.171875,-0.1328125,-0.0859375,-0.046875,0,0.046875,0.1015625,0.1484375,0.203125,0.2578125,0.3125,0.3671875,
      0.421875,0.4765625,0.5390625,0.6015625,0.6640625,0.7265625,0.7890625,0.859375,0.9296875,0.9996875
    };
    
    const float wave_shape_chebyshev_6th [257] =
    {
      0.490693441,0.270855938,0.072669375,-0.104991361,-0.263216483,-0.403061926,-0.525549963,-0.631669818,-0.722378276,
      -0.79860028,-0.861229534,-0.911129093,-0.949131951,-0.976041622,-0.992632719,-0.999651527,-0.997816569,-0.987819169,
      -0.970324009,-0.945969683,-0.915369243,-0.879110741,-0.837757768,-0.791849987,-0.741903658,-0.688412162,-0.631846518,
      -0.572655896,-0.511268125,-0.448090193,-0.383508747,-0.317890586,-0.251583144,-0.184914977,-0.118196241,-0.05171916,
      0.014241505,0.079427988,0.143599071,0.206529621,0.268010148,0.327846365,0.385858743,0.441882084,0.495765094,0.547369957,
      0.59657192,0.643258879,0.687330973,0.728700181,0.767289925,0.803034675,0.835879566,0.86578001,0.892701325,0.916618355,
      0.93751511,0.955384399,0.970227472,0.982053671,0.990880081,0.996731184,0.999638529,0.999640393,0.996781454,0.991112473,
      0.982689972,0.971575925,0.957837447,0.941546494,0.922779566,0.90161741,0.87814474,0.852449947,0.824624828,0.794764306,
      0.762966172,0.729330814,0.693960964,0.656961444,0.61843892,0.578501658,0.537259286,0.494822565,0.451303155,0.406813401,
      0.361466108,0.315374332,0.268651175,0.221409575,0.173762116,0.125820832,0.077697021,0.029501059,-0.018657772,-0.066671461,
      -0.114433432,-0.161838711,-0.208784079,-0.255168227,-0.300891902,-0.345858051,-0.389971958,-0.433141375,-0.475276652,
      -0.516290858,-0.556099899,-0.594622629,-0.63178096,-0.667499963,-0.701707965,-0.734336644,-0.765321112,-0.794600003,
      -0.822115545,-0.847813638,-0.871643916,-0.893559814,-0.913518623,-0.931481545,-0.947413734,-0.961284349,-0.973066581,
      -0.982737693,-0.990279043,-0.99567611,-0.998918508,-1,-0.998918508,-0.99567611,-0.990279043,-0.982737693,-0.973066581,
      -0.961284349,-0.947413734,-0.931481545,-0.913518623,-0.893559814,-0.871643916,-0.847813638,-0.822115545,-0.794600003,
      -0.765321112,-0.734336644,-0.701707965,-0.667499963,-0.63178096,-0.594622629,-0.556099899,-0.516290858,-0.475276652,
      -0.433141375,-0.389971958,-0.345858051,-0.300891902,-0.255168227,-0.208784079,-0.161838711,-0.114433432,-0.066671461,
      -0.018657772,0.029501059,0.077697021,0.125820832,0.173762116,0.221409575,0.268651175,0.315374332,0.361466108,0.406813401,
      0.451303155,0.494822565,0.537259286,0.578501658,0.61843892,0.656961444,0.693960964,0.729330814,0.762966172,0.794764306,
      0.824624828,0.852449947,0.87814474,0.90161741,0.922779566,0.941546494,0.957837447,0.971575925,0.982689972,0.991112473,
      0.996781454,0.999640393,0.999638529,0.996731184,0.990880081,0.982053671,0.970227472,0.955384399,0.93751511,0.916618355,
      0.892701325,0.86578001,0.835879566,0.803034675,0.767289925,0.728700181,0.687330973,0.643258879,0.59657192,0.547369957,
      0.495765094,0.441882084,0.385858743,0.327846365,0.268010148,0.206529621,0.143599071,0.079427988,0.014241505,-0.05171916,
      -0.118196241,-0.184914977,-0.251583144,-0.317890586,-0.383508747,-0.448090193,-0.511268125,-0.572655896,-0.631846518,
      -0.688412162,-0.741903658,-0.791849987,-0.837757768,-0.879110741,-0.915369243,-0.945969683,-0.970324009,-0.987819169,
      -0.997816569,-0.999651527,-0.992632719,-0.976041622,-0.949131951,-0.911129093,-0.861229534,-0.79860028,-0.722378276,
      -0.631669818,-0.525549963,-0.403061926,-0.263216483,-0.104991361,0.072669375,0.270855938,0.490693441,0.733342528,1
    };
    
     int i = 0;
    void setup() {
      Serial.begin(9600);
      AudioMemory(40);
      waveform.begin(1.0, 200.0, WAVEFORM_SINE);
     
    }
    
    void loop() {
      Serial.print("Running:");
      Serial.println(i++);
      waveshape1.shape((float *)wave_shape_flat, 2);
      delay (500);
      waveshape1.shape((float *)wave_shape_chebyshev_3rd, 257);
      delay(500);
      waveshape1.shape((float *)wave_shape_chebyshev_6th, 257);
      delay(500);
    }

    Click image for larger version. 

Name:	IMG_1966.jpg 
Views:	14 
Size:	118.1 KB 
ID:	17953

    Click image for larger version. 

Name:	IMG_1965.jpg 
Views:	12 
Size:	115.3 KB 
ID:	17955

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Quote Originally Posted by Brian44 View Post
    Houtson & Paul, I use a PC Win 10, 1.4.10 Version of Arduino overwritten with Teensyduino 1.48 for windows selecting ONLY the Audio library. The other libraries are unchecked.
    Strange that this compiled correctly. The audio library needs other libraries (e.g. Wire to talk to the SGTL5000). Try to install with ALL TD libraries.

  10. #10
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    Quote Originally Posted by WMXZ View Post
    Strange that this compiled correctly. The audio library needs other libraries (e.g. Wire to talk to the SGTL5000). Try to install with ALL TD libraries.
    Thanks for having a look at this, I tried again with the second sketch including all the libs, same result - after remove from USB, serial indicates running but no tone.

    for completeness the updated second sketch
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SD.h>
    #include <SPI.h>
    #include <SerialFlash.h>
    
    
    AudioSynthWaveform       waveform;
    AudioEffectWaveshaper    waveshape1;
    AudioOutputI2S           i2s2;
    AudioConnection          patchCord1(waveform, 0, waveshape1, 0);
    AudioConnection          patchCord2(waveshape1, 0, i2s2, 0);
    AudioConnection          patchCord3(waveshape1, 0, i2s2, 1);
    AudioControlSGTL5000     sgtl5000_1;
    
    const float wave_shape_flat[2] = {
      -1.0,
      1.0
    };
    
    const float wave_shape_chebyshev_3rd [257] =
    { 
      -1.0,-0.9375,-0.8671875,-0.796875,-0.734375,-0.671875,-0.609375,-0.546875,-0.484375,-0.4296875,-0.375,-0.3203125,
      -0.265625,-0.2109375,-0.15625,-0.109375,-0.0546875,-0.0078125,0.0390625,0.078125,0.125,0.1640625,0.2109375,0.25,
      0.2890625,0.328125,0.359375,0.3984375,0.4296875,0.46875,0.5,0.53125,0.5546875,0.5859375,0.6171875,0.640625,0.6640625,
      0.6953125,0.71875,0.734375,0.7578125,0.78125,0.796875,0.8203125,0.8359375,0.8515625,0.8671875,0.8828125,0.890625,
      0.90625,0.921875,0.9296875,0.9375,0.953125,0.9609375,0.96875,0.96875,0.9765625,0.984375,0.984375,0.9921875,0.9921875,
      0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.9921875,0.984375,0.984375,0.9765625,0.9765625,0.96875,
      0.9609375,0.953125,0.9453125,0.9375,0.9296875,0.921875,0.90625,0.8984375,0.890625,0.875,0.8671875,0.8515625,0.8359375,
      0.828125,0.8125,0.796875,0.78125,0.765625,0.75,0.734375,0.71875,0.703125,0.6796875,0.6640625,0.6484375,0.6328125,0.609375,
      0.59375,0.5703125,0.5546875,0.53125,0.515625,0.4921875,0.46875,0.453125,0.4296875,0.40625,0.3828125,0.359375,0.34375,0.3203125,
      0.296875,0.2734375,0.25,0.2265625,0.203125,0.1796875,0.15625,0.1328125,0.109375,0.0859375,0.0625,0.0390625,0.015625,0,
      -0.0234375,-0.046875,-0.0703125,-0.09375,-0.1171875,-0.140625,-0.1640625,-0.1875,-0.2109375,-0.234375,-0.2578125,-0.28125,
      -0.3046875,-0.328125,-0.3515625,-0.3671875,-0.390625,-0.4140625,-0.4375,-0.4609375,-0.4765625,-0.5,-0.5234375,-0.5390625,
      -0.5625,-0.578125,-0.6015625,-0.6171875,-0.640625,-0.65625,-0.671875,-0.6875,-0.7109375,-0.7265625,-0.7421875,-0.7578125,
      -0.7734375,-0.7890625,-0.8046875,-0.8203125,-0.8359375,-0.84375,-0.859375,-0.875,-0.8828125,-0.8984375,-0.90625,-0.9140625,
      -0.9296875,-0.9375,-0.9453125,-0.953125,-0.9609375,-0.96875,-0.9765625,-0.984375,-0.984375,-0.9921875,-0.9921875,-1,-1,-1,-1,
      -1,-1,-1,-1,-1,-0.9921875,-0.9921875,-0.984375,-0.9765625,-0.9765625,-0.96875,-0.9609375,-0.9453125,-0.9375,-0.9296875,-0.9140625,
      -0.8984375,-0.890625,-0.875,-0.859375,-0.84375,-0.828125,-0.8046875,-0.7890625,-0.765625,-0.7421875,-0.7265625,-0.703125,
      -0.671875,-0.6484375,-0.625,-0.59375,-0.5625,-0.5390625,-0.5078125,-0.4765625,-0.4375,-0.40625,-0.3671875,-0.3359375,-0.296875,
      -0.2578125,-0.21875,-0.171875,-0.1328125,-0.0859375,-0.046875,0,0.046875,0.1015625,0.1484375,0.203125,0.2578125,0.3125,0.3671875,
      0.421875,0.4765625,0.5390625,0.6015625,0.6640625,0.7265625,0.7890625,0.859375,0.9296875,0.9996875
    };
    
    const float wave_shape_chebyshev_6th [257] =
    {
      0.490693441,0.270855938,0.072669375,-0.104991361,-0.263216483,-0.403061926,-0.525549963,-0.631669818,-0.722378276,
      -0.79860028,-0.861229534,-0.911129093,-0.949131951,-0.976041622,-0.992632719,-0.999651527,-0.997816569,-0.987819169,
      -0.970324009,-0.945969683,-0.915369243,-0.879110741,-0.837757768,-0.791849987,-0.741903658,-0.688412162,-0.631846518,
      -0.572655896,-0.511268125,-0.448090193,-0.383508747,-0.317890586,-0.251583144,-0.184914977,-0.118196241,-0.05171916,
      0.014241505,0.079427988,0.143599071,0.206529621,0.268010148,0.327846365,0.385858743,0.441882084,0.495765094,0.547369957,
      0.59657192,0.643258879,0.687330973,0.728700181,0.767289925,0.803034675,0.835879566,0.86578001,0.892701325,0.916618355,
      0.93751511,0.955384399,0.970227472,0.982053671,0.990880081,0.996731184,0.999638529,0.999640393,0.996781454,0.991112473,
      0.982689972,0.971575925,0.957837447,0.941546494,0.922779566,0.90161741,0.87814474,0.852449947,0.824624828,0.794764306,
      0.762966172,0.729330814,0.693960964,0.656961444,0.61843892,0.578501658,0.537259286,0.494822565,0.451303155,0.406813401,
      0.361466108,0.315374332,0.268651175,0.221409575,0.173762116,0.125820832,0.077697021,0.029501059,-0.018657772,-0.066671461,
      -0.114433432,-0.161838711,-0.208784079,-0.255168227,-0.300891902,-0.345858051,-0.389971958,-0.433141375,-0.475276652,
      -0.516290858,-0.556099899,-0.594622629,-0.63178096,-0.667499963,-0.701707965,-0.734336644,-0.765321112,-0.794600003,
      -0.822115545,-0.847813638,-0.871643916,-0.893559814,-0.913518623,-0.931481545,-0.947413734,-0.961284349,-0.973066581,
      -0.982737693,-0.990279043,-0.99567611,-0.998918508,-1,-0.998918508,-0.99567611,-0.990279043,-0.982737693,-0.973066581,
      -0.961284349,-0.947413734,-0.931481545,-0.913518623,-0.893559814,-0.871643916,-0.847813638,-0.822115545,-0.794600003,
      -0.765321112,-0.734336644,-0.701707965,-0.667499963,-0.63178096,-0.594622629,-0.556099899,-0.516290858,-0.475276652,
      -0.433141375,-0.389971958,-0.345858051,-0.300891902,-0.255168227,-0.208784079,-0.161838711,-0.114433432,-0.066671461,
      -0.018657772,0.029501059,0.077697021,0.125820832,0.173762116,0.221409575,0.268651175,0.315374332,0.361466108,0.406813401,
      0.451303155,0.494822565,0.537259286,0.578501658,0.61843892,0.656961444,0.693960964,0.729330814,0.762966172,0.794764306,
      0.824624828,0.852449947,0.87814474,0.90161741,0.922779566,0.941546494,0.957837447,0.971575925,0.982689972,0.991112473,
      0.996781454,0.999640393,0.999638529,0.996731184,0.990880081,0.982053671,0.970227472,0.955384399,0.93751511,0.916618355,
      0.892701325,0.86578001,0.835879566,0.803034675,0.767289925,0.728700181,0.687330973,0.643258879,0.59657192,0.547369957,
      0.495765094,0.441882084,0.385858743,0.327846365,0.268010148,0.206529621,0.143599071,0.079427988,0.014241505,-0.05171916,
      -0.118196241,-0.184914977,-0.251583144,-0.317890586,-0.383508747,-0.448090193,-0.511268125,-0.572655896,-0.631846518,
      -0.688412162,-0.741903658,-0.791849987,-0.837757768,-0.879110741,-0.915369243,-0.945969683,-0.970324009,-0.987819169,
      -0.997816569,-0.999651527,-0.992632719,-0.976041622,-0.949131951,-0.911129093,-0.861229534,-0.79860028,-0.722378276,
      -0.631669818,-0.525549963,-0.403061926,-0.263216483,-0.104991361,0.072669375,0.270855938,0.490693441,0.733342528,1
    };
    
     int i = 0;
    void setup() {
      Serial.begin(9600);
      AudioMemory(40);
      waveform.begin(1.0, 200.0, WAVEFORM_SINE);
     
    }
    
    void loop() {
      Serial.print("Running:");
      Serial.println(i++);
      waveshape1.shape((float *)wave_shape_flat, 2);
      delay (500);
      waveshape1.shape((float *)wave_shape_chebyshev_3rd, 257);
      delay(500);
      waveshape1.shape((float *)wave_shape_chebyshev_6th, 257);
      delay(500);
    }

  11. #11
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Wmxz. Thanks for the advice to install ALL libraries. I will indeed do that. It did however compile. At this time, after trying all suggestions with no +be outcome, I have returned T4+Audio to pjrc for testing. The return time could be one month because I live in the uk.
    I am impressed with your soldering.

  12. #12
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    Quote Originally Posted by houtson View Post
    Thanks for having a look at this, I tried again with the second sketch including all the libs, same result - after remove from USB, serial indicates running but no tone.

    for completeness the updated second sketch
    … p#10 code ...
    Running that sketch with my single bottom female header Rev D board it worked on the first Teensy_4 I tried - having run the to be noted sketch first ...

    Putting it on the second top pinned T4 did not make any sound until I ran this sketch :: "T:\arduino_1.8.10\hardware\teensy\avr\libraries\A udio\examples\Tutorial\Part_1_02_Hardware_Test\Par t_1_02_Hardware_Test.ino"

    That sketch worked to make TONE

    Then while still powered I uploaded p#10 sketch and it worked as well.

    I turned OFF the power to the T4 and it powered up 'Running:#' on Sermon - but no sound.

    There is something wrong with that code doing initialization of the Audio board it seems … like :: sgtl5000_1.enable();

    Adding these two BOLD lines in setup() gets sound:
    Code:
    void setup() {
      Serial.begin(9600);
      sgtl5000_1.enable();
      sgtl5000_1.volume(0.3);
      AudioMemory(40);
      waveform.begin(1.0, 200.0, WAVEFORM_SINE);
    }

  13. #13
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    If my memory serves me correctly then Audio.h alone contains all the :
    #include <*.h> statements to bring in the relevant headers ?

  14. #14
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    Quote Originally Posted by Brian44 View Post
    If my memory serves me correctly then Audio.h alone contains all the :
    #include <*.h> statements to bring in the relevant headers ?
    Look at the Audio examples - they seem to include a few libs. Any not included get brought in elsewhere.

    To experiment open and build an audio example - then comment them out in turn and see what happens?

    It was by code comparing to published example I found the issue in p#12.

  15. #15
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Actually commenting out the #include statements was what I did before electing to include only audio.h. The reason for doing that was that, at one stage, I was producing compilation failure due to multiple instances of library objects. I resolved that issue but selected only audio.h from the teensyduino overwrite.

  16. #16
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Quote Originally Posted by Brian44 View Post
    It did however compile.
    It may have compiled to Arduino and not Teensy libraries, that are in a different folder and take precedence in compiling and linking.
    In the post I referred to, you were saying you installed ONLY Audio library when yo run Teensyduino. The includes in the sketch are not necessary and you may only include audio.h

  17. #17
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    Quote Originally Posted by Brian44 View Post
    Actually commenting out the #include statements was what I did before electing to include only audio.h. The reason for doing that was that, at one stage, I was producing compilation failure due to multiple instances of library objects. I resolved that issue but selected only audio.h from the teensyduino overwrite.

    Multiple Library indications that are just 'information'. With IDE 1.8.10 there are lots of them - including SINGLE libraries are often shown, true multiples with show the source for both.

    In either case - the one used to build is indicated with Verbose turned on showing the path of used libraries.

    Here is what Audio Part_1_02_hardware_test looks like here after a working build:
    Code:
    Multiple libraries were found for "Audio.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Audio
    Multiple libraries were found for "SPI.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SPI
    Multiple libraries were found for "SD.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SD
     Not used: T:\arduino_1.8.10\libraries\SD
    Multiple libraries were found for "SerialFlash.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SerialFlash
    Multiple libraries were found for "Wire.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Wire
    Multiple libraries were found for "Bounce.h"
     Used: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Bounce
    Using library Audio at version 1.3 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Audio 
    Using library SPI at version 1.0 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SPI 
    Using library SD at version 1.2.2 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SD 
    Using library SerialFlash at version 0.5 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\SerialFlash 
    Using library Wire at version 1.0 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Wire 
    Using library Bounce in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\Bounce (legacy)

  18. #18
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    There is something wrong with that code doing initialization of the Audio board it seems … like :: sgtl5000_1.enable();

    Adding these two BOLD lines in setup() gets sound:
    Code:
    void setup() {
    Serial.begin(9600);
    sgtl5000_1.enable();
    sgtl5000_1.volume(0.3);

    AudioMemory(40);
    waveform.begin(1.0, 200.0, WAVEFORM_SINE);
    }
    Thanks for looking at that @Defrafster that fixes it for me and makes sense (sgtl must have been enabled from first sketch then when power removed needs re-enabled). All good for me with T4+Audioboard.

  19. #19
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Defragster. That link time printout that’s you gave me will be a very useful diagnostic. Thanks. I think you have hit the nub of the problem !
    Although I used to teach C for the UK open university my knowledge of libraries, precedences etc is now somewhat lacking (I’m an Ada man really). I will printout your audit trail and compare it against what is produced on my m/c.

  20. #20
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Dear defragster, This is the end of the verbose build trail which I get on compiling Part_01_02_hardware_test :

    .
    .
    .
    Multiple libraries were found for "SPI.h"
    Used: C:\Arduino
    Multiple libraries were found for "SD.h"
    Used: C:\Arduino
    Not used: C:\Arduino
    Multiple libraries were found for "SerialFlash.h"
    Used: C:\Arduino
    Multiple libraries were found for "Wire.h"
    Used: C:\Arduino
    Multiple libraries were found for "Bounce.h"
    Used: C:\Arduino
    Multiple libraries were found for "Audio.h"
    Used: C:\Arduino
    Using library Audio at version 1.3 in folder: C:\Arduino 1.8.10
    Using library SPI at version 1.0 in folder: C:\Arduino 1.8.10
    Using library SD at version 1.2.2 in folder: C:\Arduino 1.8.10
    Using library SerialFlash at version 0.5 in folder: C:\Arduino 1.8.10
    Using library Wire at version 1.0 in folder: C:\Arduino 1.8.10
    Using library Bounce in folder: C:\Arduino 1.8.10
    "C:\\Arduino 1.8.10 + Teensy\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-size" -A "C:\\Users\\bynar\\AppData\\Local\\Temp\\arduino_b uild_981024/Part_1_02_Hardware_Test.ino.elf"
    Sketch uses 33728 bytes (1%) of program storage space. Maximum is 2031616 bytes.
    Global variables use 43488 bytes (4%) of dynamic memory, leaving 1005088 bytes for local variables. Maximum is 1048576 bytes.

    A screen shot of C:\Arduino 1.8.10 into where my Arduino 1.8.10 distribution was unzipped and subsequently overwritten
    by Teensduino 1.8.7 is as follows :
    Click image for larger version. 

Name:	ArdFolder.jpg 
Views:	2 
Size:	44.8 KB 
ID:	17961

    There is obviously something wrong here !
    what I really need is to expunge all Arduino code and libs from my machine (not the sketches)
    and then do a controlled load of the Arduino system and Teensy ?. Are there instructions of
    how to do this ?
    I would be grateful for any further help.
    Brian Fish

  21. #21
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,792
    Quote Originally Posted by Brian44 View Post
    what I really need is to expunge all Arduino code and libs from my machine (not the sketches)
    On Windows, the Arduino stuff is located in 3 places.

    The software and everything Teensyduino installs is in the Arduino program folder. By default that's C:\Program Files (x86)\Arduino.

    Preferences and everything Arduino's boards & libs manager install are in %LocalAppData%/Arduino. Normally that's a hidden folder. There are lots of sites with instructions for accessing it.

    Your programs are stored in the "sketchbook" folder. It's default location is %Documents%/Arduino.


    Arduino also has a "portable" mode which makes a completely self-contained copy of Arduino. The Teensyduino installer automatically detects if you've selected a copy of Arduino configured this way and treats it accordingly.

    https://www.arduino.cc/en/Guide/PortableIDE

    Often this is the simplest way to try experimental stuff with Arduino that doesn't (or at least shouldn't) interact with any installed copy of Arduino.

  22. #22
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    @Brian44 - that is odd output

    The portableIDE option got mention in this post : Teensyduino-1-48-Beta-2

    The following post I gave it a try and left some notes as it worked.

    Do make sure you save a copy of your sketches if they are in an Arduino controlled folder - just in case. And perhaps try to remove other installations.

  23. #23
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    Paul, Paul in the UK, defragster,houtson, WMXZ et al.
    Many Thanks for your advice for my audio problem.
    I think that I have it set up correctly now but am waiting for the loan of tested audio hardware before I know for certain.
    Here is what I did :
    1. Expunged all references to Arduino on the C: drive of my wife’s laptop,
    2. Went to Arduino.cc and downloaded the 1.8.10 zip file into a new empty directory say X on the C drive. Right clicked the zip file and expanded it into X.
    3. Removed the zip file onto another drive.
    4. Now have folder X within X on C so drag the inner X to the root of C and delete the outer Empty X.
    5. Go to pjrc.com and run teensyduino.
    Navigate to instal it in C:/X and keep ALL libraries checked. I think it was my mistake installing ONLY the audio library.
    6. It was now ready and I test compiled my own sketches and the hardware test 01_02 and the guitar test. Although I had a teensy without shield it built perfectly and on running the beeps were produced. Verbose op showed No double libraries .Set up a link to C:/X/arduino.exe. That worked.
    7. I copied C:/X to my own machine which I had cleaned from all Arduino refs. This didn’t execute because there was an unset link to Java runtime.
    8. I therefore deleted C:/X and repeated the whole procedure on my own m/c. It works but I need to test it on the audio shield.

    My next step is to access the ADC and DAC on the Audio shield.
    Hope this helps someone.
    Brian44

  24. #24
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,082
    Quote Originally Posted by Brian44 View Post


    7. I copied C:/X to my own machine which I had cleaned from all Arduino refs. This didn’t execute because there was an unset link to Java runtime.

    Brian44
    Those steps looks good and complete.

    I've done similar - installing to a folder and then putting it on another machine.

    Odd step is #7 - was Arduino started from within the C:\X folder?

    On first run Windows asks for permission to run the JAVA that is fully self contained in the Arduino folder with IDE files.

    Perhaps if not started within the folder the linkage failed - or system permission below wasn't given?

    It pops up a dialog for Firewall or something - I just see JAVA and know it is first install/run and say YES. And don't have troubles.

    Best of luck when you get hardware back to run with.

  25. #25
    Junior Member
    Join Date
    Sep 2019
    Posts
    19
    defragster. Yes I invoked Arduino.exe from what I called the X folder on both machines using a link on the workspace. In section 2 it was, of course, the windows version of the Zip. Previously during my blue period it was the ‘ nightly’ build that I used.
    Will post my code for real-time FFT once I have worked out how to access the anin/anout on the shield.

Posting Permissions

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