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

Thread: Maximum transfer rate between computer and teensy 3.6

  1. #1

    Maximum transfer rate between computer and teensy 3.6

    Hi,

    I want to use a teensy 3.6 to update 32 shift registers.

    The data will be sent from a computer that processes the numbers then transfers it over to the MCU to output physically to some transducers.

    The transfer rate I'd prefer is 20 MB/s

    I know the USB serial bus is too slow for this, and i've done some research but can not quite figure out if an SPI bus between a computer and teensy 3.6 could handle this bandwidth.

    If not, what would be the fastest way to transfer data from a computer to the MCU? If the teensy isn't adequate, then can someone suggest an alternative board? I'm desperately trying to move away from an existing FPGA design!

    Any ideas?

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,385
    Using the Teensy's 2nd USB (host) port which offers 480MB/s, you should get it done.

  3. #3
    Quote Originally Posted by Theremingenieur View Post
    Using the Teensy's 2nd USB (host) port which offers 480MB/s, you should get it done.
    Interesting, thanks. I'm struggling to find much documentation.

    Also, would putting the MCU as host make communication much harder since it is primarily receiving data?

  4. #4
    Quote Originally Posted by Theremingenieur View Post
    Using the Teensy's 2nd USB (host) port which offers 480MB/s, you should get it done.
    Can a Computer connect to the teensy 36's 2nd USB? I thought the second port was only good for MIDI or Mice or Keyboards?

    I thought the maximum data transfer with a PC was ~12MB/s and this available only through the main USB port.

    For my project, my potential users need to pull gigabyte datalogs from the SD card in a dangerous and time critical application/environment.

    I'm currently using MTP serial port on the main USB that gives 1MB/s. This is a great solution for ease-of-use as any PC can read (and write) to the SD card, no arduino or teensy drivers needed. Not good for speed though....

    Interested to know if there was a faster way.

  5. #5
    If i'm up to date, there is no high speed USB stack ready for that. It looks like Teensy 4 in the future will give you a ethernet option.

  6. #6
    Senior Member
    Join Date
    Feb 2017
    Posts
    279
    Quote Originally Posted by Darcy View Post
    my potential users need to pull gigabyte datalogs from the SD card in a dangerous and time critical application/environment.
    Then perhaps a hobbyist-grade microcontroller board is not the appropriate platform. Paul has done a fantastic job with Teensy. But, consider the price point he's shooting for.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,941
    Quote Originally Posted by Darcy View Post
    Can a Computer connect to the teensy 36's 2nd USB?
    This question revolves around the meaning of 2 words, "Computer" and "Can".

    By "Computer", you probably mean USB host. USB has very specific terminology and it's important to be precise when talking about technical matters with such a complicated protocol.

    The word "Can" is trickier. Today the only ready-to-use library is USBHost_t36, which only supports using that port in host mode, as you might guess from its name. USB hosts can't talk directly to each other.

    There may be some computer-to-computer USB products on the market, which acts as 2 back-to-back USB devices. I have seem some advertised before, but I know nothing about them. I can tell you USBHost_t36 has no driver support for any such USB device, so getting it to work with USBHost_t36 would involve writing a C++ driver class in the library, which in turn would need detailed protocol info. For specialty USB products that use undocumented protocols and have binary-only drivers offered only for Windows, the odds of getting them to work on *any* other platform (even Linux) is slim. You'd need to find a computer-to-computer USB product that's well documented at the protocol level to have any chance...

    Until recently, the only other code existing would be in NXP's SDK. We don't support that, and it's probably outside the reach of most people to really use.

    Writing the USB stack from scratch is theoretically possible, but it's quite difficult programming and requires a very deep knowledge of USB protocol. I would not advise attempting it.

    Teensy 3.6's 2nd port is basically the same hardware as we're using in the Teensy 4 beta test. The PHY is a little different, but the EHCI controller is pretty much identical, but twice as many endpoints supported.

    Using the beta code on Teensy 3.6 would be quite a challenge for anyone not already very familiar with the hardware. Today the beta code still leaves quite a lot to be desired, with many features missing. So far, its performance is barely better than the highly optimized code we have for 12 Mbit/sec USB on Teensy 3.x. Over the next couple months, that will change as I work more on the code.

    So in time, probably by April or May, there's a pretty strong possibility this new code will get ported back to Teensy 3.6. Hopefully by then we'll also be shipping Teensy 4.0. If you can wait 3-4 months, ether Teensy 3.6 or 4.0 may work out to a really good solution.

    If you need something right now, I'd suggest looking at the Beaglebone Black. I have only used it for one project, and I only used it as a USB host, so I'm not 100% sure if it can do USB device. But I recall Jason (from Texas Instruments - the guy behind Beaglebone) talking about that at some point. The BBB also has a feature called PRU which allows high speed I/O, which probably makes it a much better candidate for your project than other Linux SBCs like Raspberry Pi.

  8. #8
    Quote Originally Posted by gfvalvo View Post
    Then perhaps a hobbyist-grade microcontroller board is not the appropriate platform. Paul has done a fantastic job with Teensy. But, consider the price point he's shooting for.
    'in a dangerous and time critical application/environment' probably sounds too professional, and I agree would suggest a more bespoke solution would be more appropriate.

    However, I class myself as a hobbyist with limited liability, and my users will use my products in deflated safety and highly time-dependent hobby applications.

    The Teensy is a perfect fit!

    Thanks Paul for the excellent and comprehensive (as always) reply.

    I won't start coveting a Beagle, she's likely out of my (coding) league, the Teensy is already batting above my average....

    I'm looking forward to the T4.0 though!

  9. #9
    Junior Member
    Join Date
    Jul 2013
    Posts
    13
    Quote Originally Posted by orbitronics View Post
    Hi,

    The transfer rate I'd prefer is 20 MB/s
    I'm curious if you mean MB/s (to me this is megabytes per second) or Mb/s (which is megabits per second). Megabytes is at least 8 times harder than megabits and 20 MB/s implies a serial clock of 160 MHz if you are transferring only data with no other command packets and not bit banging the clock. To me, this isn't doable with any Teensy and Paul's suggestion of a Beaglebone or an FPGA is based solution is the way to go.

    Regarding USB... I had to go look it up, to make sure I wasn't confusing MB/s and Mb/s for USB, too, so I hope I trusted the right websites...

    USB1.1 - 12Mb/s or a little over 1MB/s
    USB2.0 - 480Mb/s or about 60MB/s
    USB3.0 - 5Gb/s or 640MB/s

    The highest amount of data I personally have managed to push to a Teensy is about 8Mb/s over an ethernet port -> SPI -> Teensy 3.2 @ 96MHz. This is part of my Commodore 6581 SID network player device which runs at a 1MHz clock

    FYI...
    I'm a bench validation engineer at work and I used to validate high speed ADCs. One was a 12 bit 1 gigasample device that reqired a really fancy FPGA based logic analyzer with a 16 bit parallel bus to transfer up to 2GB/s.

    David

Posting Permissions

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