Adding USB TYPE Dual Serial and 192K Audio

jpwatters

New member
I have been experimenting with adding USB Type for Dual Serial, 192K Audio. Alas none of the forums or messages have worked.
After I emailed Paul, TeensyDuino 1.60.0 was released.

Turns out that is a a game changer. Using the methodology in the Github below and using TeensyDuino 1.60.0 I was able to compile and run the usb_audio.ino
test sketch from the project below.

There has been a Github project ( https://github.com/laiudm/laiudm-Teensy4-192k-USB-Audio/ ) that has worked in the past for those adding USB type's.
But I have not been able to get the BETA Code to work under Arduino 2.3.7( or Beta 2.3.8 ) and the TeensyDuino 1.5.9 ( or Beta 1.60.x)

But with release of the Production version of TeensyDuino 1.60.0, I was able to add Dual Serial, 192K Audio successfully !!!!!!

I was able to compile and run the usb_audio.ino test sketch from the above Github. That is something I have been unable to do in the past.

I had to uninstall and reinstall since I have had the TeensyDuino Beta installed.

My process has with the new 1.60.0 release, was to :
1. Update my Arduino 2.3.7 with TeensyDuino 1.60.0
2. Opened the usb_audio.ino ( just to preload the IDE so the when I open it later it opens the test sketch)
3. Shutdown Arduino
4. Using the Boards.local.txt from the Github , add the last 3 lines to the boards.txt in the 1.6.0/avr/bards.txt.
I choose to insert the lines between the Dual Serial and the Triple Serial definitions in the boards.txt

# Solution for Arduino IDE 2.0 recognizing changes to this file:
# WAS https://github.com/laiudm/laiudm-Teensy4-192k-USB-Audio
teensy41.menu.usb.serialserialaudio=Serial + Serial + 192k Audio
teensy41.menu.usb.serialserialaudio.build.usbtype=USB_AUDIO192K_SERIAL_SERIAL
teensy41.menu.usb.serialserialaudio.upload_port.usbtype=USB_AUDIO192K_SERIAL_SERIAL

5. Edited the usb.desc.h to include the definition for USB Type Dual Serial + 192K Audio using the Github Example.

#elif defined(USB_AUDIO192K_SERIAL_SERIAL)
#define AUDIO_SAMPLE_RATE_EXACT 192000.0f
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0498
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'1','9','2','k',' ','A','u','d','i','o','/','2','x','S','e','r','i','a','l'}
#define PRODUCT_NAME_LEN 19
#define EP0_SIZE 64
#define NUM_ENDPOINTS 7 // 5 for 2 serial, + 2 for audio
#define NUM_INTERFACE 7 // 4 for 2 serial, + 3 for audio
#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 CDC2_STATUS_INTERFACE 2 // SerialUSB1
#define CDC2_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 4
#define CDC2_RX_ENDPOINT 5
#define CDC2_TX_ENDPOINT 5
#define AUDIO_INTERFACE 4 // Audio (uses 3 consecutive interfaces)
#define AUDIO_TX_ENDPOINT 6
#define AUDIO_TX_SIZE ((int)((AUDIO_SAMPLE_RATE_EXACT + 900) / 1000) * 4)
#define AUDIO_RX_ENDPOINT 6
#define AUDIO_RX_SIZE AUDIO_TX_SIZE
#define AUDIO_SYNC_ENDPOINT 7
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
#define ENDPOINT6_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
#define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS

6. Started Arduino 2.3.7
7. Reload Board Data.
8. Load "usb_audio.ino" Sketch If the Arduino Sketch "usb_audio.ino" from the Github above is not opened.
9. Set compliler options, Board "Teensy 4.1", Speed "528Mhz" and USB TYPE "Serial + Serial + 192K Audio"
10. Compile the "usb_audio.ino"
11. Upload the compiled "usb_audio.ino" sketch and run it.

I just plugged in a spare Teensy 4.1 and ran it.

Serial Monitor reported

usb audio tests at 192000sps
Usage/Max: oscillator CPU = 0.47/0.49, all CPU = 1.07/1.07, Int16 Mem = 2/2,
The second USB serial port is also working

I am looking forward to additional testing to further validate the methodology for the correct implementation.
 
Good News and Bad News.

It appears that the the RX works, but the TX is plauged with a Buzzing Artifact.

Looks like more work to do.
I wonder if rolling back to the Arduino 2.3.2 and the modified
version of TeensyDuino 1.59.0 might be an option. At least to see if it works.

But then I would likely need to do a file by file comparison to see what is different from
the Github project core files and the current 1.60.0 TeensyDuino Version.

Figuring out what would help identify what would be a likely
be a FIFO underun/overun that produces a buzz artifact
 
Back
Top