Teensyduino 1.52 Beta #3

Status
Not open for further replies.
Hi,

it seems to me that something in the i2s part of the audio library is broken, here is my code:

Code:
#include <Audio.h>

AudioInputI2S             input;
AudioAnalyzeNoteFrequency notefreq;
AudioConnection           connection(input, 0, notefreq, 0);

void setup() {
  AudioMemory(50);
  notefreq.begin(0.15);
}

void loop() {
  if (notefreq.available()) Serial.println(notefreq.read());
}

This doesn't work any more in beta, instead I have to use i2sQuad (which doesn't work in stable). The following doesn't work either in stable and beta regardless of i2s or i2sQuad:

Code:
#include <Audio.h>

AudioInputI2S             input;
// AudioInputI2SQuad             input;
AudioAnalyzeFFT1024       fft;
AudioConnection           connection(input, 0, fft, 0);

void setup() {
  AudioMemory(50);
}

// copied from the fft example:
void loop() {
  float n;
  int i;

  if (fft.available()) {
    // each time new FFT data is available
    // print it all to the Arduino Serial Monitor
    Serial.print("FFT: ");
    for (i = 0; i < 40; i++) {
      n = fft.read(i);
      if (n >= 0.01) {
        Serial.print(n);
        Serial.print(" ");
      } else {
        Serial.print("  -  "); // don't print "0.00"
      }
    }
    Serial.println();
  }
}

I use the Adafruit SPH0645 mems mic as input connected to a teensy 4 without the MCLK pin wired.
 
Installed 1.52beta3 with Arduino IDE 1.8.12, on Windows 10 Pro 64 bit.

I'm having a problem building a low power test based upon Duff's Snooze library: the library included with TD 1.52b3 can not find "SnoozeTimer.h"

Target was Teensy 4.0.

Full build log:

Code:
D:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\Fernando\AppData\Local\Arduino15\packages -hardware L:\Progetti\Arduino\hardware -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\Fernando\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries L:\Progetti\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o3std,keys=en-us -ide-version=10812 -build-path c:\temp\arduino_build_306898 -warnings=none -build-cache c:\temp\arduino_cache_376848 -verbose L:\Progetti\Arduino\TeensyLowPowerTestOK\TeensyLowPowerTestOK.ino
D:\Arduino\arduino-builder -compile -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\Fernando\AppData\Local\Arduino15\packages -hardware L:\Progetti\Arduino\hardware -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\Fernando\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries L:\Progetti\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o3std,keys=en-us -ide-version=10812 -build-path c:\temp\arduino_build_306898 -warnings=none -build-cache c:\temp\arduino_cache_376848 -verbose L:\Progetti\Arduino\TeensyLowPowerTestOK\TeensyLowPowerTestOK.ino
Using board 'teensy40' from platform in folder: D:\Arduino\hardware\teensy\avr
Using core 'teensy4' from platform in folder: D:\Arduino\hardware\teensy\avr
Detecting libraries used...
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_306898\\sketch\\TeensyLowPowerTestOK.ino.cpp" -o nul
Alternatives for Snooze.h: [Snooze_OLD@6.3.4 Snooze@6.3.4]
ResolveLibrary(Snooze.h)
  -> candidates: [Snooze_OLD@6.3.4 Snooze@6.3.4]
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "c:\\temp\\arduino_build_306898\\sketch\\TeensyLowPowerTestOK.ino.cpp" -o nul
Alternatives for TimeLib.h: [Time@1.6]
ResolveLibrary(TimeLib.h)
  -> candidates: [Time@1.6]
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "c:\\temp\\arduino_build_306898\\sketch\\TeensyLowPowerTestOK.ino.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\Snooze.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\SnoozeBlock.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeAlarm.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeAudio.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeCompare.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeDigital.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeSPI.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeTimer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeTouch.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\SnoozeUSBSerial.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\Snoozelc5vBuffer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_32\\hal.c" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeAlarm.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeAudio.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeCompare.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeDigital.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeSPI.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeTimer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeTouch.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\SnoozeUSBSerial.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\Snoozelc5vBuffer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_35\\hal.c" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeAlarm.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeAudio.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeCompare.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeDigital.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeSPI.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeTimer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeTouch.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\SnoozeUSBSerial.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\Snoozelc5vBuffer.cpp" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_36\\hal.c" -o nul
"D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=152 -DARDUINO=10812 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src" "-ID:\\Arduino\\hardware\\teensy\\avr\\libraries\\Time" "D:\\Arduino\\hardware\\teensy\\avr\\libraries\\Snooze\\src\\hal\\TEENSY_40\\hal.c" -o nul
Alternatives for SnoozeTimer.h: []
In file included from D:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\hal.c:5:0:
ResolveLibrary(SnoozeTimer.h)

  -> candidates: []
D:\Arduino\hardware\teensy\avr\libraries\Snooze\src\hal\TEENSY_40\hal.h:41:25: fatal error: SnoozeTimer.h: No such file or directory

Multiple libraries were found for "Snooze.h"
compilation terminated.

 Used: D:\Arduino\hardware\teensy\avr\libraries\Snooze
 Not used: L:\Progetti\Arduino\libraries\Snooze_OLD
Using library Snooze at version 6.3.4 in folder: D:\Arduino\hardware\teensy\avr\libraries\Snooze 
Using library Time at version 1.6 in folder: D:\Arduino\hardware\teensy\avr\libraries\Time 

Error compiling for board Teensy 4.0.


The relevant part (includes and defines):

Code:
#include <Snooze.h>
#include <TimeLib.h>

volatile unsigned long int    g_elapsedMilliseconds;
volatile elapsedMillis g_millis;
volatile unsigned long int g_pulseCount1 = 0;
volatile unsigned long int g_pulseCount2 = 0;

// Snooze:
// Load drivers
// SnoozeTouch g_snoozeModule_touch;
SnoozeDigital g_snoozeModule_digitalPinInterrupt;
SnoozeTimer g_snoozeModule_timer;
// Install drivers to a Snooze Config Block
SnoozeBlock g_snoozeConfig(g_snoozeModule_timer, g_snoozeModule_digitalPinInterrupt);

Please let me know if I can be of further help.
Did you try to download the latest Snooze beta for T4 support? Just clone it or download the zip file I haven't updated the releases since I want to get any bugs squashed first.
 
Did you try to download the latest Snooze beta for T4 support? Just clone it or download the zip file I haven't updated the releases since I want to get any bugs squashed first.

Builds OK with 6.3.8beta!
Did not have a chance to really try it, but good news nonetheless. :)
 
OK, I read all forum posts about the SPH0645 I could find and spend quite some hours on fiddling with it. The problem seems to be that SPH0645 violates i2s specs. At least in my case it spits out only crazy noisy recordings, and I tried 2 boards. As AnalogAudioInput still does not work on T4 I ordered some other i2s mems mic bords to try. Request: please, I think it would be helpful to mention in the list of compatible mics that the SPH0645 causes troubles! Also it seems some people are desperately waiting for AnalogAudioInput to work on T4... Thanks again for all the great work!
 
@jpk
From the datasheet:
The SELECT pin determines when the microphone drives the Data pin. When SELECT = HIGH the Data pin is driven when the WS = HIGH, otherwise it is tri-stated (high impedance).
When operating a single microphone on an I2S bus, a pull down resistor (100K Ohms) should be placed from the Data pin to ground to insure the bus capacitance is discharged.
 
Posted on TD 1.52 b2 thread was a note about Time Sync with T_4.x from secure RTC : pjrc.com/threads/60354-Teensyduino-1-52-Beta-2

Source working fix to apply?::
pjrc.com/threads/45377-TimeTeensy3-example-gt-Time-chosen-is-not-permanent

<edit> Also noted there (or related post) that Teensy.exe loader time set on T_4.x is "Off by one hour" for Windows users.

This post suggests Teensy Loader time is also one hour Off on MAC as well : How-to-access-the-internal-RTC-in-a-Teensy-4-0

The T_4.x SRTC doesn't store time changes as noted above without code fix linked. Not sure if that same cose works on all T_3.x's?

Also in post just linked a Platform IO user wonders how to get Teensy Loader without IDE and TD install? There is a link to Teensy.exe 1.48 here pjrc.com/teensy/teensy.exe on page : pjrc.com/teensy/loader_xp.html
 
Thanks for the hint! The pulldown can't be enabled by pinMode...?
The 100kΩ is a very weak pulldown, just to discharge static on the data line when output is disconnected. The pinmode pulldown is a strong, which has disadvantages on signal quality and loads the mic diver so much it leads to degradation in signal.
 
just in case, may I remind of the GUI bug still existent since years?
https://forum.pjrc.com/threads/45216-Two-GUI-related-bugs
It also cuts usability of the tool, as it is often impossile to re-import the work to make changes, continue work, etc. Actually it is a lottery, because sometimes it just works, but sometimes not. The reason is unclear, so user has always to expect the tool wil not allow re-import and everything has to be done again.
 
The pinmode pulldown is a strong, which has disadvantages on signal quality and loads the mic diver so much it leads to degradation in signal.

Where did you read this?
According to the manual, the only Information I found says the PIN-Pulldowns are 100k, too.
So, I'd appreciate a source.
 
yes, the manual. But why does it not work that way?
Before firing up a dispute, how about the GUI bug?
 
So no source and it was just a guess?
Please stop that in the future or say that you don't know it exactly.

Other users may read it and may think the T4-Pulldowns are stronger (which is still possible - but again, I read 100k on Page 956, Reference Manual - maybe that's not correct?).
 
Last edited:
I read 100k on Page 956, Reference Manual - maybe that's not correct?

Looks like the reference manual is correct, the pulldown resistor is 100K.

To check this I connected 220K resistor between pin 20 and 3.3V and ran this program.

Code:
void setup() {
  pinMode(20, INPUT_PULLDOWN);
}

void loop() {
}

My multimeter reads 1.06 volts.

DSC_0781_web.jpg
 
Yep. You have to set up xbar to use the different timers. Attached is a zip for what we were playing for chaining pin pairs for analog reads. Pretty much shows how to set up the timers. Does get a bit confusing with all the timers we set up to use. Basically with xbara you connect the timer to the ADC trigger.

I'm working with this today. Have it running here with interrupts. No DMA yet...
 
I'm working with this today. Have it running here with interrupts. No DMA yet...
Sounds like you are having fun with it. @KurtE and I got carried away with it when we were testing. @KurtE had DMA working with it. Not sure this is the latest but I attaching the last zip I have. Maybe @KurtE has a later one.
 

Attachments

  • T4_ADC_DMA_QTIMER_RMS_BOTH.zip
    6.4 KB · Views: 167
I got DMA working, though only a very simple test so far.

Code:
#include "DMAChannel.h"

extern "C" void xbar_connect(unsigned int input, unsigned int output);

const uint8_t adc2_pin_to_channel[] = {
        7,      // 0/A0  AD_B1_02
        8,      // 1/A1  AD_B1_03
        12,     // 2/A2  AD_B1_07
        11,     // 3/A3  AD_B1_06
        6,      // 4/A4  AD_B1_01
        5,      // 5/A5  AD_B1_00
        15,     // 6/A6  AD_B1_10
        0,      // 7/A7  AD_B1_11
        13,     // 8/A8  AD_B1_08
        14,     // 9/A9  AD_B1_09
        255,    // 10/A10 AD_B0_12 - only on ADC1, 1 - can't use for audio
        255,    // 11/A11 AD_B0_13 - only on ADC1, 2 - can't use for audio
        3,      // 12/A12 AD_B1_14
        4,      // 13/A13 AD_B1_15
        7,      // 14/A0  AD_B1_02
        8,      // 15/A1  AD_B1_03
        12,     // 16/A2  AD_B1_07
        11,     // 17/A3  AD_B1_06
        6,      // 18/A4  AD_B1_01
        5,      // 19/A5  AD_B1_00
        15,     // 20/A6  AD_B1_10
        0,      // 21/A7  AD_B1_11
        13,     // 22/A8  AD_B1_08
        14,     // 23/A9  AD_B1_09
        255,    // 24/A10 AD_B0_12 - only on ADC1, 1 - can't use for audio
        255,    // 25/A11 AD_B0_13 - only on ADC1, 2 - can't use for audio
        3,      // 26/A12 AD_B1_14 - only on ADC2, do not use analogRead()
        4,      // 27/A13 AD_B1_15 - only on ADC2, do not use analogRead()
#ifdef ARDUINO_TEENSY41
        255,    // 28
        255,    // 29
        255,    // 30
        255,    // 31
        255,    // 32
        255,    // 33
        255,    // 34
        255,    // 35
        255,    // 36
        255,    // 37
        1,      // 38/A14 AD_B1_12 - only on ADC2, do not use analogRead()
        2,      // 39/A15 AD_B1_13 - only on ADC2, do not use analogRead()
        9,      // 40/A16 AD_B1_04
        10,     // 41/A17 AD_B1_05
#endif
};


DMAChannel dma;
uint16_t output;


void setup()
{
        while (!Serial);
        Serial.println("ADC triggering test");

        // configure a timer to trigger ADC
        const int comp1load = 58594; // approx 10 Hz with TMR_CTRL_PCS=15
        TMR3_ENBL &= ~(1<<3);
        TMR3_SCTRL3 = TMR_SCTRL_OEN | TMR_SCTRL_FORCE;
        TMR3_CSCTRL3 = TMR_CSCTRL_CL1(1) | TMR_CSCTRL_TCF1EN;
        TMR3_CNTR3 = 0;
        TMR3_LOAD3 = 0;
        TMR3_COMP13 = comp1load;
        TMR3_CMPLD13 = comp1load;
        //TMR3_CTRL3 = TMR_CTRL_CM(1) | TMR_CTRL_PCS(9) | TMR_CTRL_LENGTH | TMR_CTRL_OUTMODE(3);
        TMR3_CTRL3 = TMR_CTRL_CM(1) | TMR_CTRL_PCS(15) | TMR_CTRL_LENGTH | TMR_CTRL_OUTMODE(3);
        TMR3_DMA3 = TMR_DMA_CMPLD1DE;
        //CORE_PIN15_CONFIG = 1 ; // GPIO_AD_B1_03, ALT1 = QTIMER3_TIMER3, page 495
        TMR3_CNTR3 = 0;
        TMR3_ENBL |= (1<<3);

        // connect the timer output the ADC_ETC input
        const int trigger = 4; // 0-3 for ADC1, 4-7 for ADC2
        CCM_CCGR2 |= CCM_CCGR2_XBAR1(CCM_CCGR_ON);
        xbar_connect(XBARA1_IN_QTIMER3_TIMER3, XBARA1_OUT_ADC_ETC_TRIG00 + trigger);

        // turn on ADC_ETC and configure to receive trigger
        if (ADC_ETC_CTRL & (ADC_ETC_CTRL_SOFTRST | ADC_ETC_CTRL_TSC_BYPASS)) {
                //Serial.printf("ADC_ETC_CTRL = %08X\n", ADC_ETC_CTRL);
                ADC_ETC_CTRL = 0; // clears SOFTRST only
                ADC_ETC_CTRL = 0; // clears TSC_BYPASS
                //Serial.printf("ADC_ETC_CTRL = %08X\n", ADC_ETC_CTRL);
        }
        ADC_ETC_CTRL |= ADC_ETC_CTRL_TRIG_ENABLE(1 << trigger) | ADC_ETC_CTRL_DMA_MODE_SEL;
        ADC_ETC_DMA_CTRL |= ADC_ETC_DMA_CTRL_TRIQ_ENABLE(trigger);

        // configure ADC_ETC trigger4 to make one ADC2 measurement on pin A2
        const int len = 1;
        const int pin = A2;
        IMXRT_ADC_ETC.TRIG[trigger].CTRL = ADC_ETC_TRIG_CTRL_TRIG_CHAIN(len - 1) |
                ADC_ETC_TRIG_CTRL_TRIG_PRIORITY(7);
        IMXRT_ADC_ETC.TRIG[trigger].CHAIN_1_0 = ADC_ETC_TRIG_CHAIN_HWTS0(1) |
                ADC_ETC_TRIG_CHAIN_CSEL0(adc2_pin_to_channel[pin]) | ADC_ETC_TRIG_CHAIN_B2B0;

        // set up ADC2 for 12 bit mode, hardware trigger
        Serial.printf("ADC2_CFG = %08X\n", ADC2_CFG);
        ADC2_CFG |= ADC_CFG_ADTRG;
        ADC2_CFG = ADC_CFG_MODE(2) | ADC_CFG_ADSTS(3) | ADC_CFG_ADLSMP | ADC_CFG_ADTRG |
                ADC_CFG_ADICLK(1) | ADC_CFG_ADIV(0) /*| ADC_CFG_ADHSC*/;
        ADC2_GC &= ~ADC_GC_AVGE; // single sample, no averaging
        ADC2_HC0 = ADC_HC_ADCH(16); // 16 = controlled by ADC_ETC

        // use a DMA channel to capture ADC_ETC output
        dma.begin();
        dma.TCD->SADDR = &(IMXRT_ADC_ETC.TRIG[4].RESULT_1_0);
        dma.TCD->SOFF = 0;
        dma.TCD->ATTR = DMA_TCD_ATTR_SSIZE(1) | DMA_TCD_ATTR_DSIZE(1);
        dma.TCD->NBYTES_MLNO = 2;
        dma.TCD->SLAST = 0;
        dma.TCD->DADDR = &output;
        dma.TCD->DOFF = 0;
        dma.TCD->CITER_ELINKNO = 1;
        dma.TCD->DLASTSGA = 0;
        dma.TCD->BITER_ELINKNO = 1;
        dma.TCD->CSR = DMA_TCD_CSR_INTMAJOR;
        dma.triggerAtHardwareEvent(DMAMUX_SOURCE_ADC_ETC);
        dma.enable();
        dma.attachInterrupt(isr);

}

void isr()
{
        dma.clearInterrupt();
        Serial.printf("isr %u\n", output);
}

void loop()
{
        // make measurements with ADC1 while ADC_ETC uses ADC2
        Serial.printf("\tA0 = %d\n", analogRead(A0));
        delay(1000);
}
 
RE: DMA:
Can you align the DMAMEM (in the linkerscripts) to 32Bytes instead 16, please?

4.3.1.Use cacheable buffersNormally buffers on the OCRAM, SDRAMare Cacheable and Write-Back. It can be in the stack, static section or allocated from heap. To use such buffer as DMAsource, user must performa DCACHE clean operation is done before DMA started, this makessure all of the data are committed to the memoryfrom cache. If buffer is used as DMAreceive destination, a DCACHE invalidate operation must be done after DMA completedand before CPU or other mastersread.The buffer address should be L1 cache line size aligned(32bytesin i.MXRT).

From here : https://www.nxp.com/docs/en/application-note/AN12042.pdf
 
I got DMA working, though only a very simple test so far.

Just got up - cool you got it working going through the sketch started remembering what we did :) @KurtE did all the DMA stuff I played more with the chaining of the pins and XBAR setup, I think, seems like forever since we did that.

EDIT: Just to add for buffers. Kurt had this in is sketch that I believe is what you all are talking about for DMAMEM
Code:
const uint32_t buffer_size = 1600;
DMAMEM static volatile uint16_t __attribute__((aligned(32))) dma_adc_buff1[buffer_size];
DMAMEM static volatile uint16_t __attribute__((aligned(32))) dma_adc_buff2[buffer_size];
AnalogBufferDMA abdma1(dma_adc_buff1, buffer_size, dma_adc_buff2, buffer_size);
 
Status
Not open for further replies.
Back
Top