We are using OEM QVGA BaseBoard (LPC2478 based) by Embedded Artists as a USB host. Our slave is a Kleindiek Nanocontroller running on 115200 baudrate. The Controller requires no special protocol to send it data. The PC has ben used to send commands (as ASCII characters )to the NanoController using MATLAB as a platform.
Our Project is to make the LPC2478 host transfer an array of 8bit ASCII characters to the NanoController.Using the NXP USBHostLite program we have configured our microcontroller as a host.The host gets initialized. By definition we feel that the Nanocontroller falls under the category of Communication Class of Devices for USB.
Following are our queries.
1) how do we modify the parsing function in the USBHostlite program to parse a CDC descriptor. 2) Once Parsed and our device enumerated, can we simply send a string of ASCII charcters using the WriteLE16U function provided in the NXP USBHostlite program
Note that USBHostLite is an NXP product - not Keil.
"USBHostLite is a stripped-down USB host stack that includes only USB mass storage class support with the bare minimum code to run in an OS-less environment. USBHostLite provides a simple solution for accessing the files on USB mass storage devices such as USB Pen Drives, USB Hard Disk Drives, etc., connected to the USB Host port"
"Classes other than the mass storage are not supported"
ics.nxp.com/.../
Does keil have any reference code for configuring LPC2478 as a host for a cdc device and then sending it some data
You can view Keil products here: http://www.keil.com/product/
Contact Keil & their distributors: http://www.keil.com/company/contact/
It's always worth looking at what Keil include to go along with their development boards. The nearest for you would probably be the ones for the MCB2470. Typically, this information would be places at \Keil\ARM\Board\Keil\MCB2470.
I looks like they do not give a CDC example, just an HID.
Now we are using the reference code which is given in MCB2470\RL\USB\RTX\HID.
Can we modify this to configure our Micro controller LPC2478 as host and communicate with CDC Device using the function provided in rl.usb.h .
Thanks.
Can we make HID code into CDC compatible.
Not sure whether it would be best to modify the HID example or use it as a basis for understanding how to create a CDC example. You could look for a CDC example that Keil provide and see if you can adapt that.
Hi Niharika Jha,
For NXP LPCxxxx, there are several different USB functionalities.
The KEIL USBHID and USBMem examples are for USB device, not USB host.
Umm.. The OP requires much more experience on USB before starting his project..
> The USB Sniffer shows that the transfer of data between the PC and the Nanocontroller is a bulk transfer.
Software sniffer (and hardware bus analyzer) can't tell the type of transfer, bulk or interrupt. Just the endpoint descriptor indicates it clearly. Using hot-plug option of the sniffer, you'll see the descriptors of the target on the sniffer.
Confirm that the target device is really a CDC by its descriptors. It may be a USB-UART chip, like FTDI, SiLabs or Prolific.
Anyway, it's hard to implement unsupported class to the host stack on current Keil RL-USB. You'll start with USBHostLite.
Tsuneo
Yes, our device is USB-UART FTDI chip and we are using USBHostlite code. Is there an sample project similar to the kind we are attempting. Can somebody please send us the link to project.
How is USB UART different from CDC, Still we have to make MCU as HOST and other one as Device.
www.lmgtfy.com
Ah, FTDI, as I thought. The outline of the HostLite code is,
Host_Init(); // initialize the host controller and its stack Host_EnumDev(); // enumerate target device Host_CtrlSend(..); // send vendor transfer to set up baudrate, etc to the chip.
strcpy( TDBuffer, "ABCD"); // fill ASCII characters to the buffer Host_ProcessTD(..); // send it to the chip
> How is USB UART different from CDC
There are many differences, but just for your concern, The command, sent by Host_CtrlSend(), is different.
Refer to the Linux FTDI support on ftdi_sio.c for the SETUP data of this command. In this Linux code, usb_control_msg() sends the command in change_speed()
lxr.free-electrons.com/.../ftdi_sio.c
Thanks. This is really helpful. There is not sufficient information about arguments to be sent with Host_CtrlSend.
> There is not sufficient information about arguments to be sent with Host_CtrlSend.
I believe I gave enough information. Just your background is insufficient.
Linux (libusb) implementation of usb_control_msg() is here. lxr.free-electrons.com/.../message.c
Compare the arguments of usb_control_msg() with those of Host_CtrlSend() Most of them are common.
As the background, you should know that the arguments are the member of a Setup Packet of Control transfer.
The Setup Packet www.beyondlogic.org/.../usb6.shtml
That is, usb_control_msg() is the Linux version of Host_CtrlSend() With this fact in your mind, look in Linux change_speed() link on my previous post. The arguments of Host_CtrlSend() are there, with usb_control_msg().
This is the last hint of your puzzle ;-) If you wouldn't realize this hint, I recommend you to use FTDI Vinculum chip, which hides USB details from your firmware for connection to FTDI USB-UART.
www.ftdichip.com/.../VNC1L.htm www.ftdichip.com/.../DevelopmentModules.htm