Using AudioAnalyzeToneDetect crash up Teensy

digitalwire

Member
I play a WAV file from Teensy SD card to decode morse signals via the audio lib. For this I use AudioAnalyzeToneDetect. I call the function every 5ms. After a few seconds teensy hangs up and emits a humming sound, a few seconds later teensy is restarted by the internal watchdog.

How can I find out the reason for the crash?
At what time interval can AudioAnalyzeToneDetect be called?

C-like:
// Audio - begin automatically generated code
AudioInputI2S            Line_In;          //xy=67.16668701171875,58.00000762939453
AudioPlaySdWav           PlayWAV;          //xy=79.16667175292969,115.16666412353516
AudioSynthWaveformSine   Key_Mithoerton;   //xy=88.16668701171875,175
AudioMixer4              TRX_Mixer;        //xy=297.16668701171875,67.00000762939453
AudioMixer4              SPK_Mixer;        //xy=300.16668701171875,164
AudioAnalyzeToneDetect   CW_Tone_Detector; //xy=568.1666870117188,66.00000762939453
AudioOutputI2S           Line_Out;         //xy=602.1666870117188,168
AudioConnection          patchCord1(Line_In, 1, TRX_Mixer, 0);
AudioConnection          patchCord2(Line_In, 1, SPK_Mixer, 0);
AudioConnection          patchCord5(Key_Mithoerton, 0, SPK_Mixer, 1);
AudioConnection          patchCord6(Key_Mithoerton, 0, TRX_Mixer, 1);
AudioConnection          patchCord3(PlayWAV, 0, TRX_Mixer, 2);
AudioConnection          patchCord4(PlayWAV, 0, SPK_Mixer, 2);
AudioConnection          patchCord7(TRX_Mixer, CW_Tone_Detector);
AudioConnection          patchCord8(SPK_Mixer, 0, Line_Out, 0);
AudioControlSGTL5000     sgtl5000_1;       //xy=297.16668701171875,245

C-like:
void auInit() {
  AudioMemory(8);
  sgtl5000_1.enable();
  sgtl5000_1.volume(1.0);
  sgtl5000_1.lineInLevel(15);
  sgtl5000_1.lineOutLevel(21);
  sgtl5000_1.micGain(0);
  SPI.setMOSI(SDCARD_MOSI_PIN);
  SPI.setSCK(SDCARD_SCK_PIN);
  if (!(SD.begin(SDCARD_CS_PIN))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
  auSelectAudioSource(AUDIO_SRC_NONE);
}

Complete source is attached
 

Attachments

  • 01_IO.ino
    2 KB · Views: 9
  • 02_Nextion.ino
    1.8 KB · Views: 9
  • 03_Audio.ino
    3.4 KB · Views: 10
  • 04_EEPROM.ino
    234 bytes · Views: 8
  • 09_helper.ino
    4.1 KB · Views: 7
  • 10_StateMachine.ino
    4.4 KB · Views: 10
  • 99_Main.ino
    534 bytes · Views: 12
  • MorseDecoder.ino
    5.6 KB · Views: 9
On Windows Addr2line can be found here: "C:\Program Files (x86)\Arduino\hardware\tools\arm\bin\arm-none-eabi-addr2line.exe"

Here you can find some more useful info on using CrashReport and Addr2Line.
 
You can check the entry in the unofficial Teensy wiki <here> for links to descriptions of where to find the addr2line utility for both the old (1.8.x) & new (2.3.x) Arduino IDE, as well as detailed descriptions of how to use it.

Hope that helps . . .

Mark J Culross
KD5RXT
 
Hhmm, I found the following

Code:
CrashReport:
  A problem occurred at (system time) 0:26:25
  Code was executing from address 0xF442
  CFSR: 1000000
        (UNALIGNED) Unaligned access UsageFault
  Temperature inside the chip was 48.79 °C
  Startup CPU clock speed is 600MHz
  Reboot was caused by auto reboot after fault or bad interrupt detected

addr2line report this
Code:
C:\Users\<snip>\hardware\avr\1.59.0\cores\teensy4/AudioStream.cpp:164

The crash occures when the first WAV file has played and I choose a different one and start to play.
I use the serial for the Nextion display at the same time to show the decoded characters on it
Maybe a different approach is needed using this audio library?
 
Last edited:
Back
Top