How to do this: embedded USB-Host communication with plugged USB-Device - c

I am currently practising with USB programming on an AT91SAM9G20-Evaluation Kit. I learned much about USB devices and USB device port drivers while "playing" with the ATMEL provided USB device port projects (CDC-driver, ..).
But now I'd like to write a small driver to controll a wireless stick
which I plugged into one of the boards USB-A Host Ports.
I read a lot on Stack Overflow, the OpenHCI specification and even found some libraries on the net, but I am not sure if it's a good way to implement my own stack without any "good" knowledge in USB Host Port programming.
Is there a small and easy way to control the wireless-stick at the boards USB Host port? (like using the USART-Interfaces?).
I am also keen to hear hints on how to implement RTUSB or libUSB in to the AT91.

You can download AT91LIB version 1.9 from atmel from this page
The usb host libraries are under at91lib/usb/host. They're not the complete package you need though since they're just the OHCI driver -- you still need a USB driver and class drivers to implement what you want.
You could try an RTOS with USB Host support like rt-usb32

Related

USB HID Device Driver Development in FreeBSD

I am currently developing a driver for an HID device on a FreeBSD system. The idea is that the driver writes to the device's registers through the Control Endpoint. From then on the device acts according to the data fed.
Since I have just started out on drivers, I am following a guide book (I would name it here but I don't know if I can? ). This book tackles a USB ULPT (Printer) driver, explaining the basic driver for a USB device. However when I am trying to implement these concepts to the HID device, I am having trouble, more specifically when it comes to identifying and probing the device.
Since I haven't found much material online, I was wondering are there any guides/books or tutorials I can follow which tackle the development of an HID device driver on FreeBSD or at least Linux systems. A pointer (pun intended) to the right direction would be enough to get me going again.

Linux Serial Device Server over USB?

I have an embedded Linux solution and want to create a command service over serial USB. The idea being that when a computer connects to my embedded via USB, they see a serial device and send serial commands to me through that port and I send responses back.
I need some help in the direction to proceed. Do I need to emulate a serial device so they see me as a COM port? Is there build in Linux solutions to broadcast my details as a serial device? Are there code examples? I can see block devices connect with my embedded solution like a USB storage device. When I plug into another computer, I would like it to see me as a serial COM port.
I just need help in the direction of which path I should go down to solve this.
Thanks in advance.
What you are looking for is the Linux USB serial gadget. The Linux USB gadgets framework allows devices to behave as a variety of standard USB devices, including serial devices, Ethernet adapters, and mass storage devices.
Note that USB gadgets will only work on targets with a USB controller that can be set to operate as a USB device. Not all USB controllers and target devices are compatible with this configuration. For instance, most PCs have a host-only USB controller, and the Raspberry Pi Model B is not compatible with gadgets because it contains an embedded USB hub upstream of the USB ports. (However, the Pi Zero is fully compatible with gadgets.)

How to dump/burn program into LPC2148

I have LPC2148 daughter board but I am not able to dump/burn code into it, and it doesn't have any usb connector to dump code.
I read on internet by using FT232RL I can able dump code into LPC2148 but I am not able to do so.
please give me solution
thank you..!
The chip supports In-System Programming (ISP) via an on-chip boot loader ROM.
From the User Manual UM10139:
Programming of the Flash memory may be accomplished in several ways:
over the serial built-in JTAG interface, using In System Programming
(ISP) and UART0, or by means of In Application Programming (IAP)
capabilities.
The function of the FT232RL you mentioned is to act as a USB/UART bridge and is necessary primarily because modern PCs lack legacy RS-232 serial ports. You can in fact purchase a USB-Serial cable or adapter which will contain a bridge chip such as the FT232RL. Most of these use RS-232 line level signals, so you would still need an RS-232 line driver/receiver to connect then to your board (if your board has a serial port, it probably already has a line transceiver and you can connect directly to that). It is possible from specialist suppliers including FTDI themselves to get a USB cable with integrated FT232 and bare TTL level connections to connect directly to LPC2148 UART0 Rx/Tx lines.
If your board does not already expose a UART0 serial port and the necessart control to start the boot loader, a Serial Port Bootloader Interface board is available. For that you may then also need a USB/Serial adapter or a PC with a legacy serial ports.
Once you have a suitable serial connection, you will need the LPC2000 Flash Utility software to run on the PC.
The JTAG option is however faster, and more powerful since the JTAG is both a programming and debugging port. With a suitable toolchain and JTAG adapter it is possible to program and execute code with source-level PC hosted debugging including break pointing, data watching and single stepping of the code.

Device Driver programming - USB

I have to discuss the codeflow of the USB host controller. This USB host controller is the interface between the device and the OS. There are numerous USB devices (eg.keyboard,camera,mouse,etc).
Where will I find the code to see how the communication between the USB device and OS happens through the USB host-controller ?
Download the Linux kernel source code, and start reading the code in drivers/usb. Here an online reference, and the README about the USB-tree
I suggest you to take a look at USB host controller specifications - UHCI/OHCI/EHCI/XHCI because this knowledge will be necessary to understand whole USB stack in linux kernel.
You may also download some example sources provided by several embedded microcontroller producers (i.e. Atmel). Probably those drivers will be easier to analyse than linux sources.

Communicating to USB Device

I bought a usb otoscope from the internet and I want to create an application that uses it. When I plug it into the computer, it reads the device as a USB Camera, and I can use the very barebones software supplied to communicate with it. I'm very new to the idea of communicating with usb all together. I've tried to look at some sites like this: http://www.jespersaur.com/drupal/book/export/html/21, that tell me how to reverse engineer a device. I don't know if I'm going down the right path with this...
I've downloaded USB Snoopy and I can't seem to get it to sniff the packets correctly. I also have Crunchbang linux installed on a different computer but I don't know how to sniff it on that either (especially because the drivers are native to windows). All I want is some sort of API/Interfacing functions for me to call and use. How do I go about doing such a thing? I'm able to locate the device on the device manager in windows, and it tells me hardware ID's and such. I can supply any information if necessary. Thank you.
EDIT - Small description I found of the otoscope: http://microscopesimgv.blogspot.com/2012/08/oasis-ehev2-usbplus-20mp-handheld-usb.html
would this tool help you any?libusbx is a cross-platform user mode library that provides generic access to USB devices
CHEERS!

Resources