frc fpga architecture

77
FRC FPGA Architecture Kickoff 2009

Upload: hollie

Post on 25-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

FRC FPGA Architecture. Kickoff 2009. Agenda. FRC Robot Controller Architecture FPGA Features and Use Cases Break WPILib for LabVIEW Break WPILib for C / C++. cRIO Architecture. NI 9201 Architecture 8 Channel Analog Input Module. NI 9201. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: FRC FPGA Architecture

FRC FPGA Architecture

Kickoff 2009

Page 2: FRC FPGA Architecture

Agenda

• FRC Robot Controller Architecture• FPGA Features and Use Cases• Break• WPILib for LabVIEW• Break• WPILib for C / C++

Page 3: FRC FPGA Architecture

cRIO Architecture

Page 4: FRC FPGA Architecture

NI 9201 Architecture8 Channel Analog Input Module

NI 9201

Page 5: FRC FPGA Architecture

NI 9403 Architecture 32-Channel Bidirectional Digital I/O Module

NI 9403

Digital Breakout

Page 6: FRC FPGA Architecture

NI 9472 Architecture

NI 9472

Page 7: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 8: FRC FPGA Architecture

Analog InputUse Case

• Angle of a Potentiometer• Distance of a Maxbotics Ultrasonic Sensor• Acceleration of an Accelerometer Axis• Any other Very Low Frequency Analog Signal

Page 9: FRC FPGA Architecture

Analog Input

• 12-bit ADC with +/-10V Range• Access Factory Calibration• Variable-Length Scan List– 8 maximum– Repeat entries allowed

• Scan Rate– Per module basis (one ADC)– 2us per Conversion Minimum

i.e. 500kS/s with single entry scan list

Page 10: FRC FPGA Architecture

Analog Input Sources

• Raw Samples– 16-bit– Updated After Each Conversion

• Oversample / Average Engine Output– 32-bit

• Windowed Register Access– Most recent sample

Page 11: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 12: FRC FPGA Architecture

Oversample / Average Engine (OAE)Use Case

• Oversample– Higher Resolution Samples– Lower Sample Rate

• Average– Same Resolution Samples– Lower Sample Rate– More Stable Sample Values

Page 13: FRC FPGA Architecture

Oversample / Average Engine (OAE)

• Specified in bits– B bits: 2B == N Samples– 15 bits Each Maximum

• Oversample– Sums NO samples

• Average– Sums NA samples

– Divide by NA

• Output changes after NO x NA Samples

Page 14: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 15: FRC FPGA Architecture

Accumulator Use case

• Hardware Numerical Integration• Gyro– Integrate: Angular Rate Angle

Page 16: FRC FPGA Architecture

Accumulator

• 64-bit Value / 32-bit Count• 2 available– Hardwired to Slot 1, AI 1 and AI 2 OAE Output

• Center Value• Deadband• Value Reset to Zero

Page 17: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 18: FRC FPGA Architecture

Analog Trigger Use case

• Reflective Sensor Encoder• Interrupt at Pot Value• Sin-Cos Signal to Quadrature• Variable Reluctance Sensor• Any Analog Signal to Digital

Page 19: FRC FPGA Architecture

Analog Trigger

• Trigger Events From Analog Signal• Specify Upper and Lower Limit• Source Raw or OAE• Trigger State– High when Above Upper Limit– Low when Below Lower Limit– Unchanged when Between Limits (Hysteresis)

• In Window– Voltage between Upper and Lower Limit

Page 20: FRC FPGA Architecture

Analog Trigger

Page 21: FRC FPGA Architecture

Analog Trigger – Hysteresis

Page 22: FRC FPGA Architecture

Analog Trigger – Hysteresis (Too Noisy)

Page 23: FRC FPGA Architecture

Analog Trigger - Rollover DetectionUse case

• Count Rollovers (Rotations)– Continuous-Turn Potentiometers– Magnetic Absolute Encoder– Any Signal that Rolls Over

Page 24: FRC FPGA Architecture

Analog Trigger - Rollover Detection

• Jump Over Window• Floating– Large Change in Value

• Average-Rejection Filter– 3 Point Filter

• Pulse Output– Rising and Falling Pulses– Cannot Read via Register; Routable Only

Page 25: FRC FPGA Architecture

Analog Trigger – Rollover Detection Rising Trigger

Page 26: FRC FPGA Architecture

Analog Trigger – Rollover Detection Rising Trigger, Low-Pass Filtered

Page 27: FRC FPGA Architecture

Average Rejection Filter Use case

• Averaging Inherent in Sampling Process• Perform More Averaging After Sampling– Changes the Effective Sample Rate– Increases the Effect of the Filter

• Balance Effective Sample Rate– Too Fast, the Filter Has Too Little Effect– Too Slow, Trigger False Positives• True Slope Needs at least One Sample In Window

Page 28: FRC FPGA Architecture

Average Rejection Filter

Page 29: FRC FPGA Architecture

Analog Trigger – Rollover Detection Rising Trigger, Average Rejection

Page 30: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 31: FRC FPGA Architecture

Digital Input / OutputUse case

• Digital Input– Limit Switches

• Digital Output– Jaguar Coast / Brake Control

• Pulse Generator– Ping Signal for Ultrasonic Sensors

Page 32: FRC FPGA Architecture

Digital Input / Output

• 6.525us Per Sample• Output Enable (Change)– 17us Delay for I/O on Both NI 9403 Modules

• Output Latch Configurable Before OE• Output Pulse Generator– Invert Bits For Some Time Then Reset– 1.6ms Maximum

Page 33: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 34: FRC FPGA Architecture

Slow Digital OutputUse case

• Spike Relay Control• Robot Signal Light– Controlled by Network Status Code– Not Available

• 4 Outputs on I2C Header– Any Custom Circuits that need More Outputs

Page 35: FRC FPGA Architecture

Slow Digital Output

• SPI Output to Sidecar Shift Registers• 320us Per Update• Spike Relay Control– Gated by Watchdog

• Robot Signal Light• 4 Outputs on I2C Header

Page 36: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 37: FRC FPGA Architecture

Hobby PWM OutputUse case

• Jaguar Motor Controller– 1x Period Multiplier– 5ms Update

• Victor Motor Controller– 2x Period Multiplier– 10ms Update

• Hobby Servo– 4x Period Multiplier– 20ms Update

Page 38: FRC FPGA Architecture

Hobby PWM Output

• 8-bit Generator• 0 == Disable Output• 1 == 0.65ms High• 128 == 1.5ms High• 255 == 2.35ms High

• Period Multiplier– 1x, 2x, or 4x

• Gated by Watchdog

Page 39: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 40: FRC FPGA Architecture

I2C BusUse case

• Hitechnic NXT Compatible Sensors– Compass– 3 Axis Accelerometer– Gyro (No Hardware Integration)

• Devantech Sensors– SRF08 Ultrasonic Range Finder– Compass

• Any Other I2C Compliant Sensors

Page 41: FRC FPGA Architecture

I2C Bus

• Address / Register / Data Transaction Format• Independent Bus Per Module• 7-Bit Addresses Only• Write 1 Byte Per Transaction• Read 1, 2, 3, or 4 Bytes Per Transaction• Clock Skewing Only On Read Between Data Bytes• Slave Acknowledge Ignored• Interrupt on Done

Page 42: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 43: FRC FPGA Architecture

Digital Input FilteringUse case

• Debounce Buttons• Synchronize Digital Input Signals• Filter Out High Frequency Noise

Page 44: FRC FPGA Architecture

Digital Input Filtering

• 3 Filters Per Module• Filter Assigned Per Channel• Correlation Between Channels– Updates at End of Correlation Period– Unchanged if Input Changed During Period

• All Routed Digital Inputs Can Be Filtered

Page 45: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 46: FRC FPGA Architecture

Solenoid OutputUse case

• Control Pneumatic Solenoids• Less Space Than 4 Spikes

Page 47: FRC FPGA Architecture

Solenoid Output

• Pass-through• Gated by Watchdog

Page 48: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 49: FRC FPGA Architecture

WatchdogUse case

• Ensure That Critical Code Keeps Running• Added Safety if Used Correctly• Not Mandatory; Strongly Recommended• Disable to Keep Motors Running At Breakpoint

Page 50: FRC FPGA Architecture

Watchdog

• Disables Actuator Outputs• Configurable Timeout• Feed To Keep Alive• Manual Kill– Disable Outputs Now

• Immortal Mode– Timeout and Manual Kill Ignored– Outputs Enabled

Page 51: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 52: FRC FPGA Architecture

Counter / Timer

• 2 Types of Counters– Dedicated 4x Quadrature Decoders• 4 Available

– General Purpose Counters• 8 Available

• Signed 31-bit Value• Most Recent Direction• Timer On Each Counter Output

Page 53: FRC FPGA Architecture

Counter / Timer (cont)

• Routable Input Sources– Digital Input Filter– Analog Trigger

• Disable (Ignore Inputs)• Software Reset Value to Zero• External Reset Value to Zero

Routable Input

Page 54: FRC FPGA Architecture

Dedicated 4x Quadrature Decoder Use case

• Highest Resolution• Dedicated Hardware• Absolute Angle– External Reset as Index Input

Page 55: FRC FPGA Architecture

Dedicated 4x Quadrature Decoder

• A and B ChannelRoutable Inputs

• Count for Each Transition of A or B Signal4x More Precise

Page 56: FRC FPGA Architecture

1x, 2x Quadrature Decoding CounterUse case

• Used Up All 4x Decoding Counters• Less Resolution Needed• More Averaging of Encoder Speed– Fewer Timer Events Per Rotation

Page 57: FRC FPGA Architecture

Up / Down CounterUse case

• Count Full Rotations of Rollover Sensors– Route Analog Trigger Rising and Falling Pulses

• Simple Counter– Disable the “Count Down” Channel

Page 58: FRC FPGA Architecture

External Direction CounterUse case

• BaneBots Encoder Divider Kit• Other Encoder Types

Page 59: FRC FPGA Architecture

General Purpose Counter

• Counting Modes– 1x or 2x Quadrature Decoding• “A” and “B” Inputs

– Up / Down Counter• “Count Up” and “Count Down” Inputs

– External Direction• “Count” and “Direction” Inputs

• Rising, Falling, or Both Edge Sensitivity

Page 60: FRC FPGA Architecture

Semi-Period TimerUse case

• Echo Signal from Ultrasonic Range Sensor• Duty-Cycle Measurement– If Period is Fixed, Measure High or Low Pulse– If Not, Hard to Get Consistent Sample

Page 61: FRC FPGA Architecture

Pulse-Length Direction CounterUse case

• Allegro ATS651 Gear Tooth Sensor– Direction Information Encoded in Pulse Length– Provided in Kit in 2005• Black PCB• RevNC

Page 62: FRC FPGA Architecture

General Purpose Counter (cont)

• Special Modes– Semi-Period• Primary Output is Timer• Odd Counter Value Means Measurement In Progress• Select High or Low Semi-Period• Single Input Channel

– Pulse-Length Direction• Direction to Count Determined From Pulse-Length• Select Pulse-Length Threshold• Single Input Channel

Page 63: FRC FPGA Architecture

TimerUse case

• Measure Speed• Detect Motor Stall• Time Events

Page 64: FRC FPGA Architecture

Timer

• Time Between Counter Events– Event == Value Change

• Stall Detection• Sample Averaging– Sliding Window– Up to 128 Samples

Page 65: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 66: FRC FPGA Architecture

SPI EngineUse case

• Interface Custom Circuits• Some Sensors

Page 67: FRC FPGA Architecture

SPI Engine• Serial Peripheral Interface / Synchronous Serial• Input and Output FIFOs

– 512 Words Each• Highly Configurable

– Chip Select / Pre- or Post-Latch– Clock Polarity– Word Size (1-bit to 32-bit)– MSb or LSb First

• Streaming Interrupts– Receive Buffer

• Not Empty; Half Full– Transmit Buffer

• Half Empty; Empty and Idle

Page 68: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 69: FRC FPGA Architecture

Time / AlarmUse case

• Time– Consistent us Value Across Subsystems– Fast, Precise Benchmark Source

• Alarm– Interrupt Based Task Scheduling (for C++)

Page 70: FRC FPGA Architecture

Time / Alarm

• Time– 1us Resolution– 32-bit range (71.5 Minutes)

• Alarm– Schedule for a Specific Time– Generate an Interrupt– Interrupt Immediately if Scheduled Time In Past

Page 71: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 72: FRC FPGA Architecture

Routable InterruptUse case

• Interrupt on Button• Timestamp An Event• Some Crazy Interface We Didn’t Foresee• If All Else Fails

Page 73: FRC FPGA Architecture

Routable Interrupt

• Input Sources Routable– Digital Input Filter– Analog Trigger

• Latch Timestamp• Wait for Acknowledge– Timestamp Will Not Change Until Acknowledge– Can be Disabled

Page 74: FRC FPGA Architecture

FRC FPGA Subsystems

• Analog Input• Oversample / Average• Accumulator• Analog Trigger• Digital Input / Output• Slow Digital Output• Hobby PWM Output• I2C Bus

• Digital Input Filtering• Solenoid Output• Watchdog• Counter / Timer• SPI Engine• Time / Alarm• Routable Interrupt• Direct Memory Access

Page 75: FRC FPGA Architecture

Direct Memory Access (DMA)Use case

• Data Streaming– FIR Filtering– Fourier Transform (Frequency Content)

• Snapshot of Sensor On Event– Position Observer

Page 76: FRC FPGA Architecture

Direct Memory Access (DMA)

• Stream Data Directly to PPC Memory• Sample Clock– Correlated Samples of Unrelated Data– Internally timed

• FPGA Clock Domain– Externally timed

• Routable Input

• Configurable Data Sources• Sample Includes Timestamp• Overrun Indication

Page 77: FRC FPGA Architecture

Questions?