Teensy to imitate a USB bulk data transfer

1.4k views Asked by At

I've purchased a teensy 3.0 in the hope I can use it to imitate the USB bulk transfer from another piece of hardware.

I am developing some software to read and process the data coming over USB in a bulk transfer

But I am trying to do this prior to actually having the USB device to test against

Hence I thought I could imitate the actual device by having a teensy send a few representative packets over the USB instead.

I know the USB packet format so can knock up a few char arrays with the expected binary format. I'd then have write a program (hopefully in C as thats what I know) that encapsulates those char buffers and then tries to send them as a bulk transfer over USB, probably using libusb I think. I'd have to build and load this on to the teensy using the correct build tool (avr-gcc and halfkay?) and then plug in the teensy and hope it behaves like the device i am trying to simulate

does this sound feasible/possible?

can anyone suggest what the code might look like or any good tutorials? I'm so new to this I don't even know what to search for.

Might it be the case that I have to learn 'arduino' as opposed to being able to write the program in C?

1

There are 1 answers

3
Damon On BEST ANSWER

First let me clear what I understand from your question.

You are creating a software that can analyse any data that can come over USB. You are trying to use Teensy to send data to USB and then process it.

Now the answer for feasibility lies in the compatibility of your software. If your software is able to read data from a USB that is initialized as a COM Port, then and only then your software wold be able to read that data.

This is because both Teensy and Arduino uses USB port with a FTDI chip that communicates with all the other devices as a serial communicator. This is a small chip near the USB port.

Now if your software is able to read data from a COM port, then when programming the Teensy, you just have to use usb_serial_write() function with a loop. You can get more help over here.

But if your software is not able to read from a serial COM port, there are many other applications such as Teraterm to store received data to a file. You can then use this file extract the data and process it.