// LFS fixed block device index numbers.
#define LFS_DRIVE_QPINAND 28
#define LFS_DRIVE_QSPIFLASH 29
#define LFS_DRIVE_QPINOR5 30
#define LFS_DRIVE_QPINOR6 31
#define LFS_DRIVE_SPINAND3 32
#define LFS_DRIVE_SPINAND4 33
#ifdef AUDIOPLAY
#include <Audio.h>
#include <play_sd_mp3.h>
#include <play_sd_aac.h>
#include <play_sd_flac.h>
#include <play_FS_wav.h>
#include <play_FS_raw.h>
AudioPlaySdMp3 playMp31; //xy=154,78
AudioPlayFSWav playWav; //xy=154,422
AudioPlayFSRaw playRaw; //xy=154,422
AudioPlaySdAac playAac; //xy=154,422
AudioPlaySdFlac playFlac;
// GUItool: begin automatically generated code
AudioOutputI2S i2s1; //xy=1023.0000076293945,500.00000286102295
AudioMixer4 mixer1; //xy=625.0000038146973,393.00000381469727
AudioMixer4 mixer2; //xy=626.0000038146973,490.00000381469727
AudioMixer4 mixer3; //xy=811.0000076293945,571.0000038146973
AudioMixer4 mixer4; //xy=816.0000057220459,655.0000038146973
AudioConnection patchCord1(playWav, 0, mixer1, 3);
AudioConnection patchCord2(playWav, 1, mixer2, 3);
AudioConnection patchCord3(playMp31, 0, mixer1, 1);
AudioConnection patchCord4(playMp31, 1, mixer2, 1);
AudioConnection patchCord5(playAac, 0, mixer1, 0);
AudioConnection patchCord6(playAac, 1, mixer2, 0);
AudioConnection patchCord7(playFlac, 0, mixer1, 2);
AudioConnection patchCord8(playFlac, 1, mixer2, 2);
AudioConnection patchCord9(mixer1, 0, mixer3, 0);
AudioConnection patchCord10(mixer2, 0, mixer4, 0);
AudioConnection patchCord11(playRaw, 0, mixer3, 1);
AudioConnection patchCord12(playRaw, 0, mixer4, 1);
AudioConnection patchCord13(mixer3, 0, i2s1, 0);
AudioConnection patchCord14(mixer4, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=385,688.0000038146973
// GUItool: end automatically generated code
static int playFileType = 0;
#endif
Wow that brings back memories - a long time ago now almost forgotIt has been a while since I ran this stuff on the Teensy but everything worked. I believe @mjs513 was also involved with it![]()
Ken (et al):[ snip ] To state what I think is obvious to everyone, there are apps that benefit from or in some case require the processing power that the Teensy offers. Adding WiFi or Bluetooth capability could be a great feature to layer on top whether it be via the upcoming dedicated SF board or by slapping an ESP32 on it as we are doing here.
The difficulty, of course, is in coming up with an example that ‘requires’ the brute power of Teensy and can make use of the wireless capability of the ESP32 that is also accessible enough to reasonably play with and share on the forum as has been done on this thread, which frankly has been quite fun.
[ snip ]
Whatever the project ends up being we will probably need more horsepower, so 1GHz Teensy 4.1/ESP32 stacks for the win.
I agree in concept if working on a project from a clean slate.I would suggest a general interface between the ESP32 and the Teensy.
Decided to play with this a little bit so it does work - but since I am not an audio person probably could be better. I used the protosupplies mini-dev platform - cant seem to find my Rev D audio boards....was curious about the audio one so asked it to give me the whole package. If I get some time may implement it if someone doesnt beat me to it - in middle of 2 other projects/debug issues.![]()
// Slave (Block-Stream Echo)
// ESP32-C6
//#define RX1 D7 //GPIO17 Teensy 4.1 is connected to serial port #1
//#define TX1 D8 //GPIO19
#define RX1 D2 // Use these instead if you want to use Teensy Serial1
#define TX1 D1
#define TEENSY_SERIAL Serial1
const unsigned long TEST_BAUD = 4000000; // Target link speed
const size_t BLOCK_SIZE = 64; // Packet size
uint8_t slaveBuffer[BLOCK_SIZE];
void setup() {
// Disconnect unused I/O to avoid possible pin conflicts with Teensy
gpio_reset_pin(GPIO_NUM_0);
gpio_reset_pin(GPIO_NUM_17);
gpio_reset_pin(GPIO_NUM_19);
gpio_reset_pin(GPIO_NUM_16);
gpio_reset_pin(GPIO_NUM_18);
gpio_reset_pin(GPIO_NUM_20);
gpio_reset_pin(GPIO_NUM_21);
gpio_reset_pin(GPIO_NUM_22);
gpio_reset_pin(GPIO_NUM_23);
// Assign 4096-byte buffers to avoid overflow at higher speeds
TEENSY_SERIAL.setRxBufferSize(4096);
TEENSY_SERIAL.setTxBufferSize(4096);
// Serial.begin(115200);
TEENSY_SERIAL.begin(TEST_BAUD, SERIAL_8N1, RX1, TX1); //Port connected to Teensy 4.1
}
void loop() {
// Wait until the hardware buffer holds an entire chunk of data
if (TEENSY_SERIAL.available() >= BLOCK_SIZE) {
// Read the chunk natively into memory
TEENSY_SERIAL.readBytes(slaveBuffer, BLOCK_SIZE);
// Blast the chunk directly back down the TX hardware FIFO pipeline
TEENSY_SERIAL.write(slaveBuffer, BLOCK_SIZE);
}
}
Compiling sketch...
/home/wwatson/.arduino15/packages/esp32/tools/esp-rv32/2601/bin/riscv32-esp-elf-g++ -MMD -c @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/cpp_flags -Wall -Wextra -Os -Werror=return-type -DF_CPU=160000000L -DARDUINO=10819 -DARDUINO_XIAO_ESP32C6 -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"XIAO_ESP32C6\"" "-DARDUINO_VARIANT=\"XIAO_ESP32C6\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"linux\"" "-DARDUINO_FQBN=\"esp32:esp32:XIAO_ESP32C6:JTAGAdapter=default,CDCOnBoot=cdc,PartitionScheme=default,CPUFreq=160,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none,ZigbeeMode=default\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/defines -I/home/wwatson/Arduino/ESP32_C6_Test -iprefix /home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/include/ @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/includes -I/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/qio_qspi/include -I/home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/cores/esp32 -I/home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/variants/XIAO_ESP32C6 @/tmp/arduino_build_387356/build_opt.h @/tmp/arduino_build_387356/file_opts /tmp/arduino_build_387356/sketch/ESP32_C6_Test.ino.cpp -o /tmp/arduino_build_387356/sketch/ESP32_C6_Test.ino.cpp.o
/home/wwatson/Arduino/ESP32_C6_Test/ESP32_C6_Test.ino:8:9: warning: "RX1" redefined
8 | #define RX1 D2 // Use these instead if you want to use Teensy Serial1
| ^~~
In file included from /home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/cores/esp32/Arduino.h:202,
from /tmp/arduino_build_387356/sketch/ESP32_C6_Test.ino.cpp:1:
/home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/cores/esp32/HardwareSerial.h:207:9: note: this is the location of the previous definition
207 | #define RX1 (gpio_num_t)4
| ^~~
/home/wwatson/Arduino/ESP32_C6_Test/ESP32_C6_Test.ino:9:9: warning: "TX1" redefined
9 | #define TX1 D1
| ^~~
/home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/cores/esp32/HardwareSerial.h:231:9: note: this is the location of the previous definition
231 | #define TX1 (gpio_num_t)5
| ^~~
Compiling libraries...
Compiling core...
/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '/tmp/arduino_build_387356/file_opts'"
Using previously compiled file: /tmp/arduino_build_387356/core/variant.cpp.o
Using precompiled core: /tmp/arduino_cache_350247/core/core_6288f7990a95f877337b799e912e5a9c.a
/usr/bin/env bash -c ": > '/tmp/arduino_build_387356/file_opts'"
Linking everything together...
/home/wwatson/.arduino15/packages/esp32/tools/esp-rv32/2601/bin/riscv32-esp-elf-g++ -Wl,--Map=/tmp/arduino_build_387356/ESP32_C6_Test.ino.map -L/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/lib -L/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/ld -L/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/qio_qspi -Wl,--wrap=esp_panic_handler -Wl,--wrap=esp_bt_mem_release -Wl,--wrap=esp_bt_controller_mem_release -Wl,--wrap=_ZN4chip11DeviceLayer8Internal10ESP32Utils13InitWiFiStackEv -Wl,--wrap=_Z21esp_matter_mem_callocjj -Wl,--wrap=_Z22esp_matter_mem_reallocPvj -Wl,--wrap=_Z19esp_matter_mem_freePv @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/ld_flags @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/ld_scripts -Wl,--start-group /tmp/arduino_build_387356/sketch/ESP32_C6_Test.ino.cpp.o /tmp/arduino_build_387356/core/variant.cpp.o /tmp/arduino_cache_350247/core/core_6288f7990a95f877337b799e912e5a9c.a @/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12/flags/ld_libs -Wl,--end-group -Wl,-EL -o /tmp/arduino_build_387356/ESP32_C6_Test.ino.elf
/home/wwatson/.arduino15/packages/esp32/tools/esptool_py/5.3.1/esptool --chip esp32c6 elf2image --flash-mode dio --flash-freq 80m --flash-size 4MB --elf-sha256-offset 0xb0 -o /tmp/arduino_build_387356/ESP32_C6_Test.ino.bin /tmp/arduino_build_387356/ESP32_C6_Test.ino.elf
esptool v5.3.1
Creating ESP32-C6 image...
Merged 3 ELF sections.
Successfully created ESP32-C6 image.
python3 /home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/tools/gen_esp32part.py -q /tmp/arduino_build_387356/partitions.csv /tmp/arduino_build_387356/ESP32_C6_Test.ino.partitions.bin
/usr/bin/env bash -c "[ ! -d \"/tmp/arduino_build_387356\"/libraries/Insights ] || python3 \"/home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12\"/tools/gen_insights_package.py /tmp/arduino_build_387356 ESP32_C6_Test.ino \"/home/wwatson/Arduino/ESP32_C6_Test\""
/usr/bin/env bash -c "[ ! -d \"/tmp/arduino_build_387356\"/libraries/ESP_SR ] || [ ! -f \"/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12\"/esp_sr/srmodels.bin ] || cp -f \"/home/wwatson/.arduino15/packages/esp32/tools/esp32c6-libs/3.3.12\"/esp_sr/srmodels.bin \"/tmp/arduino_build_387356\"/srmodels.bin"
/home/wwatson/.arduino15/packages/esp32/tools/esptool_py/5.3.1/esptool --chip esp32c6 merge-bin -o /tmp/arduino_build_387356/ESP32_C6_Test.ino.merged.bin --pad-to-size 4MB --flash-mode keep --flash-freq keep --flash-size keep 0x0 /tmp/arduino_build_387356/ESP32_C6_Test.ino.bootloader.bin 0x8000 /tmp/arduino_build_387356/ESP32_C6_Test.ino.partitions.bin 0xe000 /home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/tools/partitions/boot_app0.bin 0x10000 /tmp/arduino_build_387356/ESP32_C6_Test.ino.bin
esptool v5.3.1
Wrote 0x400000 bytes to file '/tmp/arduino_build_387356/ESP32_C6_Test.ino.merged.bin', ready to flash to offset 0x0.
/usr/bin/env bash -c "echo '--flash-mode dio --flash-freq 80m --flash-size 4MB'>'/tmp/arduino_build_387356/flash_args'&& echo '0x0 ESP32_C6_Test.ino.bootloader.bin'>> '/tmp/arduino_build_387356/flash_args'&& echo '0x8000 ESP32_C6_Test.ino.partitions.bin'>> '/tmp/arduino_build_387356/flash_args'&& echo '0xe000 boot_app0.bin'>> '/tmp/arduino_build_387356/flash_args'&& echo '0x10000 ESP32_C6_Test.ino.bin'>> '/tmp/arduino_build_387356/flash_args'"
/bin/cp -f /home/wwatson/.arduino15/packages/esp32/hardware/esp32/3.3.12/tools/partitions/boot_app0.bin /tmp/arduino_build_387356/boot_app0.bin
/home/wwatson/.arduino15/packages/esp32/tools/esp-rv32/2601/bin/riscv32-esp-elf-size -A /tmp/arduino_build_387356/ESP32_C6_Test.ino.elf
Sketch uses 263038 bytes (20%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14180 bytes (4%) of dynamic memory, leaving 313500 bytes for local variables. Maximum is 327680 bytes.
Almost like that was seen here - given 'redefine' conflict I just didn't use those #define's in the .begin()?TEENSY_SERIAL.begin(TEST_BAUD, SERIAL_8N1, RX1, TX1); //Port connected to Teensy 4.1
// Default pins for UART1 are arbitrary, and defined here for convenience.
#if SOC_UART_HP_NUM > 1
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32C2
#define RX1 (gpio_num_t)10
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32S3
#define RX1 (gpio_num_t)15
#elif CONFIG_IDF_TARGET_ESP32C6
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32H2
#define RX1 (gpio_num_t)0
#elif CONFIG_IDF_TARGET_ESP32P4
#define RX1 (gpio_num_t)11
#elif CONFIG_IDF_TARGET_ESP32C5
#define RX1 (gpio_num_t)4
#elif CONFIG_IDF_TARGET_ESP32C61
#define RX1 (gpio_num_t)8
#endif
#endif
#ifndef TX1
#if CONFIG_IDF_TARGET_ESP32
#define TX1 (gpio_num_t)27
#elif CONFIG_IDF_TARGET_ESP32S2
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32C2
#define TX1 (gpio_num_t)18
#elif CONFIG_IDF_TARGET_ESP32C3
#define TX1 (gpio_num_t)19
#elif CONFIG_IDF_TARGET_ESP32S3
#define TX1 (gpio_num_t)16
#elif CONFIG_IDF_TARGET_ESP32C6
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32H2
#define TX1 (gpio_num_t)1
#elif CONFIG_IDF_TARGET_ESP32P4
#define TX1 (gpio_num_t)10
#elif CONFIG_IDF_TARGET_ESP32C5
#define TX1 (gpio_num_t)5
#elif CONFIG_IDF_TARGET_ESP32C61
#define TX1 (gpio_num_t)29
#endif
#endif
#endif /* SOC_UART_HP_NUM > 1 */
#if defined(ARDUINO_ESP32C3_DEV)
#define RX2 20 // Connect to Teensy 4.1 TX
#define TX2 21 // Connect to Teensy 4.1 RX
#elif defined(ARDUINO_XIAO_ESP32C5)
#define serialPort Serial1
#define RX2 12 //Serial5 TX on T4.1
#define TX2 8 // Serial5 RX on T4.1
#elif defined(ARDUINO_XIAO_ESP32C6)
#define RX2 1 //Serial5 TX on T4.1
#define TX2 2 // Serial5 RX on T4.1
#endif
#define teensy_rx 1
#define teensy_rx 2
#elif CONFIG_IDF_TARGET_ESP32C6
#define RX1 (gpio_num_t)4
No ProblemThanks guys. I have not spent much time with the ESP32 MCU's...
Well, the warnings do serve a purpose. That's the only reason they existI see them go by, but I don't pay much attention to what they are telling me