Hello Nico, No I did not receive a prior email, so something was amiss there. Yes, both auxiliary arithmetic units can perform simultaneous circular addressing (see examples below). The most likely scenario (for the distorted audio) is that you are trying to step this code *and* expecting the AIC and serial port to give meaningful results. The trouble with this particular AIC is that it is a serialy programmed device, and when you step the processor, those 'gaps' between the steps are the equivelent of many cycles. The result is that the transmitter is often underrun and when you do finaly 'step' the serial port blasts out a frame of junk. Soln: You are not using the DMA, so set it up to continuously recirculate the DXR value. Basicaly, read the DXR and write it back in the very next cycle. Ill let you figure this out... its pretty simple to do. I noticed that you caught the obvious 'mistake' I put into in the DAC2 routine. With circular modification, why bother with checking the value and reloading the start value (good for you!). >>> But what about the data alignment. If you save to Addr and then circular increment, the pointer now points to the oldest value. Are you properly aligned? I also noticed that you had removed several push/pop pairs in the ISR's. Normaly I would advise against this, but in some cases it can be quite useful. Maybe you noticed this (or maybe you did not), but the 'main' loop does zippo... nothing! Therefore there is NO NEED TO SAVE AND RESTORE ANYTHING IN THE ISR's! This simply wont work for bigger more elaborate programs, but it sure pays off for very simple stuff that is totaly contained in the ISR's. There are two examples below. The first is a modified FIR showing that the code can be reduced quite a bit if the 'main' loop is doing nothing. The second shows another technique for aligning the data and coefficients. Best regards, Keith Larson PS: This wont do you much good (being that you are already taking a DSP class), but the TMS320VC33 DSK will be open for order entry very soon, and it wont have the AIC/serial port under/over run problem because the AIC being used on the new board (PCM3003 20 bit stereo codec) is not serial programmed! Though great for audio, the downside is that the ADC, being a sigma-delta type, must be AC coupled and is not a succesive approximation. IOW, not very good for control and instrumentation, but a whole lot easier to explain! ;**************************************************** ; Begin main code loop here ;**************************************************** main ldp ADC_first ; ldi @ADC_first,AR1 ; Load ptrs and circ access registers ldi @FIR_coefx,AR0 ; OUTSIDE of ISR's (this is a special case) ldi @SIZE,BK ; ;------------------------------- NOTE: There is NO code in main1 loop main1 ; or GIE,ST ; Interrupts therefor do not need ; ldi 0xF4,IE ; to save and restore anything ;----------------------- call DAC2 ; NOTE: I used calls here to simulate call ADC2 ; the interrupts occuring in succesion b main1 ; In lieu of showing the DMA DXR pump ;------------------------------- DAC2 ldf 0.0,R2 ; <- No preload??? ldf 0.0,R0 ; <- because of this??? ldi @SIZE,RC ; subi 1,RC ; Note the change in RC value! rptb FIR2 ; since summing from zero mpyf3 *AR0++%,*AR1++%,R0 FIR2 || addf3 R0,R2,R2 addf R2,R0 fix R0,R0 ; andn 3,R0 ; sti R0,@S0_xdata ; Output the new DAC value reti ; ;------------------------------- ADC2 ldi @S0_rdata,R3 ; Get data from serial port lsh 16,R3 ; sign extend 16 lsb's ash -16,R3 ; float R3,R3 ; Convert to float and store for FIR data stf R3,*AR0++% ; reti ; ;------------------------------ ; This code does not do much. It simply shows how circular ; addressing buffers can be set up using the .brstart directive ; After assembly, open up the *.DSK file and examine the results ;------------------------------ .start "CODE",0x809802 ; Start assembling CODE section here .sect "CODE" ; .entry SAMPLE ; Debugger entry point ;-------------------------- SAMPLE ldp @stack ; Load a data page ldi @stack,SP ; Load a stack pointer ;-------------------------- ldi 5,BK ; Load block size ldi @A_0,AR0 ; load pointers ldi @A_1,AR1 ; ;-------------------------- LOOP addi *AR0++%,*AR1++%,R0 ; Add(circ) should always be 6 b LOOP ; (due to how data is aligned) ;---------------------------------- A_0 .word DAT_0 ; A_1 .word DAT_1+2 ; ;-------------------------- .brstart "zero",8 ; Align two data sections DAT_0 .word 1,2,3,4,5 ; EACH on 8 word boundaries ;-------------------------- NOTE: Examine DSK output file .brstart "one",8 ; to reveal that 3 locations are skipped DAT_1 .word 2,1,5,4,3 ; ;-------------------------- stack .word $+1 ; Begin stack here .end At 12:03 PM 11/4/02 -0300, you wrote: >I already sent this message but I am sending it again because I was adviced >it did not arrive. >Thanks. >Nico V. >-----Mensaje original----- >De: Nicolas J. Vignale [mailto:] >Enviado el: Micoles, 30 de Octubre de 2002 07:52 p.m. >Para: c3x yahoogroups >Asunto: Question to Mr. Larson >Keith Larson: We modified your FIR.ASM code from DSKTOOLS. What we wanted is >to perform cirlcular addressing in both impulse response and input buffer. >We couldn't make it work. What we obtained was not the expected, it looks >like a noisy waveform. > >Is it possible to apply circular addressing in the same instruction? >example: mpyf3 *AR0++%,*AR1++%,R0 > >Another Question: What event should occur for the ISR DAC2 to be serviced? > >We attached your code with our modifications (FIR_GAE.ASM). > >PD: We have a DSK with tms320c31 > >Thanks for your help. >Best Regards.- > >GAE >Attachment Converted: C:\Attach\FIR_GAE.ASM > +-----------+ |Keith Larson | |Member Group Technical Staff | |Texas Instruments Incorporated | | | | 281-274-3288 | | | | www.micro.ti.com/~klarson | |-----------+ | TMS320C3x/C4x/VC33 Applications | | | | TMS320VC33 | | The lowest cost and lowest power 500 w/Mflop | | floating point DSP on the planet! | +-----------+ |
Re: RV: Question to Mr. Larson
Started by ●November 4, 2002