Connexions

You are here: Home » Content » Multirate Filtering: Implementation on TI TMS320C54x (Thai Version)
Content Actions

Multirate Filtering: Implementation on TI TMS320C54x (Thai Version)

Module by: Douglas L. Jones, Swaroop Appadwedula, Matthew Berry, Mark Haun, Jake Janovetz, Michael Kramer, Dima Moussa, Daniel Sachs, Brian Wade, Patrick Frantz, Kamolchanok Kriengchaipruck Based on: Multirate Filtering: Implementation on TI TMS320C54x โดย Douglas L. Jones, Swaroop Appadwedula, Matthew Berry, Mark Haun, Jake Janovetz, Michael Kramer, Dima Moussa, Daniel Sachs, Brian Wade

Summary: You will implement a multirate system that includes three fininte impulse response filters. The sample-rate compression and expansion factors can be controlled in real time using a MATLAB graphical user interface.

Implementation

ก่อนที่จะเริ่ม implementing ระบบทั้งหมดดังที่แสงอยู่ใน Multirate Processing: Introduction ขอให้คุณทำการออกแบบระบบที่มีชุดของ filters FIR 1 และ FIR 2 ที่ไม่มี sample-rate compressor หรือ expander ก่อน. จากนั้นให้ทำการ verify ว่าค่าที่ได้จาก two-filter system นั้นถูกต้องหรือไม่ เมื่อเรียบร้อยแล้ว ก้อให้เริ่มทำการ mplement ระบบ multirate ทั้งหมด แล้วทำการ verify ผลลัพธ์ ในตอนแรกให้ใช้ fixed compression และ expansion factors ของ D=U=4 D U 4 . ต่อไป คุณจะสามารถควบคุม factor ตัวนี้โดยช้ MATLAB interface; อย่าลืมเงื่อนไขข้อนี้ในขณะเขียน code ด้วย

Compressed-rate processing

ให้ทำการ implement counter ใน code เพื่อที่จะทำการ processing ที่ระดับ sample rate ที่ต่ำกว่าได้ counter จะเป็นตัวกำหนดว่า ompressed-rate processing จะเกิดขึ้นเมื่อไหร่ และยังสามารถใช้เป็นตัวกำหนดว่าจะเพิ่ม ศูนย์ ไปใน FIR 3 เพื่อ implement sample-rate expander อีกด้วย
คำสั่งบางอย่างที่อาจมีประโยชน์ ช่วยในการ implement โครงสร้างแบบ multirate structure คือ addm (add to memory) และ bc (branch conditional) คุณอาจจะลองใช้ banz (branch on auxiliary register not zero) และ b (branch)ได้เช่นกัน

Real-time rate change and MATLAB interface

Graphical user interface (GUI) อย่างง่ายมีอยู่ที่ (as mrategui.m, ซึ่งต้องมี ser_snd.m) จะทำหน้าที่ส่งตัวเลข ตั้งแต่ 1 ถึง 10 ไปยัง DSP ผ่าน serial port. ซึ่งสามรถใช้วิธีนี้ในการ เปลี่ยน ค่า compression และ expansion factor แบบ real time ได้
Run GUI โดยพิมพ์คำว่าmrategui ตรง MATLAB prompt. จากนั้นควรจะมี แถบเลื่อนปรากฏขึ้นมาอัติโนมัติ เพื่อไว้สำหรับปรับค่า compression และ expansion factor ที่จะส่งไป DSP
Assembly code ที่คุณได้รับไปนั้นจะเก็บค่าสุดท้ายที่ DSP ได้รับจากคอมพิวเตอร์ไว้ในหน่วยความจำตำแหน่ง ที่ระบุไว้ว่า hold. ถ้าหากคุณไม่ได้ทำการเปลี่ยน serial port สำหรับ code นั้น, คุณก็จะสามารถหาค่าสุดท้ายของ compression และ expansion factor ที่เกิดจาก GUI ได้ที่หน่วยความจำตำแหน่งนี้. คุณต้องทำการแก้ไข code เพื่อให้ทุกครั้งที่ได้รับค่าใหม่จาก serial port, compression และ expansion factor ถูกเปลี่ยนด้วย ถ้าได้รับค่า "1" ทั้งระบบควรจะทำงานที่ full rate; แต่ถ้าเป็น "10" ระบบ ควรจะต้องเลือก sample 9 ตัว จากแต่ละ sample ที่ถูกประมวลผลที่ lower rate ทิ้งไป
ให้สังเกตุว่า macro READSER และ WRITSER ซึ่งใช้ในการอ่ารและส่งค่าไปยัง serial port, ทำการ overwrite AR0, AR1, AR2, และ registerAR3 เช่นกัน BK และ condition flag TC. เพราะฉะนั้นให้ระวังว่า register เหล่านี้ไม่ได้ถูกใช้โดยส่วนอื่นใน code, หรือคุณควรจะต้องทำการ save และ restore ค่าในหน่วยความจำก่อนท่จะเรียกใช้ macro READSER และ WRITSER ซึ่งสามารถทำได้โดยใช้คำสั่ง mvdm และ mvmd โดยที่ macro เหล่านี้จะทำการ set up ค่า AR1 และ AR3 ทุกครั้งที่ถูกเรียกใช้ จึงไม่จำเป็นต้องเปลี่ยน register ก่อนที่จะเรียกใช้ macro
ข้อมูลเพิ่มเติมเกี่ยวกับ macro READSER และ WRITSER หาได้ที่ Core File: Serial Port Communication Between MATLAB and TI TMS320C54x.

Comments, questions, feedback, criticisms?

Discussion forum

Send feedback