Part_2_01_First_Design_Tool_Use ?

DOY38

Well-known member
Hello,
I have a Teensy 4.0 and a Audio Card (REV.D), after looking the video about the example Part_2_01_First_Design_Tool_Use, I have something but it looks like a constant frequency and not the music I put on the SD card. I made the cabling between TEENSY 4.0 and the Audio card
1726733770861.png

Here the PINS correspondence :

1726743088818.png


And I have this picture when the program works
1726733892846.png

After the code I also modified the pins for the TEENSY 4.0 card (MOSI = pin 11 and SDCARD_SCK_PIN = 13) but nothing changes.
1726743354391.png


I plugged an earphone into the JACK jack on the Audio card. Do you have any idea why this isn't working ?
Thank you for your helps
Yann DO
 
Last edited:
Lots of stray inductance causing signal quality issues? - try shorter wires and bunched together tightly to reduce the large loop areas you currently have.
 
Try this sketch which is an I2C scanner modified so that it should see the SGTL5000 on the audio card at address 0x0A.

Code:
// 240919 Do an I2C scan which should find the audio card's SGTL5000
//        at address 10 (0xA)
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>

const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;

// Create the Audio components.  These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioInputI2S    audioInput;         // audio shield: mic or line-in
AudioOutputI2S   audioOutput;        // audio shield: headphones & line-out

AudioPlayQueue   myQueue;

// Create Audio connections between the components
AudioConnection c1(myQueue, 0, audioOutput, 0);

// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;

void setup(void)
{
  Serial.begin(9600);
  while(!Serial);
  delay(100);

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(2);

  // Enable the audio shield and set the output volume.
  audioShield.enable();
  audioShield.inputSelect(myInput);
  audioShield.volume(0.6);

  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  int response;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++) {
    Wire.beginTransmission (i);
    if ((response = Wire.endTransmission()) == 0) {
      Serial.printf ("Found address: %d (0x%02x)\n",i,i);
      count++;
      delay (1);  // maybe unneeded?
    } else {
//      Serial.print(i,DEC);
//      Serial.print(" failed  ");
//      Serial.println(response,DEC);
    }
  } // end of for loop
  Serial.println("Finished scanning");
  Serial.printf("Found %d device(s).\n",count);
}

void loop(void)
{
}

Pete
 
Lots of stray inductance causing signal quality issues? - try shorter wires and bunched together tightly to reduce the large loop areas you currently have.
Yes I can reduce the wires and see if there is a change.
 
Try this sketch which is an I2C scanner modified so that it should see the SGTL5000 on the audio card at address 0x0A.

Code:
// 240919 Do an I2C scan which should find the audio card's SGTL5000
//        at address 10 (0xA)
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>

const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;

// Create the Audio components.  These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioInputI2S    audioInput;         // audio shield: mic or line-in
AudioOutputI2S   audioOutput;        // audio shield: headphones & line-out

AudioPlayQueue   myQueue;

// Create Audio connections between the components
AudioConnection c1(myQueue, 0, audioOutput, 0);

// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;

void setup(void)
{
  Serial.begin(9600);
  while(!Serial);
  delay(100);

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(2);

  // Enable the audio shield and set the output volume.
  audioShield.enable();
  audioShield.inputSelect(myInput);
  audioShield.volume(0.6);

  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  int response;
 
  Wire.begin();
  for (byte i = 1; i < 120; i++) {
    Wire.beginTransmission (i);
    if ((response = Wire.endTransmission()) == 0) {
      Serial.printf ("Found address: %d (0x%02x)\n",i,i);
      count++;
      delay (1);  // maybe unneeded?
    } else {
//      Serial.print(i,DEC);
//      Serial.print(" failed  ");
//      Serial.println(response,DEC);
    }
  } // end of for loop
  Serial.println("Finished scanning");
  Serial.printf("Found %d device(s).\n",count);
}

void loop(void)
{
}

Pete
Thank you, I'll try it and let's see what happens
 
This GND pin needs to be connected!

1726774992467.png


Looks like you connected the other GND pin, but that is not enough. This one is definitely required.
 
Also check your 3.3V power connection. The audio shield gets its power from this pin (assuming the unseen wiring underneath from sockets to audio shield is a simple 1-to-1).

1726779218737.png


1726779344596.png
 
Are all problems fixed now, audio input and output good?
Hello, could you tell me why the example program doesn't work ? I checked the wiring, power supplies, grounds and communication via I2C everything is correct but it does not work, I probably forgot to install a utility for the TEENSY card and/or the Audio card ?
Thank you for your helps
 
Hi,DOY38,
you can try to write the wav file in lower case,at the beginning i had an issue with
file like : SDTEST.WAV i transformed it -> sdtest.wav or sdtest.WAV
could be i had a conflict with another sd library,now i only have a teensy library.
 
Hi,DOY38,
you can try to write the wav file in lower case,at the beginning i had an issue with
file like : SDTEST.WAV i transformed it -> sdtest.wav or sdtest.WAV
could be i had a conflict with another sd library,now i only have a teensy library.
I'll try this case, for downloading the software, I followed the recommendations via this link :
https://www.pjrc.com/teensy/td_download.html
from what I understand is that if the I2C works then the other 3 clocks are correctly configured : LRCLK (44.1 kHz), BCLK (1.41 or 2.82 MHz) and MCLK (11.29 MHz), otherwise I2C won't work either (after me).
After changing to lowercase it's still the same problem, I hear sounds through the headphones but they sound like frequencies but not music

1727094745927.png

I modified the sketch with the PINs 11 and 13 for my TEENSY 4
 
Last edited:
You said: "is it a wave file that needs to be put on the SD card?"
yes i hope it does,it could be blocking all the process if the sd card driver or so,is called,if you didn't put a sd card in it,it's time to do it
and see what happens.
 
I checked the wiring, power supplies, grounds and communication via I2C everything is correct but it does not work

Something must be incorrect, because it is not working.

The problem may be entirely with software. Or it could be hardware. Or both. Please understand we can not see your computer screen. The only info is the small screenshot in msg #11, and the recent photos in msg #9 - #10 (which do not show the wiring between boards and #10 is at a bad camera angle to see the wires).

Can you say precisely which example program(s) you are running? If you have edited the code, even "trivial" changes, please show exactly the code you are really using to test. Small details can matter.

Likewise, if you share better photos from good camera angle and showing the entire connection, if any wire is not connected properly maybe I or others here might be able to see. But without good photos that really show how the wires connect, nobody can help spot a wiring problem.


from what I understand is that if the I2C works then the other 3 clocks are correctly configured : LRCLK (44.1 kHz), BCLK (1.41 or 2.82 MHz) and MCLK (11.29 MHz), otherwise I2C won't work either (after me).

This assumption is incorrect. STGL5000 does require MCLK to initialize before I2C communication can work, but the other clocks are not needed simply for I2C.

To test the audio, I recommend using File > Examples > Audio > Tutorial > Part_1_02_Hardware_Test. Or you could use File > Examples > Audio > Synthesis > Guitar. Both of these will play sounds without requiring the SD card. Best to test the audio system first without the SD card. Then when you know audio output is working, use the example program which play files from the SD card. But before everything is working, please keep it simple and test 1 thing at a time.

If you are attempting to craft your own test program, rather than using the known-good examples, a very common mistake is forgetting AudioMemory() in your setup() function. The audio library can not actually process audio unless you give it memory to use. But for the sake of troubleshooting, please use the known-good example programs. Crafting your own code is much easier when you know the hardware is working with the known-good programs.
 
Something must be incorrect, because it is not working.

The problem may be entirely with software. Or it could be hardware. Or both. Please understand we can not see your computer screen. The only info is the small screenshot in msg #11, and the recent photos in msg #9 - #10 (which do not show the wiring between boards and #10 is at a bad camera angle to see the wires).

Can you say precisely which example program(s) you are running? If you have edited the code, even "trivial" changes, please show exactly the code you are really using to test. Small details can matter.

Likewise, if you share better photos from good camera angle and showing the entire connection, if any wire is not connected properly maybe I or others here might be able to see. But without good photos that really show how the wires connect, nobody can help spot a wiring problem.




This assumption is incorrect. STGL5000 does require MCLK to initialize before I2C communication can work, but the other clocks are not needed simply for I2C.

To test the audio, I recommend using File > Examples > Audio > Tutorial > Part_1_02_Hardware_Test. Or you could use File > Examples > Audio > Synthesis > Guitar. Both of these will play sounds without requiring the SD card. Best to test the audio system first without the SD card. Then when you know audio output is working, use the example program which play files from the SD card. But before everything is working, please keep it simple and test 1 thing at a time.

If you are attempting to craft your own test program, rather than using the known-good examples, a very common mistake is forgetting AudioMemory() in your setup() function. The audio library can not actually process audio unless you give it memory to use. But for the sake of troubleshooting, please use the known-good example programs. Crafting your own code is much easier when you know the hardware is working with the known-good programs.
Hello,
Thank you for your answer, but for the example 'Hardware_Test' this is not possible since I only have the TEENSY card and an Audio card. I just need to check 2 points with you please :
1 - Card power supply (+3.3V and GND), can you tell me if this is correct ? I didn't get a response on this feed (probably my photos are not very clear).
For 3.3 V
1727180883337.png

And the GND
1727180942436.png


2 - Code generation
I take this example
1727181002121.png

And I followed the PDF

1727181187875.png

And I copy the code generated in this part of the example

1727181237646.png


there is nothing special, I will check the tutorial for installing the software, for me it may come from the installation of the libraries of the TEENSY card and the audio card .

Thank you for your response for the 2 points mentioned.
 
Refer back to post <#6> by @PaulStoffregen. In your photos, it appears that you are still missing the required ground connection.

Also, the pins on the Audio Adapter are one-for-one with the pins on the T4.0 (they can be stacked, with the USB connector of the T4.0 pointing the same direction as the audio jack on the Audio Adapter). With this in mind, the 3.3VDC from the third pin down on one side of the T4.0 labeled "3V" should connect to the third pin down on the corresponding side of the Audio Adapter.

Hope that helps . . .

Mark J Culross
KD5RXT
 
Last edited:
Your GND and 3.3V wires are unusual. Normal way is to connect to the same physical location, as if the 2 boards were directly connected. This unusual way is probably ok, but because things are not working, why continue doing this the unusual way? Wouldn't you want to eliminate all possible sources of problems? This is so simple to connect the normal way with 1-to-1 wiring. Please, for the sake of troubleshooting, do the simple 1-to-1 wiring in the normal way.

Also seem you did not like my advice to use File > Examples > Audio > Tutorial > Part_1_02_Hardware_Test or File > Examples > Audio > Synthesis > Guitar. I do not understand why you rejected this suggestion. A program like the Guitar example will play a synth sound, which will create sound output even if your SD card has a problem. I tried to explain this in my prior message. I really want to help you get this working, but I just don't know how to convince you to follow my advice.
 
Your GND and 3.3V wires are unusual. Normal way is to connect to the same physical location, as if the 2 boards were directly connected. This unusual way is probably ok, but because things are not working, why continue doing this the unusual way? Wouldn't you want to eliminate all possible sources of problems? This is so simple to connect the normal way with 1-to-1 wiring. Please, for the sake of troubleshooting, do the simple 1-to-1 wiring in the normal way.

Also seem you did not like my advice to use File > Examples > Audio > Tutorial > Part_1_02_Hardware_Test or File > Examples > Audio > Synthesis > Guitar. I do not understand why you rejected this suggestion. A program like the Guitar example will play a synth sound, which will create sound output even if your SD card has a problem. I tried to explain this in my prior message. I really want to help you get this working, but I just don't know how to convince you to follow my advice.
I'll see the GND and 3.3V tomorrow (I'm not in the office). For the File > Examples > Audio > Tutorial > Part_1_02_Hardware_Test I don't have the materials (buttons, Led, pots and micro), I will see if I can find this kit.
And Examples > Audio > Synthesis > Guitar. I read the "workshop_t4-4.pdf" and it's mentioned nowhere and I don't know how this example works.
Thank you
 
Refer back to post <#6> by @PaulStoffregen. In your photos, it appears that you are still missing the required ground connection.

Also, the pins on the Audio Adapter are one-for-one with the pins on the T4.0 (they can be stacked, with the USB connector of the T4.0 pointing the same direction as the audio jack on the Audio Adapter). With this in mind, the 3.3VDC from the third pin down on one side of the T4.0 labeled "3V" should connect to the third pin down on the corresponding side of the Audio Adapter.

Hope that helps . . .

Mark J Culross
KD5RXT
Thank you for this information, "they can be stacked, with the USB connector of the T4.0 pointing the same direction as the audio jack on the Audio Adapter" -> I don't know this information, I just see this link about Audio card : https://forum.pjrc.com/index.php?threads/teensy-4-0-i2s-support.57167/#post-212481
and I do pretty much the same, if I can superimpose on the TEENSY card it would also reduce the connection wires and the noise. Can you confirm for me with the TEENSY 4.0 card and the REV.D Audio card that we can superimpose them ? Thank you for your answer
 
Back
Top