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

Thread: Reading USB data with teensy 3.5 with usb host shield

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    7

    Reading USB data with teensy 3.5 with usb host shield

    Hi, so my project requires the microprocessor to receive measurement data from the multimeter via usb connection. I have purchased a usb host shield from sparksfun (https://www.sparkfun.com/products/9947) that operates in SPI.

    Right now I am stuck on where to get started with the project. How should I establish connection between the teensy and the usb host shield in order to read the data sent from the multimeter using teensy?

    Thanks so much.
    Jaewoo

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,307
    Yes, if using that host shield, the first step would be just getting the shield connected and running the "board_qc" example to check if the hardware is really working. Well, that is assuming you've at least uploaded to Teensy and know it works and you can print to the serial monitor!

    Which multimeter are you using? Do you know whether it's supported by the USB Host Shield library?

  3. #3
    Junior Member
    Join Date
    Nov 2017
    Posts
    7
    I am using rigol 3068 and not sure if it is supported by the host shield library. I haven't been able to find information about it.

    Since the USB host shield is designed to fit directly on top of arduino, how should I connect the pins for teensy?

    Thanks,
    Jaewoo

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,307
    Quote Originally Posted by po03087 View Post
    Since the USB host shield is designed to fit directly on top of arduino, how should I connect the pins for teensy?
    Based on this shield's schematic (but not having actually used it myself), I'd imagine you would need to connect digital pins 7 to 13 from Teensy to the digital pins on this shield. Of course GND needs to connect to GND. Keep these wires "short". A few inches is ok.

    Teensy 3.5 follows the same pinouts as Arduino Uno for the SPI signals, so odds are good this shield will "just work" if you connect the signals directly (7 to 7, 8 to 8, and so on). In the comments, people mention issues with pin 7 on regular Arduino boards. You might need to add a few lines of code at the beginning of setup() to pulse pin 7 low, then keep it high while you actually use the USB Host Shield lib. Pins 11 to 13 will automatically be used for SPI. You might check whatever host shield code you're using to make sure it's defaulting to use of pins 8, 9 and 10 for those other signals.

    This shield gets all its power from the VIN pin. My best guess is you could just connect VIN from Teensy 3.5 to VIN on this shield, at least if your USB devices don't need a lot of power.

    There's no point connecting 5V, 3.3V, AREF or digital pins 0 to 6, since this shield doesn't use them.

    This is all a bit of guesswork, based only on reviewing the info on Sparkfun's site and my previous experience using the host shield lib with other shields. I haven't actually used this Sparkfun one. You might need to adapt things a bit, but hopefully this starts you on the right general path?

  5. #5
    Junior Member
    Join Date
    Nov 2017
    Posts
    7
    Makes sense. Thank you so much. Will let you know if I encounter huge burdens.

    Jaewoo

  6. #6
    Junior Member
    Join Date
    Nov 2017
    Posts
    7
    Hi, so I think I have the USB host shield working. Now, the problem is that I cannot find a way to make the teensy to read serial data from the usb port. I have been searching a way to read serial data using USB host shield connected to Arduino or teensy, but did not have much luck.

    Here is the setup:

    Rigol 3068 multimeter ----> USB host shield / Teensy 3.5

    I know that my multimeter sends 14 byte ASCII serial data, and would like to read that using the USB host shield.

    How should I code this? I have looked through the USB host shield library 2.0, but the library provides high level examples (XBOX controller, bluetooth, etc), but not this kind of simple task.

    Any help would be appreciated.

    Thanks,
    Jaewoo

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,307
    Are you sure the Rigol really uses serial communication?

  8. #8
    Junior Member
    Join Date
    Nov 2017
    Posts
    7
    Quote Originally Posted by PaulStoffregen View Post
    Are you sure the Rigol really uses serial communication?
    I am not entirely sure since I have not tried it.. I know that the RS 232 data pin provided serial data. Would usb communication be different?

    Thanks,
    Jaewoo

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,244
    Sorry, I have been following this thread more out of curiosity about would are usbhost_t36 code support this.

    And I am not sure. I did not see anything in their document that was explicit about what the underlying usbadapter is using.
    But I noticed that it was talking about USB-TMC (or USBTMC) when talking about drivers. I also think I saw something like not all Serial drivers support the TMC stuff...

    Again not sure if that helps or not.

Posting Permissions

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