Home

Real-Time FIR Filter with TC1775

image

Contents

1.
2. 80 t t t t t t t 1 0 0 0 5 1 0 1 5 2 0 2 5 3 0 3 5 4 0 4 5 5 0 Frequency in kHz Figure 24 Inphase Filter Frequency Response of High pass Coefficients H 0 H 31 0 009804315383 0 010385248537 0 042259644377 0 049506892894 0 011013822528 0 027985710422 0 011772500212 0 033008029138 0 025074365462 0 036986648178 0 047669829299 0 040627538214 0 095908116969 0 043102799652 0 314852599728 0 456128215779 0 314852599728 0 043102799652 0 095908116969 0 040627538214 0 047669829299 0 036986648178 0 025074365462 0 033008029138 0 011772500212 0 027985710422 0 011013822528 0 049506892894 0 042259644377 0 010385248537 0 009804315383 0 Application Note 29 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 8 3 3 Band pass Filter order 32 Band pass center 2 5 kHz Pass band bandwidth at top 1 kHz Pass band bandwidth at bottom 1 8 kHz Pass band ripple 3 dB target 3 dB reached Stop band attenuation 40 dB target 40 1 dB reached Inphase Filter Frequency Response RealFirBand 20 j ON y f 80 Magnitude in dB 100 120 t t t t 1 0 0 0 5 1 0 1 5 2 0 2 5 3 0 3 5 4 0 4 5 5 0 Frequency in kHz Figure 25 Inphase Filter Frequency Response of Band pass Coefficients H 0 H 31 0 007724050458 0 013007745983 0 020557085731 0 021066
3. a Figure 18 Digitised 500 Hz Signal monitored with an Array A second array can be used to evaluate the data coming from the FIR filter 6 58 100 158 200 1 1 1 1 4000 3580 2588 1588 1008 588 Figure 19 Data coming from FIR Filter Low Pass In the graph it can be seen that a FIR filter needs some time to get the right output This time corresponds to the filter order Application Note 22 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 Another possibility is of course to measure the input and output signals with an oscilloscope So the overall system can be tested including the phase delay of the analog low pass filters Channel 1 PNA 1V 0 5ms Channel 2 2V 0 5ms Figure 20 Oscilloscope shot of a 600 Hz signal In this way the transfer functions of the filters have been measured This showed that the filters meet the characteristic as defined in ScopeF IR The phase delay is mainly determined by the FIR filter The two low passes add a phase delay of maximal 90 degrees each at the cut off frequency maximal 45 degrees each The low pass FIR filter adds a phase up to 1600 degrees Inphase Filter Frequency Response 200 400 600 800 1000 Unwrapped Phase in Degrees 1200 k
4. 2 5 V 2 4 Oversampling If the frequency of the input signal increases towards the Nyquist frequency fs 2 it becomes obvious that the amplitudes of the signals are adulterated and a beat occurs 6 58 100 158 200 258 308 358 400 3508 3008 2500 2000 i 1508 1008 508 _a_ Figure 5 Digitised 5 kHz Signal with fs 10 kHz This is because the sample point for the digitalisation isn t always at the maximum level of the signal but moves in the phase domain At relative high frequencies only one value is sampled per half cycle and so the discretization becomes obvious Application Note 8 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCor
5. The ADC reference voltage and reference ground has to be connected to 5V resp ground externally 8 2 Software The Software sources are included in the self extracting file AP3253 exe Source files Main c ASC C Adc c Gpta c Stm c lo c Fir 4 16 asm Header files Main h Asc h Adc h Gpta h Stm h lo h TC1775BRegs h Trilib h Triconv inc Tasking EDE files RealFIR pjt RealFIR mak Application Note CPU initialisation FIR routine call ASC initialisation ASC interrupt routine ADC initialisation ADC interrupt routine GPTA initialisation STM initialisation IO initialisation FIR filter routine in assembly Project file Make file 26 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 DAVE files e RealFIR dav DAVE project file The TriLib is available via Infineons regional sales The Terminal program MTTTY is available on the TriBoard Tools CD ROM in the folder utilities 8 3 Filter coefficients and transfer functions For all filters a sampling frequency of 10 kHz is used If the targeted parameters as steepness and attenuation resp ripple can not be reached ScopeFIR gives a message and shows the reached parameters Then a recalculation with modified parameters can be started Application Note 27 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 8 3 1 Low pass Filt
6. ee hee K 7 A he J J 1400 J ru S 1600 i i 0 0 0 5 1 0 1 5 2 0 2 5 3 0 3 5 4 0 4 5 5 0 Frequency in kHz Figure 21 Phase Delay of Low Pass FIR Filter Application Note 23 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 The high pass has a phase delay from 500 to 900 the band pass from 200 to 800 and the band stop from 0 to 1600 To measure the time the TriCore needs to do the filter calculation the system timer of the TC1775 can be used The system timer is a 56 bit timer which is clocked with the CPU frequency So the execution time can be measured with a resolution of 25 ns 40 MHz CPU frequency by capturing the system timer two times and calculate the difference STM Module 47 39 31 23 15 rd TERA EA SSRN Lala MCA04795 Figure 22 Block Diagram of System Timer When the program is executed from external RAM 387 cycles respectively 9 7 us are measured for one AD value respectively 32 FIR filter taps execution from internal RAM leads to 77 cycles respectively 1 9 us 40 MHz The system performance can be measured by toggling a port pin when entering an interrupt routine and toggle it again at the end In this application only the ADC interrupt is relevant The main program is just an endless loop the ASC interrupt is only used on user request what will be very rarely P8 0 GPTAO is used i
7. es 31 9 HiteratUre eira eae ea aeaa aaar Ee Eaa 32 Application Note 3 V1 2 2002 07 p Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 1 Introduction This application note describes the realisation of a real time FIR filter with the TC1775 TriBoard The TC1775 with its OnChip peripherals AD converter and GPTA and DSP functionality fits very well to this task pun PMU Data Memory Unit Program Memory Unit 32 KB SRAM z ry f 8 KB Boot ROM DD SIKB Stand By SRAM a 32 KB Scratch Pad RAM An race i Overlay Functionality OCDS Interrupt 1 KB Instruction Cache OCDSE Control BRKIN FPI Bus 32 RRKOIIT ms BRKOUT f 4K Data SRAM gt 40 MHz JVIAGIO s XTAL1 g PLL 7 gt XTAL2 PCP Control Core 2 T fro 327 Tag i i ioe ines esac J eK Gode SRAN gt 2 16k Code SRAM UKIN s h _46 CLKOUT o 16_ Adar 5 FPI Bus 5 fk Data I a 15 0 16 16 Addr 5 f 2 Data a 31 16 16 46 N g f Addr S a 15 0 10 EBU Address Control 25 16 MCB04671 GPTA anc1 anco ceptu f asc1 f asco fi ssc1 ff ssco pe J1850 16 16 2 he cr O Q 7 16 16 Port 9 Port 8 Port 7 Port 6 Tie ie Iie Iie Figure 1 Block Diagram TC1775 The filter functions high pass low pa
8. 029949 0 027525597674 0 022485085025 0 019803021106 0 002863633441 0 013029545738 0 041645477089 0 068680448229 0 102497099799 0 131491438542 0 159125130471 0 177916170397 0 188597334734 0 188597334734 0 1779161 70397 0 159125130471 0 131491438542 0 102497099799 0 068680448229 0 041645477089 0 013029545738 0 002863633441 0 019803021106 0 022485085025 0 027525597674 0 021066029949 0 020557085731 0 013007745983 0 007724050458 Application Note 30 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 8 3 4 Band stop Filter order 31 Band stop center 2 5 kHz Band stop bandwidth at top 1 8 kHz Band stop bandwidth at bottom 1 kHz Pass band ripple 3 dB Target 2 3 dB reached Stop band attenuation 40 dB Target 42 2 dB reached Inphase Filter Frequency Response RealFirStop 10 0 a a 10 f Q 20 g 30 Z S 40 sae sicciaee J 50 60 70 80 t t t t t 1 0 0 0 5 1 0 1 5 2 0 2 5 3 0 3 5 4 0 4 5 5 0 Frequency in kHz Figure 26 Inphase Filter Frequency Response of Band stop Coefficients H 0 H 31 0 000009463398 0 054457304841 0 000000237427 0 036093051590 0 000001362987 0 055299910656 0 000002548611 0 042303044667 0 000010887254 0 029461509608 0 000004758049 0 146310522412 0 000008216615 0 256303699049 0 000008
9. 799039 0 698463119613 0 000008799039 0 256303699049 0 000008216615 0 146310522412 0 000004758049 0 029461509608 0 000010887254 0 042303044667 0 000002548611 0 055299910656 0 000001362987 0 036093051590 0 000000237427 0 054457304841 0 000009463398 0 Application Note 31 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 9 Literature TriLib User s Manual V1 2 Jan 2001 User s Manual TC1775 System Units Peripheral Units V2 0 Feb 2001 Data Sheet TC1775 V1 1 Aug 2001 TriBoard TC1775B Hardware Manual V1 0 Jan 2001 ScopeFIR Help V3 7a Copyright 1998 lowegian International Corporation Halbleiter Schaltungstechnik Tietze Schenk 10 Auflage Springer Verlag Oak woON Application Note 32 V1 2 2002 07 _ Infineon AP32053 Real Time FIR Filter with the TriCore TC1775 Application Note 33 V1 2 2002 07 Infineon goes for Business Excellence Business excellence means intelligent approaches and clearly defined processes which are both constantly under review and ultimately lead to good operating results Better operating results and business excellence mean less idleness and wastefulness for all of us more professional success more accurate information a better overview and thereby less frustration and more satisfaction Dr Ulrich Schumacher http www infineon com Published by Infineon Technologies AG
10. Application Note V1 2 Jul 2002 AP32053 Real time FIR Filter with the TriCore tG1775 32 Bit Microcontroller Product Microcontrollers o Never stop thinking Real Time FIR Filter with the TriCore TC1775 Revision History 2002 07 V1 2 Previous Version V1 1 2002 06 Page Subjects major changes since last revision 11 FIR filter equation corrected 16 filter order corrected filter of third order reaches 60 dB decade Controller Area Network CAN License of Robert Bosch GmbH We Listen to Your Comments Any information within this document that you feel is wrong unclear or missing at all Your feedback will help us to continuously improve the quality of this document Please send your proposal including a reference to this document to mcdocu comments infineon com P lt Edition 2002 07 Published by Infineon Technologies AG 81726 M nchen Germany Infineon Technologies AG 2006 All Rights Reserved LEGAL DISCLAIMER THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY CONDITION OR QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT THE RECIPIENT OF THIS APPLICATION NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION INFINEON TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES
11. OF ANY KIND INCLUDING WITHOUT LIMITATION WARRANTIES OF NON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY WITH RESPECT TO ANY AND ALL INFORMATION GIVEN IN THIS APPLICATION NOTE Information For further information on technology delivery terms and conditions and prices please contact your nearest Infineon Technologies Office www infineon com Warnings Due to technical requirements components may contain dangerous substances For information on the types in question please contact your nearest Infineon Technologies Office Infineon Technologies Components may only be used in life support devices or systems with the express written approval of Infineon Technologies if a failure of such components can reasonably be expected to cause the failure of that life support device or system or to affect the safety or effectiveness of that device or system Life support devices or systems are intended to be implanted in the human body or to support and or maintain and sustain and or protect human life If they fail it is reasonable to assume that the health of the user or other persons may be endangered oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 1 WANG NOM ea a E 4 2 AD CONVEISI N sedene n a E E EEE E Eg 6 2 1 Analog MPU LGW PASS tis riparian te a a a a EREE 6 2 2 Analog to Digital Converter sisicrcerriciecnreicoenerrieierereieieiein ienien 6 2 3 Level of the Input Signal 5s Foss
12. and a capacity are needed PWM analog Input Output Figure 12 Low Pass of first Order For a low pass of first order applies f i 27RC The attenuation is 20 dB decade at the cut off frequency the attenuation is 3 dB Application Note 15 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 To get the values for the resistor and the capacitor one value can be chosen e g the capacitor and the other value the resistor can be calculated with the formula 1 2nCf In practice a capacitor and a potentiometer can be used so that the filter can be adjusted in a certain range Because a passive filter has a small steepness the useable bandwidth will be limited To get a useable signal also with this simple filter it is a possibility to increase the period frequency as described in the previous chapter Depending on that the cut off frequency has to be chosen A resolution of 8 bit and a period frequency of 156 25 kHz makes it possible to represent frequencies up to 5 kHz with a passive filter of first order A passive filter has the disadvantage that the behaviour depends on the output load To avoid this an impedance converter has to be used This leads to an active filter of first order Figure 13 Low Pass of first Order with Impedance Converter With an active filter better results can be achieved because with an active filter a hig
13. and the timer it is guaranteed that always after a defined time a conversion is done With this time the sampling frequency fs is determined In this application fs is 10 kHz this means every 100 us a conversion is started To avoid that a timer triggered conversion is delayed because of a currently running other conversion the start of a conversion can be locked a short time before the timer triggered conversion will start by using an Arbitration Lock The time for the Arbitration Lock has to be chosen longer than the maximum used conversion time Of course this AD channel has to have the highest priority Otherwise equidistant AD conversion will not be guaranteed MUX Converter K p 8 10 12 Bit EXTINO EXTIN1 External PTINO Trigger Input PTIN4 Control SR 3 0 MCB04643 Figure 3 Block Diagram of ADC Kernel 2 3 Level of the Input Signal The ADC of the TC1775 have an input voltage range of OV to 5V A signal source often has a symmetrical signal from Umax to Umax So it is necessary to adapt this signal to the asymmetrical ADC input This can be done by using a potentiometer and a capacitor Application Note 7 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 ADO 5V analog 100k Input 10u Figure 4 Input Circuit With the potentiometer the now virtual zero point can be adjusted to
14. d and the PWM signal is generated The filtertype used as default is the low pass The filter type can be changed using a terminal program like MTTTY from Microsoft The different filter types are activated just by typing the corresponding number 0 Low pass 1 High pass 2 Band pass 3 Band stop The baudrate for the RS 232 has to be 9600 8 databits 1 stopbit and no parity has to be chosen To choose another period frequency for the PWM signal the code in the files ADCO C and GPTA C has to be adapted accordingly and the project has to be rebuilt The initialisation for other frequencies are already inserted in the code as comments The default period frequency is 156 25 kHz Application Note 20 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 An extension of the number of filters or a change of the filter order is possible by modifying the MAIN C define nH 32 Filter Order define nF 4 number of Filtertypes Of course the filter coefficients has to be adapted accordingly 5 1 Ranges of values in the system The different systems use different ranges of values The peripherals like the ADC and GPTA use integer data types DSP calculation is normally done with fractional data A short fractional data type has 1 sign bit and 15 mantissa bits System Range of values Size Used Data Type ADC 0 to 4095 12 bit Integer signed FIR f
15. e 59250355228605552 255 seeded ce aed deeaceetiaeeeradinde 7 2 4 OversamplinNg eee meee teerner i en a aE err ere Sere rere eee 8 3 FIR Fiter sata ses seca a Date ctr be ae Sie a Base tee Sek cee ti Sea ae ceases 11 3 1 RUD saa cece sass ied ae teeta eet alee eel tee ees 12 3 1 1 Selection of the Filter Algorithm 2c cccccccccccesecccececestenceseetenseeesteneeseenenenenstensnes 12 3 2 Calculation of Coefficients with ScopeFIR ccceceeeeeeeeeesseeeeeeeeeeeeeees 13 Digital to Analog Conversion cgusinssiccnivenivntus esucntesndeeniuslelvanivandeaniuseleapieaniuantels 14 4 1 Ce Yee ee E E E E E 14 4 2 Analog Output Low PaSS sccieccsier veer ever vecrter veer eeereddeedsen desasasteedsen deaasaadecasee 15 5 SONWALE aoratascetantatnahenansncsscsratiunuinidnasetn sat aieheadeniatasibaheeaieniebeaianieinataadseeneandiasiea 18 5 1 Ranges of values in the SyStem 2 2 0 s s eseeeseeeeeeeeeeeeeeeeeeeeeeeeeeeeees 21 6 System WSN eiaa a ea AE a aaa EE e AEREE ERE EERE RER 22 7 79 qs Diol ag teereemeennne ery re tren erie ot E entree E T yes 25 8 PADS NI recie a e a a a a a aa a aa 26 8 1 Used POM PING ssassn e E E a a 26 8 2 SONWANE eiaancuseone 26 8 3 Filter coefficients and transfer functions s sseeeeeeeeeeeeeeeeeeeeeeeeeeeeees 27 8 3 1 OWS Ss nats sahanenteatnsssicraasianesanssctaas Ea E A E EE RE 28 8 3 2 alke lai 9 2 E eee E eee er 29 8 3 3 Band pass e neee a E EE 30 8 3 4 Band Stop ereere ereer eE e
16. e TC1775 To avoid this an oversampling can be introduced whereby the sampling frequency is not double the maximum input frequency but a factor of e g 10 or higher The maximal input frequency stays at 5 kHz where the sampling frequency will now be e g 100 kHz So the signal will not be adulterated in the way described above For that the timer triggering the ADC has to be initialised accordingly The signal digitised this way has to be converted down to a sampling frequency of 10 kHz again by a decimating filter analog analog ADC Decimating FIR Filter Signal LP 100 kHz Filter 10 kHz Figure 6 Oversampling and Decimation This can be done by using a special filter algorithm or by calculating the average Following is an example to calculate the average where the decimating factor is 10 L AD Conversion X ready J already 10 values sampled Yes calculate analog_value analog_sum 10 for FIR filter as add actual_analog_value to analog_sum End of decimation Figure 7 Flowchart of Decimation Application Note 9 V1 2 2002 07 _ Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 The appropriate source code can look like this if 1i lt 10 analog_sum analog_sum actual_analog_value itt else analog_value analog_sum 0 i 0 normal FIR filter processing also in this secti
17. e selection according to this points lead to a filter algorithm called FIR_4 16 in TriLib With this algorithm and the appropriate coefficients the desired signal processing can be done 3 2 Calculation of Coefficients with ScopeFIR The impulse response of a FIR filter and with that the function as high pass low pass band pass or band stop is determined through the coefficients There are varying PC programs available to calculate the desired filter function For this application the program ScopeFIR was used Scopef i RealFitLow sfp 18 x File Fiter View Window Registration Help alsje RA elem 22 inlA eles 2 RealFirLow sfp ency r Number of Taps p Gric ame 82 Estimate Fiter Type Specifications Lowpass Passband Upper Frequency C Highpass Stopband Lower Frequency C Bandpass Passband Ripple in dB C Bandstop Stopband Attenuation in dB 0 467736029350 Band Center tals 0 467736029350 Fipple 3057 eB 0 131219958582 Frequency 5 I 0 104590702905 Attenuation 3978348 i la A n i i aA A NAA 205 os 08 7 z4 28 NV 2 18 Inphase Amplitude ry 0 Figure 10 Screenshot ScopeFIR To calculate the coefficients the program needs the sampling frequency the filter type number of taps filter order the cut off frequencies and attenuation resp ripple The calculation is done with the Parks McClellan m
18. er Cells LTC A pulse width of 100 can t be reached if the cells are programmed in this way but that doesn t matter in this case because this only reduces the operation band slightly what hardly will be noticed To produce a PWM signal with the same resolution as the signal coming from the ADC with 12 bit also 12 bit are necessary in the GPTA At this resolution the maximum period frequency is at about 10 kHz It is calculated with the maximum GPTA frequency and the resolution n f fopta period gn Application Note 14 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 The maximum frequency for the GPTA is 40 MHz with the TC1775 This leads to following period frequencies of the PWM signal Resolution n foeriod Reloadvalue 12 bit 9 77 kHz FFFh 10 bit 39 06 kHz 3FFh 8 bit 156 25 kHz FFh Table 1 Resolution and PWM Frequency of PWM Signal Higher period frequencies have the advantage that the requirements for the low pass are lower But otherwise the resolution of the signal gets lower With future derivatives the CPU and GPTA frequency will be higher gt 100 MHz so better resolution at higher frequencies can be achieved 4 2 Analog Output Low Pass For the analog low pass two different solutions are possible Either a passive or active low pass can be used The design of a passive filter of first order is very simple just a resistor
19. er order 32 Pass band upper frequency 2 5 kHz Stop band lower frequency 3 0 kHz Pass band ripple 3 dB target 3 dB reached Stop band attenuation 40 dB target 39 8 dB reached Inphase Filter Frequency Response RealFirLow Magnitude in dB A oO 90 t t t t t 0 0 0 5 1 0 1 5 2 0 2 5 3 0 3 5 4 Frequency in kHz i T iii Figure 23 Inphase Filter Frequency Response of Low pass Coefficients H 0 H 31 0 019823830808 0 017700669836 0 024562788120 0 056515234984 0 024124669659 0 017208257785 0 007635879419 0 039947749090 0 003787532151 0 042751480133 0 020409437395 0 063662442947 0 042858887781 0 104590702905 0 131219958582 0 467736029350 0 467736029350 0 131219958582 0 104590702905 0 042858887781 0 063662442947 0 020409437395 0 042751480133 0 003787532151 0 039947749090 0 007635879419 0 017208257785 0 024124669659 0 056515234984 0 024562788120 0 017700669836 0 019823830808 Application Note 28 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 8 3 2 High pass Filter order 31 Stop band upper frequency 2 5 kHz Pass band lower frequency 2 85 kHz Pass band ripple 3 dB target 3 dB reached Stop band attenuation 40 dB target 36 8 dB reached Inphase Filter Frequency Response RealFirHigh 10 Magnitude in dB 40 aes A
20. ethod The coefficients can be exported and copied to the software The used filters can be found in the appendix including the frequency response and coefficients A demoversion of ScopeFIR can be downloaded at www iowegian com Application Note 13 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 4 _ Digital to Analog Conversion The signal which was calculated with the FIR filter has to be converted from digital to an analog signal To do this there are different possibilities A special Digital to Analog Converter IC can be used which is interfaced either parallel or serial to the TC1775 Another possibility is to generate a PWM pulse width modulation signal with a high frequency and use a low pass to filter it The second method was chosen because this is less expensive and no special hardware is necessary 4 1 GPTA To generate a PWM signal with the TC1775 its GPTA General Purpose Timer Array can be used The GPTA is an array with a big number of timercells which can be programmed in different modes so it is a flexible module for the generation of signals Of course signals can also be captured and processed with special filtercells The generation of a simple PWM signal can be realised with the Local Timer Cells LTC Three LTCs has to be used one for the timer one for the period and one for the duty cycle Figure 11 PWM Generation with Local Tim
21. get a runtime optimised solution More detailed information can be found in the chapters Selection of the Filter Algorithm and Calculation of Coefficients with ScopeF IR Application Note 11 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 TriCore s super scalar architecture consists of three instruction pipelines an Integer Execution Pipeline a Load Store Pipeline and a Zero overhead Loop Pipeline allowing issue of up to three instructions per clock cycle Integer Pipeline Loop Pipeline Load Store Pipeline Load Store Decode IP Decode Execute Address ALU h To Register File MCA04688 Figure 9 Pipelines of the TriCore In addition TriCore has SIMD Single Instructions Multiple Data capability allowing operation of multiple sets of data A typical example is TriCore s Dual MAC instruction which multiplies two signed operand adds the result to a third operand and store the result in a destination within one clock cycle With this Single Cycle Dual MAC capability a FIR filter can be implemented on TriCore very efficiently because a FIR filter can be directly done with the Multiply Accumulate arithmetic 3 1 TriLib The TriLib which is available free of charge at Infineon is a DSP library for the TriCore including the most commonly DSP algorithms They are available as source code and can be integrated easily in own projects By using t
22. her steepness can be achieved By using an active filter of second order an attenuation of 40 dB decade is reached a filter of third order reaches 60 dB decade The attenuation at the cut off frequency is still 3 dB Application Note 16 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 Figure 14 Active Low Pass of second Order The calculation of an active filter is much more complex and depends on the chosen filter type The different filter types like Butterworth Bessel or Tschebyscheff have different characteristics and are chosen depending on the system s requirements Such an active filter is more expensive to build Some op amps with an appropriate external circuit and power supplies are required for this solution Because in series production this additional costs often can t be afforded no more investigation has been spent to this solution The same problem has to be taken into account for the input low pass It may be possible to correct the attenuation forced by the analogue low passes with a more complex FIR filter but not with the used one with 32 order There the ripple is already 3 dB so there is no possibility to eliminate the attenuation of the analogue low passes Application Note 17 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 5 Software The software is compiled with the Task
23. his tested and runtime optimised algorithms a significant reduction of the development time can be reached The assembly routines are optimised by hand and are callable from C C 3 1 1 Selection of the Filter Algorithm In TriLib different FIR algorithms for different requirements are available They differ in runtime behaviour memory requirement or restrictions in the quantity of coefficients If a restriction for the quantity of the coefficients multiple of 4 is acceptable a faster FIR algorithm can be used which makes full use of TriCore s DualMAC capability If the filter has no filter order with a multiple of 4 additional zero coefficients can be inserted so that this requirement can be fulfilled This is done for the high pass and band stop Application Note 12 V1 2 2002 07 _ Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 In the library the filters are also distinguished if they are symmetrical or normal not symmetrical filters The advantage of a symmetrical filter is that the memory requirement is only half for the coefficients but the performance is worse In this application filters of 32 order are used so the occupied memory is not relevant and a normal filter not symmetrical is used Finally the filters a distinguished by block processing or sample processing For the real time filter samples are continuously processed so a filter with sample processing is chosen Th
24. ilter 1 to 1 gt 16 bit _Sfract DAC 10 kHz 0 to 4095 12 bit Integer signed DAC 40 kHz 0 to 1023 10 bit Integer signed DAC 160 kHz 0 to 255 8 bit Integer signed Table 2 Used Ranges of Values For the different DAC frequencies the resolution according to Table 1 on page 15 has to be used Before the CPU can do the DSP calculation it is necessary to convert the integer to fractional after the DSP calculation the fractional data has again to be converted It s not possible to convert an integer directly to a fractional It is possible to do this by a multiplication of the integer with a fractional data type int_to_fract convert ADC value int to X _sfract X value int_to_fract To reconvert the fractional data to integer the intrinsic function mulfractlong of the Tasking Compiler can be used whereby fract_to_int is an integer convert R _fract to value int value _mulfractlong R fract_to_int Application Note 21 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 6 System test There are different possibilities to test the system To verify the data coming from the ADC it is possible to write them to an array The Lauterbach Incircuit Debugger offers to display an array as graph so it is possible to evaluate the values very quick 8 58 100 158 208 1 1 1 1 509
25. ing C C Compiler V1 1 R2 for TriCore To initialise the different peripherals the softwaretool DAVE V2 1 R22 with the update for TC1775 V2 2 from Infineon was used With DAvE the registers can be initialised under Windows using Wizards The C Code generated by DAvE can directly be used in the project Modifications done by the user in the code will be recognised and won t be overwritten DAvE is of good use for the creation of a new project the time for initialisation can be shortened and potential errors can be avoided The project is based on the files generated by DAvE and the standard TriBoard configuration The software has following structure In MAIN C the initialisation of the peripherals is done After that an endless loop is executed all further processing is interrupt driven Reset init filter coefficients 1O_vinit ASCO_vinit AA ADCO_vinit A A GPTA_vinit y enable interrupts lt lt _ v endless loop wait for interrupt Figure 15 Flowchart MAIN C Application Note 18 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 Two interrupts are activated The ADC interrupt showing the end of an AD conversion and the ASC interrupt to change the filter type The ADC interrupt is triggered every 100 us the ASC interru
26. ise the signal will be distorted by the so called aliasing To avoid this a low pass has to be connected before the ADC so the spectrum of the input signal is reduced to the correct bandwidth This low pass has to be designed according to the system requirements In this application a passive low pass of first order is used That s sufficient because only signals up to 5 kHz are fed in by the signal generator Some hints how to design this low pass can be found in the chapter DA Conversion 2 2 Analog to Digital Converter The TC1775 has 2 AD Converters with 16 channels each and a resolution up to 12 bit The conversion time is 8 1 us at 12 bit resolution and 7 1 us at 10 bit resolution For each AD Converter several Conversion Request Sources are available which can request the conversion of a dedicated channel Application Note 6 V1 2 2002 07 Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 EMUXO External Synchroni vati 4 EMUXI Multiplexer zation Syncnironization EMUX2 Control Control g lt Request Generation Control Control Unit Status Unit fi Interrupt Control To digitise an analog signal without distortion it is necessary that the time between two conversions is always constant equidistant With the TC1775 this can be realised by using the integrated timer working as Conversion Request Source for the ADC After initialising the ADC
27. n the software for the measurement When the program is executed from internal memory the interrupt takes 3 0 us every 100 us This is 3 of the available performance 40 MHz Application Note 24 V1 2 2002 07 eo Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 7 Conclusion The TriCore TC1775 offers with its DSP capability and the OnChip peripherals a powerful solution for even complex applications using control tasks with digital signal processing what is demonstrated with this application note Another advantage is that only one toolchain has to be used instead of two when a microprocessor and a DSP is used For this task a system performance of only 3 is used So there is enough performance for further tasks and additionally the PCP Peripheral Control Processor can be used offering additional computing power So the TriCore TC1775 fits very well to complex and time critical tasks Please note that this real time FIR filter application can also be implemented on the TC1765 another powerful member of the TriCore family Application Note 25 V1 2 2002 07 8 8 1 oe Infineon technologies Appendix AP32053 Real Time FIR Filter with the TriCore TC1775 Used Port Pins Signal Symbol Function Analog input P6 0 ANO Analog input 0 PWM output P10 2 IN34 OUT34 line of GPTA ADC Int output P8 0 INO OUTO line of GPTA Table 3 Used Port Pins Remark
28. on analog_sum 10 By calculating the average the maximum amplitude is never reached The signal shows a attenuation at the relative high frequencies because there the steepness of the signal is higher an so the attenuation becomes more obvious Application Note 10 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 3 FIR Filter Digital signals can be processed by DSP Digital Signal Processing There are many different algorithms which are used according to the requirements FIR Finite Impulse Response filter are suitable for different filter functions They can be implemented easily on processors and have the advantage that they are always stable The stability is e g for IIR Infinite Impulse Response filters not guaranteed For a general nH tap FIR filter the difference equation is nH 1 R n gt H X n i i 0 where X n Filter input for n sample R n Output of the filter for n sample Hi Filter coefficients nH Filter order X n R n Filter Output Figure 8 Block Diagram of the FIR Filter In this application the high pass low pass band pass and band stop are realised using FIR filters according to the description These filters have an order of 31 high pass band stop resp 32 low pass band pass whereby the filters of 31 order are realised in the software as filters of 32 order H31 0 to
29. pt is triggered on user input only C D Reset init filter coefficients 1O_vinit ASCO_vinit ADCO_vinit GPTA_vinit enable interrupts AA endless loop wait for interrupt Figure 16 Flowchart ADC Interrupt In the ADC interrupt all the calculation for the real time filter is be done The analog value from the ADC is converted to a fractional data type With this data the FIR filter routine is started After that the result is again converted so it can be used by the GPTA to generate the PWM signal The measured execution time can be found in chapter System test Application Note 19 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 yem T ASC interrupt get receive_string convert receive_string to integer _ applicable SO filtertype oil Yes change filtertype y F Return a e Figure 17 Flowchart ASC Interrupt The ASC interrupt is activated when the user sends a message to the TriCore In the interrupt the received string is converted to an integer and evaluated if it is a applicable filter type If this is true the filter type is changed After starting the software the conversion of the input signal starts immediately the output signal is calculate
30. ss band pass and band stop are realised with a FIR filter of 32 order each analog analog FIR analog analog Figure 2 System Overview The analog input signal e g from a signal generator is digitised with one of TC1775 s two Analog to Digital converters Application Note 4 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 The calculation of the digital filter function DSP is done by the CPU For that a FIR algorithm of Infineon s TriLib is used The coefficients for the filter can be calculated with an appropriate software program For this application note the program ScopeFIR was used Finally the GPTA of the TC1775 generates a PWM signal with the digital filtered signal To get an analog signal a low pass has to be connected Application Note 5 V1 2 2002 07 oe Infineon technologies AP32053 Real Time FIR Filter with the TriCore TC1775 2 AD Conversion In this application a resolution of 12 bit and a sample rate of 10 kHz is used for the conversion According to the sampling theorem a signal up to 5 kHz can be converted This is sufficient to demonstrate and test the different filter functions In the next chapter some hints concerning the digitalisation are given which have to be considerated 2 1 Analog Input Low Pass The analog signal fed in the system mustn t exceed the frequency fmax fs 2 where fs is the sampling frequency Otherw

Download Pdf Manuals

image

Related Search

Related Contents

UGM 2020 ZE - Bosch Security Systems  Denon ASD-3N User's Manual  D4.7 – Basic global prediction tool and user manual  GBC 250T User's Manual  

Copyright © All rights reserved.
Failed to retrieve file