Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Dual SerialUSB and MIDI config possible?

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    3

    Dual SerialUSB and MIDI config possible?

    I'd like to have 2 serialUSB and a MIDI port but in Arduino I can only select serial + MIDI or dual serial.

    Can someone point me to the right direction (or confirm it's not possible at al)?

    Thanks, Edwin.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,408
    Should be possible. You need to edit usb_desc.h inside {Arduino}/hardware/teensy/avr/cores/teensy4 (or teensy3 - there are 2 copies of this file). See the comments in the top of that file for instructions.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Posts
    3
    Thanks! I'll try and post results here.

  4. #4
    Junior Member
    Join Date
    Feb 2021
    Posts
    3
    Thanks Paul,

    It took some time but it seemes to work now. For others who read this, I added a 2nd Serial port to USB MIDI AUDIO SERIAL. To add this item to the menu in Teensy 4.0 ADD the next 2 lines in c:\Program Files (x86)\Arduino\hardware\teensy\avr\boards.txt

    teensy40.menu.usb.serial2midiaudio.build.usbtype=U SB_MIDI_AUDIO_DUAL_SERIAL
    teensy40.menu.usb.serial2midiaudio=Dual Serial + MIDI + Audio

    And the next lines to c:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\us b_desc.h

    #elif defined(USB_MIDI_AUDIO_DUAL_SERIAL)
    #define VENDOR_ID 0x16C0
    #define PRODUCT_ID 0x048B
    #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 8
    #define NUM_INTERFACE 8
    #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 MIDI_INTERFACE 4 // MIDI
    #define MIDI_NUM_CABLES 1
    #define MIDI_TX_ENDPOINT 6
    #define MIDI_TX_SIZE_12 64
    #define MIDI_TX_SIZE_480 512
    #define MIDI_RX_ENDPOINT 6
    #define MIDI_RX_SIZE_12 64
    #define MIDI_RX_SIZE_480 512
    #define AUDIO_INTERFACE 5 // Audio (uses 3 consecutive interfaces)
    #define AUDIO_TX_ENDPOINT 7
    #define AUDIO_TX_SIZE 180
    #define AUDIO_RX_ENDPOINT 7
    #define AUDIO_RX_SIZE 180
    #define AUDIO_SYNC_ENDPOINT 8
    #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_BULK + ENDPOINT_TRANSMIT_BULK
    #define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
    #define ENDPOINT8_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS

  5. #5
    Member
    Join Date
    Jan 2016
    Location
    Nantes, France
    Posts
    30
    Hi guys,

    I also need dual Serial + MIDI + Audio for Teensy 4.1
    I've modified the files boards.txt and usb_desc.h (on my PC it's here : C:\Users\david\AppData\Local\Arduino15).
    But the option never appears in IDE 2 for Teensy 4.1 but appears for the other boards.
    Am I missing something ?

    Thanks
    Regards

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,382
    Quote Originally Posted by localhero View Post
    Hi guys,

    I also need dual Serial + MIDI + Audio for Teensy 4.1
    I've modified the files boards.txt and usb_desc.h (on my PC it's here : C:\Users\david\AppData\Local\Arduino15).
    But the option never appears in IDE 2.
    Am I missing something ?

    Thanks
    Regards
    You might look at the Arduino IDE issue: https://github.com/arduino/arduino-ide/issues/1030
    It shows a workaround

  7. #7
    Member
    Join Date
    Jan 2016
    Location
    Nantes, France
    Posts
    30
    Hi Kurt,

    I've completed my post, I was presuming it was some caching issue as I see the option for the other boards if I change.
    But still nothing for Teensy 4.1, let's try the workaround

  8. #8
    Member
    Join Date
    Jan 2016
    Location
    Nantes, France
    Posts
    30
    The workaround fixes the problem in IDE.
    Now I have to understand how to connect one device with webserial on one port, and IDE on the other port to show logs.

    Well usbaudio is not working anymore.

  9. #9
    Member
    Join Date
    Jan 2016
    Location
    Nantes, France
    Posts
    30
    Usb audio and midi with dual serial is working, the problem was in my web page code (javascript with webserial, webaudio and webmidi api).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •