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

Thread: Teensy 4.0 for a MIDI class compliant device using LUFA

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    4

    Teensy 4.0 for a MIDI class compliant device using LUFA

    Hello everyone,

    I would like to start a project for a class compliant MIDI device using the brand new Teensy 4.0.
    I know that this board already has 14 analog inputs, but I need lots of them, much more than that.
    In a previous attempt at starting this project, years ago, I bought and used Arduino Uno and Mayhew Labs Mux Shield II, which adds 48 analog inputs to the Arduino board.
    The 16MHz ATmega328P of the Arduino UNO, though, may be too slow for all the processing that is needed on every input before the MIDI signal is output to the MIDI host.
    Therefore, the 600MHz Cortex-M7 microcontroller of the Teensy 4.0 would be more fit.

    My questions are:

    1. Could I use use the Teensy Arduino Shield Adapter (KIT-15716) from Sparkfun to couple the Teensy 4.0 to the Mayhew Labs Mux Shield? Would there be voltage problems (3.3 vs 5.0 Volts)?

    2. Or would it be better to stack three Mux shields specifically developed for the Teensy (like SparkFun Analog/Digital MUX Breakout - CD74HC4067)?

    After that, I have read that the simplest way to program the Teensy 4.0 is by using Arduino IDE + Teensyduino. Is that correct?
    What are the steps for building a class compliant USB MIDI application using the LUFA library in this environment?
    Or does Teensyduino already come with a fitting example?

    Sorry for the noob questions, but the board is pretty new and it is difficult to find something in the net.

    Cheers

    LINKS:

    Mux Shield for Arduino: http://mayhewlabs.com/products/mux-shield-2

    Teensy/Arduino Shield Adapter: https://www.sparkfun.com/products/15716

    Mux Shield for Teensy: https://www.sparkfun.com/products/9056
    Last edited by lastshaman; 11-11-2019 at 12:07 PM.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,736
    Hopefully others who use MIDI and the like will give you a more detailed answer.

    But I will try to give at least $.02 worth of information.

    USB on Teensy 4 - LUFA? First off, hopefully a short term issue, is currently the only USB support on the Teensy 4 is for USB Serial, again this hopefully will be a short term limitation. I have only ever used LUFA on an AVR based Arduino, something like an Teensy 2, or in my case another Atmega32U2 board.

    So if you are doing a new MIDI device, I would start off looking at: https://www.pjrc.com/teensy/td_midi.html

    As for which setup to use to get enough Analog inputs? For me hard to say. I have never needed that many analog inputs. I believe either of them should work with 3.3v signals. However the Teensy 4 is NOT 5v tolerant, so would need to make sure that none of the signals coming to it were 5v. Now if you are building your own device, that probably would not be an issue as you can hopefully feed all of your inputs with 3.3v... At least for things like sliders and knobs... But again don't know your setup...

    If it were me starting off, I would probably experiment first with the Teensy 3.5 or 3.6, to get me going as there is currently more support for them especially on the USB side... If I wanted to try this out quickly and get full usage of all of the pins of either of these two boards, I would probably get one of the breakout boards from TallDog(loglow): https://www.tindie.com/products/logl...sion-a-dip-64/ (He has a few different versions there) and you can get them pre-assembled. Out of the box you have something like 24 analog inputs. If I needed more I would try bread boarding it up with either of the other Mux boards you mentioned. Since I don't have either I would probably start with one or more Sparkfun ones...

    But with this setup, you should hopefully simply setup the Teensy to be a MIDI device and you can start experimenting with your desired inputs and outputs... And then if you find you still need or want more horsepower you can hopefully migrate to the T4, where hopefully by then @Paul will have added the MIDI, and several other USB types like Joystick, Mouse, HID ... support to Teensyduino for the T4.

    Again sorry I know that is not much specific help, but hopefully someone else will fill in the holes.

  3. #3
    Junior Member
    Join Date
    Nov 2019
    Posts
    4

    Cool

    Hi KurtE,

    thanks for your answer. It made me think about the possibility of using a less recent board, like the Teensy 3.2.

    I have found this breakout board, which should solve all my problems, including 3.3/5.0v compatibility:

    https://www.tindie.com/products/cbur...toothnrf24l01/

    This board should allow a Teensy 3.2 to use the Mux Shield for Arduino Uno.
    I asked the producer if it is also compatible with Teensy 4.0 for what concerns the Mux Shield.

    After all, what I need is an Arduino Uno with a Cortex-M7 microcontroller.
    Maybe someday someone will produce something like that... (a possible suggestion to @Paul) :-)

    Regards



    Quote Originally Posted by KurtE View Post
    Hopefully others who use MIDI and the like will give you a more detailed answer.

    But I will try to give at least $.02 worth of information.

    USB on Teensy 4 - LUFA? First off, hopefully a short term issue, is currently the only USB support on the Teensy 4 is for USB Serial, again this hopefully will be a short term limitation. I have only ever used LUFA on an AVR based Arduino, something like an Teensy 2, or in my case another Atmega32U2 board.

    So if you are doing a new MIDI device, I would start off looking at: https://www.pjrc.com/teensy/td_midi.html

    As for which setup to use to get enough Analog inputs? For me hard to say. I have never needed that many analog inputs. I believe either of them should work with 3.3v signals. However the Teensy 4 is NOT 5v tolerant, so would need to make sure that none of the signals coming to it were 5v. Now if you are building your own device, that probably would not be an issue as you can hopefully feed all of your inputs with 3.3v... At least for things like sliders and knobs... But again don't know your setup...

    If it were me starting off, I would probably experiment first with the Teensy 3.5 or 3.6, to get me going as there is currently more support for them especially on the USB side... If I wanted to try this out quickly and get full usage of all of the pins of either of these two boards, I would probably get one of the breakout boards from TallDog(loglow): https://www.tindie.com/products/logl...sion-a-dip-64/ (He has a few different versions there) and you can get them pre-assembled. Out of the box you have something like 24 analog inputs. If I needed more I would try bread boarding it up with either of the other Mux boards you mentioned. Since I don't have either I would probably start with one or more Sparkfun ones...

    But with this setup, you should hopefully simply setup the Teensy to be a MIDI device and you can start experimenting with your desired inputs and outputs... And then if you find you still need or want more horsepower you can hopefully migrate to the T4, where hopefully by then @Paul will have added the MIDI, and several other USB types like Joystick, Mouse, HID ... support to Teensyduino for the T4.

    Again sorry I know that is not much specific help, but hopefully someone else will fill in the holes.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,821
    Answered a similar question yesterday about the USB MIDI on Teensy 4.0 frame. Short version: near the end of November.

    https://forum.pjrc.com/threads/58292...l=1#post221121

  5. #5
    Junior Member
    Join Date
    Nov 2019
    Posts
    4
    Quote Originally Posted by PaulStoffregen View Post
    Answered a similar question yesterday about the USB MIDI on Teensy 4.0 frame. Short version: near the end of November.

    https://forum.pjrc.com/threads/58292...l=1#post221121


    Thanks Paul. I look forward to it.
    In the meantime, I will experiment with other Arduino boards.

  6. #6
    Junior Member
    Join Date
    Nov 2019
    Posts
    4

    Some other questions about Teensy 4.0

    Quote Originally Posted by lastshaman View Post
    Thanks Paul. I look forward to it.
    In the meantime, I will experiment with other Arduino boards.
    Hi, I have some other questions:

    1. I want to collect analog inputs from piezo buzzers and I plan to use 4x Sparkfun's BOB-09056 16 channel multiplexers, which are based on 74HC4067 (that is, not 74HCT4067). I have read that they have to be powered with 3.3V. Is that correct?
    2. When I connect the multiplexers to the Teensy 4.0, which of its ground pins should I connect? AGND or GND? And why?
    3. I have read questions about powering the Teensy with an external power adaptor (5v). I have read that it requires cutting traces on the board in order to avoid reverse current flowing into the USB port. Why should one do that? If I understand it correctly, if USB data connection is not needed, the board could be powered using a USB charger connected via USB charge-only cable. Is that correct?
    4. I would like to add DIN 41524 (DIN 180) connectors to the board. For 3.3V operation using a 6N138 optoisolator, is it sufficient to replace the 220 Ohm resistors of the MIDI IN with 47 Ohm ones or, following the MIDI specification, with 33 and 10 Ohm resistors?

    Thanks for the kind answers

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Quote Originally Posted by PaulStoffregen View Post
    Answered a similar question yesterday about the USB MIDI on Teensy 4.0 frame. Short version: near the end of November.
    this means very soon (within a week)?

Posting Permissions

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