Hi everyone,
I am trying to receive MIDI clock from my Elektron Digitakt via USB, but it cannot connect to my Teensy.
- I am using a Teensy 4.1/Audio shield rev D.
- I confirmed that the cable actually works with a simple HID mouse example.
- I am powering the Teensy via microUSB to my laptop.
- I have also tried the USBHost_t36 'InputFunctions.ino' example, but it had the same issue.
Is my Digitakt somehow at fault here? I've used it connected to my laptop via the same USB cable with no issues before.
My code only outputs 'midi: not connected, clk=0, running=0', no matter what MIDI info I send.
Thank you for the help, I am very new to this!
I am trying to receive MIDI clock from my Elektron Digitakt via USB, but it cannot connect to my Teensy.
- I am using a Teensy 4.1/Audio shield rev D.
- I confirmed that the cable actually works with a simple HID mouse example.
- I am powering the Teensy via microUSB to my laptop.
- I have also tried the USBHost_t36 'InputFunctions.ino' example, but it had the same issue.
Is my Digitakt somehow at fault here? I've used it connected to my laptop via the same USB cable with no issues before.
My code only outputs 'midi: not connected, clk=0, running=0', no matter what MIDI info I send.
Thank you for the help, I am very new to this!
C++:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <USBHost_t36.h>
#include "SGTL5000.h"
AudioInputI2S i2s1;
AudioOutputI2S i2s2;
AudioConnection patchCord1(i2s1, 0, i2s2, 0);
AudioConnection patchCord2(i2s1, 1, i2s2, 1);
SGTL5000 codec;
USBHost usb;
MIDIDevice midi(usb);
volatile uint32_t clkCount = 0;
volatile bool running = false;
void onClock() { clkCount++; }
void onStart() { running = true; }
void onStop() { running = false; }
void onContinue() { running = true; }
void setup() {
Serial.begin(115200);
AudioMemory(12);
codec.enable();
usb.begin();
midi.setHandleClock(onClock);
midi.setHandleStart(onStart);
midi.setHandleStop(onStop);
midi.setHandleContinue(onContinue);
}
uint32_t lastPrint = 0;
void loop() {
usb.Task();
midi.read();
if (millis() - lastPrint > 500) {
lastPrint = millis();
Serial.printf("midi: %s, clk=%lu, running=%d\n",
midi ? "connected" : "not connected",
clkCount, running);
}
}