Two way USB communication with USB Client DP and FEZ Spider

Hi all,
I have a FEZ spider and the following modules (USB Client DP, LED7C, Button amongst others) and I want to create an electronic scale.

You put something on the scale, I take the measurement (in the form of voltage that is converted to weight) and then I push it to the USB where another application reading the data will use it to plot the graph (there is a lot I do not know about this but I’ll keep it to one question per post :slight_smile: )

My first question is how do I achieve this two way communication?
I saw a post during my search which suggested that this was possible but I lost the link unfortunately. It did indicate that if I’m using the USB for two way communication, then it cannot be used for deployment and debugging. I’ll need to use a serial connection for that. I doubt I can order any new components considering the time I have left to get my prototype running.

A link to a working sample or tutorial will be helpful. I’ll just create a small application that will generate a sequential number and send it through the USB and I’ll use the application at the other end to plot some kind of graph.

Thanks in advance.

you are most likely talking about CDC. Check this document https://www.ghielectronics.com/docs/20/usb-client

The intent is that you turn off USB debug (on a spider with a switch, on others usually a jumper) and then a serial device is present on your PC. To get back into “deployment mode” you simply switch the switch back to USB debugging and you no longer get CDC but you can update your code and redeploy - you just can’t do both over the same connection. With some code to check for status before you blindly turn on CDC you should be fine.

Also if you have an FTDI cable or some other USB-TTL serial device, you can use that to temporarily hook up the debug port and continue debugging as well as getting serial messages over CDC. Or of course you can go the other way and just use that additional serial port as your data transfer port, and keep the USB client port for debugging (its easier ! :slight_smile: )

Thanks for the response. Where is the switch that is used to turn of USB debugging?

the little bank of 4 switches on the Spider. I think the card that came with the Spider showed what the settings were, but https://www.ghielectronics.com/docs/54/loader-tinybooter-g120-and-emx-families has an image as well…

Ah. I just realized that my board is the FEZ Hydra. That was the original board I wanted to buy and looks like I was confusing them.

You mentioned that for the other boards I have to use a jumper. Please how do I do that? I’m not really sure exactly what to do.

I am not sure how to switch it into CDC mode, or even if there is a CDC mode on the USB Client on Hydra. I suggest you use a standard TTL USB-serial adapter connected to a set of UART pins.

Can you please elaborate on “a standard TTL USB-serial adapter connected to a set of UART pins”? Is that a new component to get?

This is what I meant. You can use a standard module for this https://www.ghielectronics.com/catalog/product/287, or an FTDI cable (FTDI Serial TTL-232 USB Cable : ID 70 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits is an example of such, I have not used this one and you will still need to connect the headers to the U socket somehow), or you can use something like the cheap CP2102 (http://www.ebay.com.au/itm/Affordable-USB-2-0-to-TTL-UART-6PIN-Module-Serial-Converter-CP2102-STC-PRGMR-N-/251536960730?pt=LH_DefaultDomain_15&hash=item3a90c56cda is an example - I have several of these)

Oh ok. I get it now. Unfortunately I did not buy any of those components since I did not think I needed them. The closest I have is the USB host but I guess that can’t do. Looks like I’ll have to forget about the two way communication then. I’ll have to purchase those modules are my second prototype but can’t buy now due to time constraints.

Given that I can neither use Ethernet or Wifi, do I have any other means of sending data to a connected PC?

Sorry, someone here might know - someone from GHI ??

Can we force CDC mode on Hydra - or does it even support CDC?

You might just try the CDC sample and see if that presents a serial port over to your PC, but if it does you’ll be flying blind on debugging.

Do you by any chance have a Bluetooth or BLE module of some kind ? What other modules ?

I do not think serial debugging is supported on hydra to release usb and even so, cdc will not work on devices not running the GHI libraries, which are not supported completely on hydra.

We recommend any of the other board for any advanced features. Hydra is good for being completely open source.

But you do not need any of this. Add the usb serial module and use that like cdc. Keep the usb port for debugging.

I agree, that’s the cleanest way.

Yeah. I think the usb serial is the best way to go. Had I known :). Thanks for all your assistance. For now, due to time constraints, I’ll look at the possibility of writing the data to an sd card and then opening the file on the pc to display the graphs.