170 likes | 322 Views
System Software Design Colin Gatlin May 12, 2009 Western Washington University. PC Universal Remote Receiver. Supported Protocols. RC5 (Phillips) RC6 Mode 0/6 (Phillips) NEC (Japan) SIRCS 12/15/20 (Sony/PS2) NRC17 (Nokia) REC-80 (Panasonic) RECS-80 normal/extended (Phillips) JVC
E N D
System Software Design Colin Gatlin May 12, 2009 Western Washington University PC Universal Remote Receiver
Supported Protocols • RC5 (Phillips) • RC6 Mode 0/6 (Phillips) • NEC (Japan) • SIRCS 12/15/20 (Sony/PS2) • NRC17 (Nokia) • REC-80 (Panasonic) • RECS-80 normal/extended (Phillips) • JVC • Sharp • RCA (XBOX)
General Protocol Features • Encoding • Manchester • Pulse Distance • Pulse Width • Carrier frequency • Number of information bits • Packet length/width • Maximum and minimum high and low pulse duration • Start and end signals
Determining The Protocol • Number of pulses • Packet length • Maximum zero duration within bit stream
General Device Requirements • Processor: • Cypress PSoC CY8C24894 • Clock Frequency: • 24MHz • Memory Requirements: • ROM: 6kB (2.5kB API + 3.5kB Project Code) • RAM: 300B (45B API + 120B Buffer + 135B Code) • PSoC Block Requirements: • 2 Digital Blocks • 1 Analog Continuous Time Block
Kernel • Cooperative Timeslice Kernel • Shortest IR pulse: • 158μs • Timeslice Period: • 100μs • 3 main operations: • Store IR bit stream • Decode bit stream • USB communication
TimeSlicer() • Requires an 8-bit Timer (1 digital block) to generate an interrupt every 100μs. • TimeSlicer() polls a variable, blocking until the variable is non-zero. • Execution Time: • <1μs • Execution Period: • 100μs (Periodic) • CPU Load: • 1%
StoreIR() • Requires a comparator (1 analog continuous time block). Comparator output connected through an inverter to the Enable of an 8-bit Counter (1 digital block). • Stores the appropriate bit in the next position of the buffer. • Counts pulses and maximum consecutive zero reads. • Determines the end of an IR signal and initiates the decode process.
StoreIR() - continued • Execution time (max): 15μs • Execution period: 100μs (Periodic) • CPU Load: 15%
DecodeIR() • Determines the IR protocol from specific features of the stored bit stream. • Number of pulses • Packet length • Maximum consecutive zero reads • Decodes the bit stream accordingly. • Execution time (max): 40μs • Execution period (min): 30ms (Sporadic) • CPU Load: • 0.133%
USB • 4 Transfer Types • Control • Bulk • Interrupt • Isochronous • Only host can initiate a transfer
USBComm() • Uses Cypress API to communicate to a host USB device. • Uses IN interrupt transfers to send the decoded data to the host. • Execution time (max): 60μs • Execution period (min): 30ms (Sporadic) • CPU Load: • 0.2%
CPU Load • DecodeIR() and USBComm() always run on adjacent slices. • Max execution time per slice: • 1μs + 15μs + 60μs = 76μs • Max CPU Load: • 1% + 15% + 0.133% + 0.2% = 16.33%
Requesting A USB Transfer • PC application uses Windows API • User-mode custom driver sends IRP to kernel-mode USB host driver • Host initializes the transfer on the bus • Response returned, either new data or no data