You CAN Do Digital Filtering with an MCU!

48 453 0
You CAN Do Digital Filtering with an MCU!

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. You CAN Do Digital Filtering with an MCU! © 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas Technology & Solution Portfolio © 2012 Renesas Electronics America Inc. All rights reserved.3 Microcontroller and Microprocessor Line-up Wide Format LCDs  Industrial & Automotive, 130nm  350µA/MHz, 1µA standby 44 DMIPS, True Low Power Embedded Security, ASSP 165 DMIPS, FPU, DSC 1200 DMIPS, Performance 1200 DMIPS, Superscalar 500 DMIPS, Low Power 165 DMIPS, FPU, DSC 25 DMIPS, Low Power 10 DMIPS, Capacitive Touch  Industrial & Automotive, 150nm  190µA/MHz, 0.3µA standby  Industrial, 90nm  200µA/MHz, 1.6µA deep standby  Automotive & Industrial, 90nm  600µA/MHz, 1.5µA standby  Automotive & Industrial, 65nm  600µA/MHz, 1.5µA standby  Automotive, 40nm  500µA/MHz, 35µA deep standby  Industrial, 40nm  200µA/MHz, 0.3µA deep standby  Industrial, 90nm  1mA/MHz, 100µA standby  Industrial & Automotive, 130nm  144µA/MHz, 0.2µA standby 2010 2012 32-bit8/16-bit © 2012 Renesas Electronics America Inc. All rights reserved.4  Challenge: “More and More Sensors are required by our “Smart” devices and reliable filtering is required to separate the signal from the noise.”  Solution: “This lecture will introduce you to some of the basic concepts of Digital Filtering, low-cost Filter tools and help you avoid some of the more common pitfalls when implementing filters on the Renesas processor of their choice.” ‘Enabling The Smart Society’ Wireless Module Doctor, your patient is in distress Inphase Filter Frequency Response Frequency in kHz Magnitude in dB 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 22.5 -100 -80 -60 -40 -20 0 20 © 2012 Renesas Electronics America Inc. All rights reserved.5 Agenda  System Block Diagram – analog filter  FIR vs IIR  Sampling theorem  Anti-aliasing  Oversampling  Triggering skew  ADC interrupt overhead  Decimation  Fixed point and floating point principles  Fixed point vs. floating point benchmark  Summary © 2012 Renesas Electronics America Inc. All rights reserved.6 Example Filter Applications Sensor 60 Hz Filter MCU ADC Instrument Board Cabling 4 kHz LowPass MCU ADC Voice Recorder Microphone © 2012 Renesas Electronics America Inc. All rights reserved.7 Filter Applications – The Boxcar Filter  Very common to perform a “running” average  Sum n samples, scale the output (usually divide by n)  Recalculate each time one new sample comes in  Very simple FIR called boxcar  All coefficients equal to 1  Example of 8 kHz sampling rate, 8 tap FIR © 2012 Renesas Electronics America Inc. All rights reserved.8 Filter Types - FIR X [n] Z -1 b 0 + b 1 Z -1 + b 2 Z -1 + b 3 Z -1 + b M X [n-N] X [n-1] X [n-2] Y [n] nD Y” [n]  Typically the gain = 1  Does not always have Decimation  Decimation can be on front or back end X[n] – Input samples nD – Decimation Factor Y”[n] – Decimated Output B[n] – Coefficients (multiplies) Z -1 – Delay elements (storage array) © 2012 Renesas Electronics America Inc. All rights reserved.9 Filter Types - IIR  In addition to a forward path there is a feedback path Z -1 Z -1 + X [n] b k 1 b k 2 b k 0 + + Y k [n] Z -1 -a k 2 + Z -1 -a k 1 X[n] – Input samples Y k [n] – Output b k [n] – Feed forward Coefficients (multiplies) -a k [n] – Feedback Coefficients (multiplies) Z -1 – Delay elements (storage array) © 2012 Renesas Electronics America Inc. All rights reserved.10 FIR versus IIR*  FIR  Phase-linear  Simple instructions, single loop  Suited for Multi-rate (decimation or interpolation allows some calculations to be omitted)  Desirable Numeric properties (finite-precision can usually be implemented using lower number of bits)  Possible to implement with coefficients less then 1.0  May require more memory and calculations than the IIR  Some responses are just impractical to implement in FIR  IIR  Less memory and calculations for a given filtering characteristic  Arithmetic errors compounded by feedback  Harder to implement using fixed point  Not as easy to do multi-rate (decimation and interpolation)  Not phase-linear * http://www.dspguru.com/dsp/faqs/fir/basics and http://www.dspguru.com/dsp/faqs/iir [...]... Filter  Use an MCU with an FPU  RH850 – 32 Bit RISC High Performance RISC  RX600 – High Performance CISC  SH2A like SH7269 – High Performance RISC  Use Floating Point Libraries  Can be very slow  Use Fixed Point Math  A little more complicated than floating point 28 © 2012 Renesas Electronics America Inc All rights reserved Floating Point Numbers 31 30 S 23 22 0 Exponent 8 bits Significand part... Oversampling and digital filtering  Decimate results  Store every 4th sample  Only calculate filter at 8 kHz Sampling at 32 kHz rate Signal to Sample S1 S2 S3 S4 S5 S6 Data Point1 = X1*S1+X2*S2… +X8*S8 Data Point2 = X1*S5+X2*S6… +X*S12 X1,X2… are filter coefficients 21 © 2012 Renesas Electronics America Inc All rights reserved S7 S8 S9 S10 S11 S12 Multi-rate and Decimation  Temp cannot change more than 1... stated: A signal can only be properly sampled if it contains no frequencies greater than one-half the sampling frequency Sometimes this is incorrectly stated: To not lose information you must sample at twice the highest frequency you are concerned with in a signal 14 © 2012 Renesas Electronics America Inc All rights reserved Aliasing Problem  Record voice data and store  Limit voice bandwidth to 4... acquire/transfer data to buffer saves*  ~3% at 200kHz rate / 5K samples  ~13% at 400kHz rate / 5K samples  ~26% at 500kHz rate / 5K samples * DevCon RX Performance lab 25 © 2012 Renesas Electronics America Inc All rights reserved Calculating the Filter  Design 4 kHz, 8 tap , lowpass filter      Sampling rate 32 kHz Passband 4 kHz Stopband 8 kHz Stopband attenuation 12 dB – actual 20 dB Passband... controller  4-5 cycles or less per transfer  CPU BW to store data . Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. You CAN Do Digital Filtering with an MCU! © 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas Technology. information you must sample at twice the highest frequency you are concerned with in a signal Simply stated: A signal can only be properly sampled if it contains no frequencies greater than one-half. (finite-precision can usually be implemented using lower number of bits)  Possible to implement with coefficients less then 1.0  May require more memory and calculations than the IIR  Some

Ngày đăng: 22/06/2015, 14:17

Từ khóa liên quan

Mục lục

  • You CAN Do Digital Filtering with an MCU!

  • Renesas Technology & Solution Portfolio

  • Microcontroller and Microprocessor Line-up

  • ‘Enabling The Smart Society’

  • Agenda

  • Example Filter Applications

  • Filter Applications – The Boxcar Filter

  • Filter Types - FIR

  • Filter Types - IIR

  • FIR versus IIR*

  • Designing the Filter

  • Identifying the Noise

  • Identifying the Noise

  • Sampling Theorem

  • Aliasing Problem

  • Anti-aliasing filter

  • Anti-aliasing filter

  • Frequency Response of 8 Tap 4 kHz Filter

  • Improved 4 kHz Filter

  • Oversampling and digital filtering

Tài liệu cùng người dùng

Tài liệu liên quan