Why have I lost USB Midi output with Teensyduino 1.54?

Status
Not open for further replies.

DaveBoulden

Member
I have been building a MIDI related project running on a Teensy 4.0 for a few months and recently upgraded to Teensyduino 1.54 to gain access to the new LittleFS capabilities.

I seem to have suffered a weird side effect of losing MIDI output from the Teensy. It still responds to MIDI input, the serial port for debugging is still working and I can send out keystrokes through the Keyboard class, just no MIDI output.

My project has an augmented USB type that I have overridden in usb_desc.h, but have not changed it since updating to Teensyduino 1.54. I created a small test sketch and still no MIDI output. The relevant code is pasted below. Can anyone see something I need to change to match Teensyduino 1.54 or do I have some other problem?

Updated usb_desc.h (code compiled with build flag: "-D USB_MIDI_SERIAL"):
Code:
#elif defined(USB_MIDI_SERIAL)
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x0489
  #define MANUFACTURER_NAME	{'B','O','U','L','D','E','N','.','d','i','g','i','t','a','l'} 
  #define MANUFACTURER_NAME_LEN	15
  #define PRODUCT_NAME		{'C','o','m','p','o','s','e','r','C','t','r','l','-','1'}
  #define PRODUCT_NAME_LEN	14
  #define EP0_SIZE		64
  #define NUM_ENDPOINTS         6
  #define NUM_INTERFACE		5
  #define CDC_IAD_DESCRIPTOR	1
  #define CDC_STATUS_INTERFACE	0
  #define CDC_DATA_INTERFACE	1	// Serial
  #define CDC_ACM_ENDPOINT	2
  #define CDC_RX_ENDPOINT       3
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE_480       512
  #define CDC_TX_SIZE_480       512
  #define CDC_RX_SIZE_12        64
  #define CDC_TX_SIZE_12        64
  #define MIDI_INTERFACE        2	// MIDI
  #define MIDI_NUM_CABLES       1
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #define KEYBOARD_INTERFACE    3	// Keyboard
  #define KEYBOARD_ENDPOINT     5
  #define KEYBOARD_SIZE         8
  #define KEYBOARD_INTERVAL     1	
  #define KEYMEDIA_INTERFACE    4	// Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     6
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4	
  #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG	ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT5_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG	ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

Included names.c to override MIDI port name:
Code:
// To give your project a unique name, this code must be
// placed into a .c file (its own tab). It can not be in
// a .cpp file or your main sketch (the .ino file).
#include "usb_names.h"
// Edit these lines to create your own name. The length must
// match the number of characters in your custom name.

#define MANUFACTURER_NAME	{'B','O','U','L','D','E','N','.','d','i','g','i','t','a','l'} 
#define MANUFACTURER_NAME_LEN	15

#define PRODUCT_NAME		{'C','o','m','p','o','s','e','r','C','t','r','l','-','1'}
#define PRODUCT_NAME_LEN	14

#define SERIAL_NUMBER {	'B', 'D', '-', 'C', 'C', '1', '-', '0', '0', '1' }
#define SERIAL_NUMBER_LEN 10

struct usb_string_descriptor_struct usb_string_manufacturer_name = {
	2 + MANUFACTURER_NAME_LEN * 2,
	3,
	MANUFACTURER_NAME};

struct usb_string_descriptor_struct usb_string_product_name = {
	2 + PRODUCT_NAME_LEN * 2,
	3,
	PRODUCT_NAME};

struct usb_string_descriptor_struct usb_string_serial_number = {
	2 + SERIAL_NUMBER_LEN * 2,
	3,
	SERIAL_NUMBER};

Main test sketch:
Code:
#include <Arduino.h>

void setup() {
    Serial.begin(115200);
    while (!Serial && millis() < 1000); 
}

void loop() {
    usbMIDI.read();

    uint8_t rsltSysex[3] = { 0x12, 0x7F, 0x00 };
    usbMIDI.sendSysEx(3, rsltSysex, false);

    usbMIDI.sendNoteOn(64, 127, 1);
    usbMIDI.send_now();
    usbMIDI.sendNoteOff(64, 0, 1);
    usbMIDI.send_now();

    delay(2000);
}
 
Last edited:
Just tried it on a T4.0 with Arduino 1.8.15 and TD 1.54.
MIDI-OX sees ComposerCtrl-1 and receives the Sysex, NoteOn and NoteOff.

Pete
 
Just tried it on a T4.0 with Arduino 1.8.15 and TD 1.54.
MIDI-OX sees ComposerCtrl-1 and receives the Sysex, NoteOn and NoteOff.

Pete

Thank you Pete! That means there's either something wrong with my dev setup (PlatformIO in VSCode) or potentially something wrong with my Teensy, either way, I now know where to concentrate my attention.
 
Status
Not open for further replies.
Back
Top