USB to COM, how does the RS-232 interperate data? - usb

If I had a RFID reader that sends a bunch of keystrokes through USB like a HID, how would the COM port interperate that if I used a USB to COM converter? What would the COM port see?

You should see the "keystrokes" from the rfid device.
At the link level, the converter should take care of speed mismatch issues. It does this via an internal buffer or by throttling the sender.
But the HID protocol is more than simple keystrokes. So either the additional information will be suppressed by the USB-COM converter or it won't be. This issue may also be converter-dependent.
In this sort of HW mashup, the best thing is to try it and see. (And then write a blog post about what you discovered.)
What is your overall goal? What sw are you trying to connect the RFID reader to?
Added I agree with #Turbo J's point: most every USB-COM converter acts as a USB device. As such, if you connect them to another USB device, nothing will happen since you're using them "the wrong way around."
You'll need to find a USB/Host to COM converter. The usual name for such things is "computer" -- a used laptop may be your best bet if you want to continue down this road.

On USB, a device can only talk to the host.
The RFID reader is a device. The USB->COM converter is a device. They cannot talk to each other wihout a host.
Conclusion: If you want the RFID data going out of the COM port, write a program which does that - by reading the HID data from RFID device and writing to the USB COM port.

Probably nothing. COM ports are usually very low speed things (you can usually tweak them up to about 115kbps. USB ports are (by comparison) incredibly high speed ports. I think the lowest speed USB is like 1.5mbps.
The more important question is how you are going to make the physical conversion.
You have an RFID reader that has a usb plug on it. Are you going to chop this off and solder a db9 connector on the end, which you are then going to plug into an USB to COM adapter and try to read serial data off the com port?
You are adding in one more step into it that you don't need to (you're taking up an usb port anyway).

Related

Data input/output on Basys3 board's USB port

I'm trying to configure/write VHDL code that would let me output or input data from the USB port on a Basys3 FPGA board. Problem is I have yet to found any threads or questions that talk about this topic.
The nearest thing to an answer I've found is this:
Provide input data to FPGA using USB
and it does not contain what I'm looking for.
Any clues anyone¿?
The Basys3 board has a usb-uart bridge chip as described in the reference manual. This will appear to a PC (or any device with a usb host and the appropriate usb-serial drivers) as a virtual com port. Sending data to and from a PC com port is quite easy.
You will need a uart implementation on the FPGA. There are lots of example designs on the web. One way is to implement a soft core microblaze processor with a uart peripheral in the FPGA. This example looks like it includes foundation for the functionality you desire.
The simplest implementation from the PC side is using a terminal program such as putty, Tera Term or realterm. Most languages include com(serial) port libraries or bindings. This type of interface tops out at a raw bandwidth of around 3-12Mbits per second depending on the drivers and implementation.
Read the manual for the Basys 3 board. It will explain how you can interface with USB devices plugged into the USB port. Be warned, however, that your options are pretty limited.
Short version: if you plug in a USB mouse or keyboard, they will be exposed to your design as an emulated PS/2 device. USB storage devices can be used to configure the FPGA. Other devices are not supported.

How to write firmware for a custom USB keyboard?

I have a custom ps2 keyboard(8x8 matrix) interfaced with AT89C51ED2 microcontroller, now I need to change it to USB interface. I have been studying about the basics of USB HID class communication(USB HID class specs, USB complete, Beyond logic) and have come to know little bit about the theory behind it.
But I am not able to understand the firmware part, I read a demo keypad application by Microchip which had given a sample source code, but I am not able to understand in the code how data(key pressed) is sent to the IN endpoint and how the host reads that through polling. I know that endpoint is a buffer from which data is sent to host, but Is it one of the registers of the micro-controller and how do I use it in my code?.
And I have been searching the suitable micro-controller with USB support, but no supported demo's are available, any suggestions will be helpful
The AT89C51ED2 datasheet does not mention hardware support for USB, so the answer is no: an endpoint does not correspond to a hardware register. Instead, an endpoint would refer to some software buffers in the RAM of the chip, and some data to keep track of the endpoint's state. Every bit of every USB packet must be handled by the firmware of the device, and endpoints are an abstraction that live entirely in the firmware of your device.
Note: I am assuming that the keyboard doesn't have some kind of USB interface chip, and that the data lines of the USB cable connect more-or-less directly to the microcontroller.
If you can't find the source code for the keyboard, you might look into using an open-source AVR software USB implementation. Here are some useful links:
https://www.obdev.at/products/vusb/
http://www.fischl.de/usbasp/
Please note that you are undertaking an advanced project, and if you are not familiar with AVRs, USB, microcontrollers, reverse engineering, and embedded development/debugging, it might be useful to start with something simpler first.

Directly Control USB Output?? (any language)

So I know that for a USB port type A there is 2 ouputs/inputs. I'm working on a simple electronic circuit and I would like to ouput datas on to my computer so a program could work with it. How (without it getting too complicated on the circuit side) can I just choose the output of the USB port and read the input just on the on/off level?
Thanks
What you want is the www.Nusbio.net device.
it is an USB device that give any .NET programming languages access to 8 gpios and also SPI and I2c bus.
USB is more complicated than what you are describing. It sounds like what you really want is a serial port, where you can use the TX and RX lines as your output and input to the PC, or manually control the modem control or GPIO pins. You can still do this with USB via a USB to UART Bridge device.
If you are simply looking to toggle an I/O pin, some of these devices also have general purpose I/O pins for this type of thing. You can set it to low/high from the PC if it is set to be an output and read the I/O value if it is an input.
You can talk to it as a serial device from your computer using normal serial communications such as POSIX method for Linux or OSX or the Commuincations API for Windows. In this case you can also set the flow control to manual and use the RTS/CTS pins as GPIOs.
You cannot directly control the USB inputs and outputs like you want to do. However, there are various solutions that involve connecting a USB device to your computer and sending commands to it that use its inputs and outputs. One such solution is called Firmata.

Korg Nanokey MIDI Controller for Arduino?

I have a Korg NanoKey which I'd like to use to control a simple synthesizer I've designed on the Arduino platform. (I have an Arduino Uno.) Basically, I don't care about MIDI, I just want to read what note the keyboard has pressed down, but if MIDI is the only way I can do that, then it's okay with me. So my big question is, how do I do this? I haven't been able to find anyone else on the Internet who has already done this.
But more specifically, I see two challenges: First, I'd like to plug my NanoKey directly into the Arduino's USB port, but then I'm wondering if the Arduino would provide the necessary power to the NanoKey. Second, I'm not sure what protocol I would be reading. Can I just read MIDI signals as described in this tutorial?
I don't want to curb your enthusiasm but what you're attempting might be a bit hard basket. A USB system consists of a host controller and one or more peripheral devices. It's the host that controls traffic flow to the devices which means that devices can't transmit data on the bus without an explicit request from the host controller.
I'm not familiar with either the nanoKey or the Arduino platform but I'd be fairly confident that the nanoKey is a USB "device", normally connected to a computer which would act as the host. So what you would need for this system to work is for the Arduino to act as the host when communicating with the nanoKey. The Arduino schematic shows that the Arduino Uno uses an ATmega8U2 for USB coms. Unfortunately the ATmega8U2 is a USB device, so you've got two peripheral devices but no host controller to facilitate the transfer of data between them. You'd be better off using a development board for a micro that provides either USB Host or USB On-the-Go.
I opened up a Korg Nano controller yesterday and was surprised to discover that there's an AVR mega32 inside. It would be a significant undertaking, but with a bit of work you could probably work out the schematic and reprogram it yourself using their programming header breakout. You might not end up with much more functionality than you've got this other way, but it would be very educational.
I agree with the Jono - you are biting off a lot - it might even end up easiest to hook the keys up to the Arduino directly - tearing out the electronics and figuring out a way to multiplex the keys into a single channel without losing polyphony (resistor 'ladder' maybe). I any case, good luck. Amusingly, you'd making an analog keyboard to plug into a digital synthesizer.
Quick and Dirty Arduino MIDI Over USB demonstrates how to send/receive MIDI out over USB, but unfortunately, this probably isn't any help for what you are trying to do, since he's found a way to send and receive MIDI signals from a USB host, not act as a USB host himself - the opposite of your problem. However, I thought perhaps it would be of use, if you ever wanted to control your device from a computer.
As mentioned in the other posts, you would need to use a separate chip to provide the USB Host interface. Here's a great guide to using the USB Host shield by Circuits#Home to interface with an Akai LPK25 (USB Midi Keyboard).
http://blog.makezine.com/2010/11/30/usbhacking/
The Arduino sketch is provided, so you should be able to try it out, however debugging the USB Host connection could get tricky real fast if it doesn't work out of the box.

Ethernet - USB communication

I have a piece of hardware that sends USB data over ethernet (only the data stored in the package will be send). On a remote PC the data is recieved via ethernet. How can I send this data to the USB driver so it translates the data into commands applications can use?
You're better off getting hardware that does the reciprocal, sends the IP-based USB information to the USB subsystem, rather than try and hack the software driver itself. I can't imagine your hardware vendor doesn't have a device that does this.
You need a server listening on whatever port/socket that you are trying to connect to. Twisted Matrix makes decent Python libraries for network communications.
I think this is going to be troublesome.
USB is generally set up to associate a driver with a connected device, based on the device's various ID numbers, as discovered during bus traversal.
Your data comes in over Ethernet, so the platform's USB driver stack won't know anything about the device in question. This means you somehow need to directly talk to the proper driver, and also get it prepared to handle events from a (from its point of view) non-connected device.
I can think of several reasons why even a well-designed USB stack won't handle this happily.
On Linux, you might be able to "cheat" by interpreting the data yourself and sending it on, using the same API:s the actual driver would have used. That won't work for any USB device of course, it requires you know what the device is.
It's doable on windows as well, but you need a lot of kernel/usb knowledge to make it work i don't think i will be wrong by estimating this task as few man years (you can reduce this estimation dramatically if you have a limited selection of devices/types of device to support.
You will need to develop a bus driver that will simulate the host controller driver to the native usb host, unfortunately this interface is not public and we did not managed to get MS cooperation on that.
There is additional option to work on hub level, instead on controller level, this interface is available, but i did not managed to find my notes on that.
You can download the evaluation version and investigate the driver stack it might give you a clue where to start.