1 new method of video transfer and control functions for training in computer classroom and for...
TRANSCRIPT
1
New method of video transfer and control functionsfor training in computer classroom and
for audiovisual applications
WP3: USB submodule
SCREENS – Tallin, 15 june 2006
EU CRAFT PROJECT 016357
3SCREENS – Tallin, 15 june 2006
LPC221x
Internal FLASH
Debug UART
UART0
ISP1161A
USB HUB
UART1+ DIR
FLAGS
USB HOST PORT
USB DEVICE
PORT
CONNECTORTo VIDEO BOARDto/from
RS485to/from
AVRto
hostto
KBDto
MOUSE
USB module block diagram
4SCREENS – Tallin, 15 june 2006
Software architecture
USB device service thread
USB device driver
USB host service thread
USB host driver
RS485protocolthread
Mode Supervisor & error management
AVR flags
USB hub
RS-485 network for USB data
AB
C
DPacket queue
5SCREENS – Tallin, 15 june 2006
Operating modes
MODE AVRCODE A B C D
LOCKED1 - - - -
STANDALONE0 Y Y - -
REMOTE CONTROLLED2 Y - - Y
REMOTE CONTROLLER3 - Y Y -
USB device service thread
USB host service thread
RS485protocolthread
AB
C
DPacket queue
6SCREENS – Tallin, 15 june 2006
USB stack selection, 1Commercial 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
7SCREENS – Tallin, 15 june 2006
USB stack selection, 2Philips 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
8SCREENS – Tallin, 15 june 2006
Development tools selection, 1Several 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)
10SCREENS – 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)
11SCREENS – Tallin, 15 june 2006
Development tools selection, 4Board used for getting more familiar with the microcontroller
OLIMEX LPC-H2214
• Inexpensive• micro + SRAM + FLASH + serial ports (one of them via USB2serial converter)
12SCREENS – 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 traffic viewer
• 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
Alternative: Bus Hound, commercial product from Perisoft: www.perisoft.com
http://sourceforge.net/projects/usbsnoop/
14SCREENS – Tallin, 15 june 2006
Test environment, 3______________________________________________________________________________1 in down n/a 0.219 GET_DESCRIPTOR_FROM_DEVICEURB Header (length: 80)SequenceNumber: 1Function: 000b (GET_DESCRIPTOR_FROM_DEVICE)
________________________________________________________________________________1 in up n/a 0.235 CONTROL_TRANSFER 12 01 10 01 00 00 00 08 0x00000000URB Header (length: 80)SequenceNumber: 1Function: 0008 (CONTROL_TRANSFER)PipeHandle: 82ff64a8
SetupPacket:0000: 80 06 00 01 00 00 12 00 bmRequestType: 80 DIR: Device-To-Host TYPE: Standard RECIPIENT: DevicebRequest: 06 GET_DESCRIPTORDescriptor Type: 0x0001 DEVICE
TransferBuffer: 0x00000012 (18) length0000: 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)
connecting a USB mouse
Retrieval of device descriptor
Downstream (from host to device)
Upstream (device reply)
15SCREENS – Tallin, 15 june 2006
Test environment, 4________________________________________________________________________________2 in down n/a 0.235 GET_DESCRIPTOR_FROM_DEVICEURB Header (length: 80)SequenceNumber: 2Function: 000b (GET_DESCRIPTOR_FROM_DEVICE)
________________________________________________________________________________2 in up n/a 0.235 CONTROL_TRANSFER 09 02 22 00 01 01 00 a0 0x00000000URB Header (length: 80)SequenceNumber: 2Function: 0008 (CONTROL_TRANSFER)PipeHandle: 82ff64a8
SetupPacket:0000: 80 06 00 02 00 00 09 00 bmRequestType: 80 DIR: Device-To-Host TYPE: Standard RECIPIENT: DevicebRequest: 06 GET_DESCRIPTORDescriptor Type: 0x0002 CONFIGURATION
TransferBuffer: 0x00000009 (9) length0000: 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)
connecting a USB mouse
Retrieval of configuration descriptor
Downstream (from host to device)
Upstream (device reply)
16SCREENS – Tallin, 15 june 2006
Test environment, 5________________________________________________________________________________5 out down n/a 0.281 CLASS_INTERFACE -URB Header (length: 80)SequenceNumber: 5Function: 001b (CLASS_INTERFACE)PipeHandle: 00000000
SetupPacket:0000: 22 0a 00 00 00 00 00 00 bmRequestType: 22 DIR: Host-To-Device TYPE: Class RECIPIENT: EndpointbRequest: 0a
No TransferBuffer
________________________________________________________________________________5 out up n/a 0.281 CONTROL_TRANSFER - 0x00000000URB Header (length: 80)SequenceNumber: 5Function: 0008 (CONTROL_TRANSFER)PipeHandle: 82ff64a8
SetupPacket:0000: 21 0a 00 00 00 00 00 00 bmRequestType: 21 DIR: Host-To-Device TYPE: Class RECIPIENT: InterfacebRequest: 0a
No TransferBuffer
connecting a USB mouse
Retrieval of class type
18
Board under test, 2
SCREENS – Tallin, 15 june 2006
Serial-to-USB
converter
ARM7JTAG
emulator
debugserial port
USB connector adapter(replicating USB
connectors on Video Board)
19SCREENS – 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 PacketCMD = command (write, read)LEN = number of data bytes, excluding CRC; it may be zero CRC = CRC of all bytes from CMD to last dataEOX = End of Packet
STX, EOX: unique byte valuesIf the same must transmitted, it is substituted with a 2-byte sequence, as follows:STX = 0x02, EOX = 0x04, ESC = 0x10Inserted data byte = value OR 0x80 (modified since last meeting)
Then:0x10 0x82 means a value of 0x020x10 0x84 means a value of 0x040x10 0x90 means a value of 0x10
20SCREENS – 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
22SCREENS – 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