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

Thread: Teensy 3.6 USB communications with Host PC (no console)

  1. #1

    Teensy 3.6 USB communications with Host PC (no console)

    Hello all,

    Apologies if this is a na´ve question.

    I wish to communicate back and forth to and from an embedded Teensy 3.6 module and a Windows 10 PC using the USB ports on each. I wish to do so within the confines of an executable that is preferably written in C, though C# would be usable as well. I wish for this executable to be 'hands-free', in that once run, the executable will be able to send, receive, and log any data without a user interacting with a console.

    So far, I'm planning on using the 'Serial' library provided with the Teensyduino package. On the host PC side, I am supposing that I will have to try sending a 'magic' sync word to each COM port and waiting for a response to establish a connection. Now, as I am unfamiliar with USB HID, I am only assuming that I will need some sort of API or driver in order to actually get my data abiding by the USB protocol and across the USB line. I've heard talk around the 'net of 'hidapi' and 'libhid'. Am I on the right track?

    Thank you.

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,057
    Communicating with a PC via Usb Serial is quite simple. You don't need any HID stuff or low level USB communication. Just open the virtual serial port and write / read from it. How to open a serial port obviously depends on the language you want to use on the PC. In the Teensy user WIKI you find some example code showing how to do this with c# https://github.com/TeensyUser/doc/wiki/Serial

  3. #3
    Thank you for your help! I'll give it a look. This sounds great.

    As a side note, are you the luni64 who I see on the TeensySharp GitHub page?

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,057
    Quote Originally Posted by cinemaphobic View Post
    ... As a side note, are you the luni64 who I see on the TeensySharp GitHub page?
    Yes, I did TeensySharp some years ago when I was tired of looking in the device manager at which port my various teensies are connected today... It also contains an uploader class which comes in handy if you want to provide uploading from within your windows application.

Posting Permissions

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