capacitive shunt sensing
play

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


  1. Capacitive Shunt Sensing Game Controller System Software Design By: Marcin Lobrow Western Washington University 2010

  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

  3. Kernel Selection • Simple Time Slice Kernal • 10 ms Slice Period • Easy Design • Round Robin Scheduling • Equal Priority Among Task • 3 Tasks • 2 ISR

  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

  5. State Diagram TASK1 TASK3 IDLE STATE 3 STATE 1 TASK2 TASK1 UI BUTTON TASK SCAN CAPACITIVE TASK3 COMPLETE SENSORS COMPLETE TASK2 COMPLETE STATE 2 PERFORM ANGULAR CALCULATION

  6. Initialization • System Initialization • Initialize Capacitive Sensors • Initialize Dynamic Memory Allocation • Initialize USB • Set Initial State • Period • One Execution • Execution Time • Approx 10 ms

  7. Scan Capacitive Sensors Task Description: • Scans the 4 Capacitive Sensors • Places Raw Data into Memory • Period: 10ms (Periodic) • Execution Time: 1 ms (max)

  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)

  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)

  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)

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

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

  13. Overall Data Flow main.c DMA_START_ISR Modules USB Initialization DMA ScanCapSensor Module DMA_STOP_ISR TimeSlicer CalculateCapSensor Module Check Port UI Button Task Update LEDs

  14. ScanCapSensor Data Flow SensorTop SensorController.c main.c SensorBottom Ts =1ms TimeSlice(Task1) ScanCapSensors() StoreRawData() SensorLeft SensorRight

  15. CalculateCapSensor Data Flow SensorTopRaw SensorCalculation.c main.c SensorBottomRaw Ts =5ms TimeSlice(Task2) UpdateBaseline() CalculateCapSensors() UpdateDetla() SensorLeftRaw SensorRightRaw

  16. Dynamic Memory Allocation Data Flow Diagram DMA_START_ISR SensorTopDelta USB SensorBottomDelta DMA SensorLeftDelta DMA_STOP_ISR SensorRightDelta

  17. Questions? System Software Design By: Marcin Lobrow Western Washington University 2010

Recommend


More recommend