Dual Serial + Audio on Teensy 3.2?

Status
Not open for further replies.
I'm wondering more or less the same. I'm doing a MIDI controller (which we all know, uses Serial) but want to also output audio.
One thing for certain tho, might need the audio board, I didn't find a way around it. For my use case (speaker output), it was also true when linking with an amp chip
 
Yes, but you will need to edit usb_desc.h to create a custom USB config. See the comments in that file for details.

Remember there are 2 copies of this file, one for Teensy 3 and the other for Teensy 4, so make sure you're editing the correct file. Easiest way is to add a syntax error and make sure the compiler catches it.
 
Maybe consider sharing your usb_desc.h file? Might help others who find this thread.

If using Quick Reply, click "Go Advanced" to get the full editor which lets you attach a file to your message.
 
I hijacked USB_MIDI_AUDIO_SERIAL like so:

Code:
#elif defined(USB_MIDI_AUDIO_SERIAL)
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x048D
  #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN	11
  #define PRODUCT_NAME		{'T','e','e','n','s','y',' ','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN	12
  #define EP0_SIZE		64
  #define NUM_ENDPOINTS		7
  #define NUM_USB_BUFFERS	32
  #define NUM_INTERFACE		7
  #define CDC_IAD_DESCRIPTOR	1	// Serial
  #define CDC_STATUS_INTERFACE	0
  #define CDC_DATA_INTERFACE	1
  #define CDC_ACM_ENDPOINT	1
  #define CDC_RX_ENDPOINT	2
  #define CDC_TX_ENDPOINT	2
  #define CDC_ACM_SIZE		16
  #define CDC_RX_SIZE		64
  #define CDC_TX_SIZE		64
  #define CDC2_STATUS_INTERFACE	2	// SerialUSB1
  #define CDC2_DATA_INTERFACE	3
  #define CDC2_ACM_ENDPOINT	3
  #define CDC2_RX_ENDPOINT	4
  #define CDC2_TX_ENDPOINT	4
  #define CDC2_ACM_SIZE		16
  #define CDC2_RX_SIZE		64
  #define CDC2_TX_SIZE		64
  #define AUDIO_INTERFACE	4	// Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     5
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     6
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT	7
  #define ENDPOINT1_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG	ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT3_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT4_CONFIG	ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT5_CONFIG	ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT6_CONFIG	ENDPOINT_RECEIVE_ISOCHRONOUS
  #define ENDPOINT7_CONFIG	ENDPOINT_TRANSMIT_ISOCHRONOUS
 
I've tried following the instructions, and have had success on a Teensy 4.1 by using the fragment posted in https://forum.pjrc.com/threads/66330-Dual-SerialUSB-and-MIDI-config-possible, but for the life of me can't get Dual serial + MIDI+ audio working on a Teensy 3.2 with a Windows 10 host. I've changed boards.txt as noted in the comment, and the option appears and can be selected, but Windows is declining to recognise it as a valid USB device. All I think I've done is change the names; boilerplate in the second serial port from the "Dual serial" section; increase the NUM_ENDPOINTS, NUM_USB_BUFFERS and NUM_INTERFACE values; update interface and endpoint numbers as needed; add / amend ENDPOINTn_CONFIG lines as needed. Oh, and I changed the PID in case Windows had it cached, and told it to forget the device.

Has anyone any clue which number(s) I've stuffed up in the following?! Any help much appreciated.

Code:
#elif defined(USB_MIDI_AUDIO_DUAL_SERIAL)
// To get the menu option, add the following into \Arduino\hardware\teensy\avr\boards.txt:
//   teensyNN.menu.usb.serial2midiaudio=Dual Serial + MIDI + Audio
//   teensyNN.menu.usb.serial2midiaudio.build.usbtype=USB_MIDI_AUDIO_DUAL_SERIAL
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x048D
  #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN	11
  #define PRODUCT_NAME {'T','e','e','n','s','y',' ','D','S','e','r','i','a','l','/','M','I','D','I','/','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN 25
  #define EP0_SIZE		64
  #define NUM_ENDPOINTS         11
  #define NUM_USB_BUFFERS	40
  #define NUM_INTERFACE		6
  
  #define CDC_IAD_DESCRIPTOR	1
  #define CDC_STATUS_INTERFACE	0
  #define CDC_DATA_INTERFACE	1	// Serial
  #define CDC_ACM_ENDPOINT	1
  #define CDC_RX_ENDPOINT       2
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE           64
  #define CDC_TX_SIZE           64
  
  #define CDC2_STATUS_INTERFACE	2	// SerialUSB1
  #define CDC2_DATA_INTERFACE	3
  #define CDC2_ACM_ENDPOINT	4
  #define CDC2_RX_ENDPOINT		5
  #define CDC2_TX_ENDPOINT		6
  #define CDC2_ACM_SIZE			16
  #define CDC2_RX_SIZE			64
  #define CDC2_TX_SIZE			64
  
  #define MIDI_INTERFACE        4	// MIDI
  #define MIDI_NUM_CABLES       1
  #define MIDI_TX_ENDPOINT      7
  #define MIDI_TX_SIZE          64
  #define MIDI_RX_ENDPOINT      8
  #define MIDI_RX_SIZE          64
  
  #define AUDIO_INTERFACE	5	// Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     9
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     10
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT	11
  
  #define ENDPOINT1_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT3_CONFIG	ENDPOINT_TRANSMIT_ONLY
  
  #define ENDPOINT4_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT5_CONFIG	ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT6_CONFIG	ENDPOINT_TRANSMIT_ONLY
  
  #define ENDPOINT7_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT8_CONFIG	ENDPOINT_RECEIVE_ONLY
  
  #define ENDPOINT9_CONFIG	ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT10_CONFIG	ENDPOINT_RECEIVE_ISOCHRONOUS
  #define ENDPOINT11_CONFIG	ENDPOINT_TRANSMIT_ISOCHRONOUS
 
Status
Not open for further replies.
Back
Top