Capacitive Shunt Sensing Game Controller System Software Design - - PowerPoint PPT Presentation

capacitive shunt sensing
SMART_READER_LITE
LIVE PREVIEW

Capacitive Shunt Sensing Game Controller System Software Design - - PowerPoint PPT Presentation

Capacitive Shunt Sensing Game Controller System Software Design By: Marcin Lobrow Western Washington University 2010 General System Design MCU: CY8C3866AXI-040ES2 Bus frequency 24 MHz 64Kb Flash, 2Kb RAM System Memory


slide-1
SLIDE 1

Capacitive Shunt Sensing Game Controller

System Software Design By: Marcin Lobrow Western Washington University 2010

slide-2
SLIDE 2

General System Design

 MCU: CY8C3866AXI-040ES2

  • Bus frequency 24 MHz
  • 64Kb Flash, 2Kb RAM

 System Memory Requirements

  • 500 bytes Flash
  • 4Kb RAM

 Resources Used

  • 25 GPIO, USB D+, D- Pins
slide-3
SLIDE 3

Kernel Selection

  • Simple Time Slice Kernal
  • 10 ms Slice Period
  • Easy Design
  • Round Robin Scheduling
  • Equal Priority Among Task
  • 3 Tasks
  • 2 ISR
slide-4
SLIDE 4

Tasks & ISR

Tasks

1) Scan Capacitive Sensors Task 2) Angular Pitch Calculation Task 3) UI Button Task

Interrupt Service Routine (ISR)

1) Start DMA transfer of Memory to USB 2) Pause DMA transfer of Memory to USB

slide-5
SLIDE 5

State Diagram

STATE 3 UI BUTTON TASK IDLE STATE 1 SCAN CAPACITIVE SENSORS STATE 2 PERFORM ANGULAR CALCULATION

TASK1 TASK1 COMPLETE TASK2 TASK2 COMPLETE TASK3 TASK3 COMPLETE

slide-6
SLIDE 6

Initialization

  • System Initialization
  • Initialize Capacitive Sensors
  • Initialize Dynamic Memory Allocation
  • Initialize USB
  • Set Initial State
  • Period
  • One Execution
  • Execution Time
  • Approx 10 ms
slide-7
SLIDE 7

Scan Capacitive Sensors Task

Description:

  • Scans the 4 Capacitive Sensors
  • Places Raw Data into Memory
  • Period: 10ms (Periodic)
  • Execution Time: 1 ms (max)
slide-8
SLIDE 8

Angular Pitch Calculation Task

Description:

  • Calculates Angle of Users Hand
  • Calculates Constant Baseline For Signal
  • Calculates Change above Baseline Signal
  • Stores Delta in Memory
  • If Delta, Set DMA ISR
  • Drives LED Array
  • Period: 10 ms (Periodic)
  • Execution Time: 5ms (max)
slide-9
SLIDE 9

UI Button Task

Description:

  • Scans ports for User Button Presses
  • Starts USB Communications with Start Button
  • Ends USB Communications with End Button
  • Sets ISR with Pause Button
  • Period: 100 ms (Periodic)
  • Execution Time: 1us (max)
slide-10
SLIDE 10

Interrupt Service Routines

Description:

  • DMA_START_ISR
  • Starts DMA Data Transfer to USB
  • Triggered by Movement of Hand Above Sensors
  • DMA_STOP_ISR
  • Stops (Pauses) DMA Data Transfer to USB
  • Triggered Pause UI Button
  • Period: 20ms (min) (Sporadic)
  • Execution time: 100 us (max)
slide-11
SLIDE 11

CPU load

L max = (1ms) + (5ms) + (1us) + (200us) (10ms) (10ms) (100ms) (20ms) L max = 60.1% L average = < 50.0 %

slide-12
SLIDE 12

Modules

Module Tasks & ISR Public Functions and Data main.c InitializeGC() WaitForSlice() UITask() CapSense_Start() CapSense_Stop() ScanPort() DriveLEDs() SensorController.c ScanCapSensors() DMA_Start_ISR() DMA_Stop_ISR() CapSense_CSD_ScanSlot() CapSense_CSD_ReadSlot() SensorCalculation.c CalculateCapSensors() CalculateBaseline() CalculateDelta()

slide-13
SLIDE 13

Overall Data Flow

TimeSlicer

Initialization

ScanCapSensor Module

USB Modules

CalculateCapSensor Module

UI Button Task main.c Check Port Update LEDs DMA_START_ISR DMA_STOP_ISR DMA

slide-14
SLIDE 14

ScanCapSensor Data Flow

main.c

SensorTop TimeSlice(Task1) Ts =1ms

SensorController.c

ScanCapSensors() SensorRight SensorBottom SensorLeft StoreRawData()

slide-15
SLIDE 15

CalculateCapSensor Data Flow

main.c

SensorTopRaw TimeSlice(Task2) Ts =5ms

SensorCalculation.c

CalculateCapSensors() SensorRightRaw SensorBottomRaw SensorLeftRaw UpdateBaseline() UpdateDetla()

slide-16
SLIDE 16

Dynamic Memory Allocation Data Flow Diagram

USB DMA_START_ISR DMA_STOP_ISR DMA SensorRightDelta SensorLeftDelta SensorTopDelta SensorBottomDelta

slide-17
SLIDE 17

Questions?

System Software Design By: Marcin Lobrow Western Washington University 2010