230 likes | 375 Views
EU CRAFT PROJECT 016357. New method of video transfer and control functions for training in computer classroom and for audiovisual applications. WP3: USB submodule. SCREENS – Tallin, 15 june 2006. USB module. HUB. ARM7. CONNECTOR To VIDEO BOARD. USB controller.
E N D
EU CRAFT PROJECT 016357 New method of video transfer and control functions for training in computer classroom and for audiovisual applications WP3: USB submodule SCREENS – Tallin, 15 june 2006
USB module HUB ARM7 CONNECTOR To VIDEO BOARD USB controller SCREENS – Tallin, 15 june 2006
USB module block diagram USB HOST PORT USB HUB Internal FLASH LPC221x ISP1161A USB DEVICE PORT UART0 UART1 + DIR FLAGS CONNECTOR To VIDEO BOARD to host to MOUSE to/from RS485 to/from AVR to KBD Debug UART SCREENS – Tallin, 15 june 2006
Software architecture USB device driver USB host driver USB hub USB host service thread USB device service thread Mode Supervisor & error management A B RS485 protocol thread C AVR flags D Packet queue RS-485 network for USB data SCREENS – Tallin, 15 june 2006
Operating modes MODE AVR CODE A B C D LOCKED 1 - - - - STANDALONE 0 Y Y - - REMOTE CONTROLLED 2 Y - - Y REMOTE CONTROLLER 3 - Y Y - USB host service thread USB device service thread A B RS485 protocol thread C D Packet queue SCREENS – Tallin, 15 june 2006
USB stack selection, 1 • Commercial options: • Express Logic • Jungo • RTCX Traditional stacks on the market focus on mass storage (host and device) and HID class (device only); host and device stack are often sold separately. Typical NRE fees range from 20k euros to 60k euros for the combined host & device stack; a minimum license quantity must be purchased in advance. Homegrown minimal USB stack that matches requirements starting from Philips libraries SCREENS – Tallin, 15 june 2006
USB stack selection, 2 • Philips semiconductors offers unsupported libraries dedicated to the ISP1161A for host and device control. • Available under NDA only, no fees associated • three sw models: host only, device only, simultaneous host and device • DOS version: does not assume presence of an underlying OS with USB libraries • bugs are present ISP1161x Simultaneous Host-and-Device Mode Software Model SCREENS – Tallin, 15 june 2006
Development tools selection, 1 • Several alternatives available: • Keil MDK-ARM: RealView Microcontroller Development Kit for the ARM • IAR Embedded Workbench • Rowley Associates Crossworks for ARM • Green Hills (too expensive) • And the winner was……… • Reasons: • Lowest cost • supports inexpensive JTAG probes • based on GNU tools • dedicated to ARM7 devices • good feeling during the 30-day evaluation period • Highlights: • CrossStudio Integrated IDE • integrated programming of internal FLASH (not available on all competitors) SCREENS – Tallin, 15 june 2006
Development tools selection, 2 SCREENS – Tallin, 15 june 2006
Development tools selection, 3 • Crossworks • Support packages for the following processors: • Atmel AT91SAM7 (ARM7 core) • Luminary Micro LM3Sxxx (ARM Cortex M3 core) • Philips LPC2xxx (ARM7 core) • ST Microelectronics STA2051, STR71x, STR31x (ARM7) • SHARP LH75401, LH79520, LH79524 • Several development boards are supported with specific code; among them: • Olimex LPC-E2214 (a superset of the LPC-H2214 we have been using) SCREENS – Tallin, 15 june 2006
Development tools selection, 4 Board used for getting more familiar with the microcontroller OLIMEX LPC-H2214 • Inexpensive • micro + SRAM + FLASH + serial ports (one of them via USB2serial converter) SCREENS – Tallin, 15 june 2006
Test environment, 1 PHASE A: analysis on host of USB transactions Using an open-source application for Windows, we have analyzed USB Messages between host controller and USB peripheral • USB Snoopy: USB trafficviewer • Works on a Windows machine • it translates all data sent and received by the original windows driver in • a more human readable form and writes this result in a big ascii file http://sourceforge.net/projects/usbsnoop/ Alternative: Bus Hound, commercial product from Perisoft: www.perisoft.com SCREENS – Tallin, 15 june 2006
Test environment, 2 PHASE A: analysis on host of USB transactions SCREENS – Tallin, 15 june 2006
Test environment, 3 ______________________________________________________________________________ 1 in down n/a 0.219 GET_DESCRIPTOR_FROM_DEVICE URB Header (length: 80) SequenceNumber: 1 Function: 000b (GET_DESCRIPTOR_FROM_DEVICE) ________________________________________________________________________________ 1in up n/a 0.235 CONTROL_TRANSFER12 01 10 01 00 00 00 080x00000000 URB Header (length: 80) SequenceNumber: 1 Function: 0008 (CONTROL_TRANSFER) PipeHandle: 82ff64a8 SetupPacket: 0000: 80 06 00 01 00 00 12 00 bmRequestType: 80 DIR: Device-To-Host TYPE: Standard RECIPIENT: Device bRequest: 06 GET_DESCRIPTOR Descriptor Type: 0x0001 DEVICE TransferBuffer: 0x00000012 (18) length 0000: 12 01 10 01 00 00 00 08 6d 04 0c c0 10 21 01 02 0010: 00 01 bLength : 0x12 (18) bDescriptorType : 0x01 (1) bcdUSB : 0x0110 (272) bDeviceClass : 0x00 (0) bDeviceSubClass : 0x00 (0) bDeviceProtocol : 0x00 (0) bMaxPacketSize0 : 0x08 (8) idVendor : 0x046d (1133) idProduct : 0xc00c (49164) bcdDevice : 0x2110 (8464) iManufacturer : 0x01 (1) iProduct : 0x02 (2) iSerialNumber : 0x00 (0) bNumConfigurations : 0x01 (1) Downstream (from host to device) Upstream (device reply) connecting a USB mouse Retrieval of device descriptor SCREENS – Tallin, 15 june 2006
Test environment, 4 ________________________________________________________________________________ 2 in down n/a 0.235 GET_DESCRIPTOR_FROM_DEVICE URB Header (length: 80) SequenceNumber: 2 Function: 000b (GET_DESCRIPTOR_FROM_DEVICE) ________________________________________________________________________________ 2 in up n/a 0.235 CONTROL_TRANSFER 09 02 22 00 01 01 00 a0 0x00000000 URB Header (length: 80) SequenceNumber: 2 Function: 0008 (CONTROL_TRANSFER) PipeHandle: 82ff64a8 SetupPacket: 0000: 80 06 00 02 00 00 09 00 bmRequestType: 80 DIR: Device-To-Host TYPE: Standard RECIPIENT: Device bRequest: 06 GET_DESCRIPTOR Descriptor Type: 0x0002 CONFIGURATION TransferBuffer: 0x00000009 (9) length 0000: 09 02 22 00 01 01 00 a0 32 bLength : 0x09 (9) bDescriptorType : 0x02 (2) wTotalLength : 0x0022 (34) bNumInterfaces : 0x01 (1) bConfigurationValue: 0x01 (1) iConfiguration : 0x00 (0) bmAttributes : 0xa0 (160) MaxPower : 0x32 (50) Downstream (from host to device) Upstream (device reply) connecting a USB mouse Retrieval of configuration descriptor SCREENS – Tallin, 15 june 2006
Test environment, 5 ________________________________________________________________________________ 5 out down n/a 0.281 CLASS_INTERFACE - URB Header (length: 80) SequenceNumber: 5 Function: 001b (CLASS_INTERFACE) PipeHandle: 00000000 SetupPacket: 0000: 22 0a 00 00 00 00 00 00 bmRequestType: 22 DIR: Host-To-Device TYPE: Class RECIPIENT: Endpoint bRequest: 0a No TransferBuffer ________________________________________________________________________________ 5 out up n/a 0.281 CONTROL_TRANSFER - 0x00000000 URB Header (length: 80) SequenceNumber: 5 Function: 0008 (CONTROL_TRANSFER) PipeHandle: 82ff64a8 SetupPacket: 0000: 21 0a 00 00 00 00 00 00 bmRequestType: 21 DIR: Host-To-Device TYPE: Class RECIPIENT: Interface bRequest: 0a No TransferBuffer connecting a USB mouse Retrieval of class type SCREENS – Tallin, 15 june 2006
Board under test, 1 SCREENS – Tallin, 15 june 2006
Board under test, 2 Serial-to-USB converter USB connector adapter (replicating USB connectors on Video Board) ARM7 JTAG emulator debug serial port SCREENS – Tallin, 15 june 2006
RS-485 protocol, 1 • Low-level protocol: binary, with 8-bit CRC and escape sequences (to avoid persistent out-of-sync situations) • General data packet: • <STX> <CMD> <LEN> <data>…<data> <CRC> <EOX> • where: • STX = Start of Packet • CMD = command (write, read) • LEN = number of data bytes, excluding CRC; it may be zero • CRC = CRC of all bytes from CMD to last data • EOX = End of Packet • STX, EOX: unique byte values • If the same must transmitted, it is substituted with a 2-byte sequence, as follows: • STX = 0x02, EOX = 0x04, ESC = 0x10 • Inserted data byte = value OR 0x80 (modified since last meeting) • Then: • 0x10 0x82 means a value of 0x02 • 0x10 0x84 means a value of 0x04 • 0x10 0x90 means a value of 0x10 SCREENS – Tallin, 15 june 2006
RS-485 protocol, 2 Internal debug tool for exercising the RS-485 protocol on standard RS-232 connection; protocol is decoded on-the-fly SCREENS – Tallin, 15 june 2006
RS-485 protocol, 3 STX CRC CMD data[0] LEN EOX SCREENS – Tallin, 15 june 2006
Current status • Hardware realization • PCB layout completed, prototype fabrication completed • fully RoHS compliant • power control of USB ports included • prototypes debugged and in use • Software development • RS-485 protocol completed • low-level driver for ISP1161A completed • minimal USB host stack completed • minimal USB device stack completed • debug, integration and fine tuning: in progress SCREENS – Tallin, 15 june 2006
THANK YOU SCREENS – Tallin, 15 june 2006