DSPRelated.com
Forums

sending a signal to a PC via HPI

Started by rockall_rebel January 25, 2004
Hi all,

I have a c6711DSK, and I'd like to transfer signal information from
my DSK to my PC. I'm working with the TI aic23evm codec. This is a
16bit two channel DAC and two channel ADC. I'm currently taking a
signal from one of the ADCs, processing this signal, and outputting
the resultant processed signal to the DAC. I'd now like to transfer
the processed signal to my PC also, so I can store it as a wav file
and display it on screen. I'm implementing my Codec communication
using PIPes and EDMA. I have two PIPs, for rx and tx respectively,
with 4 frames each and a frame word size of 128. My code includes the
following SWI -

Void AudioSWI(PIP_Obj *in, PIP_Obj *out)
{
Uns *src, *dst;
Uns size;
Uns f1,f2; //each channel in floating point form
Uns size;

size = getBuf(in, &src); // size = 128
allocBuf(out, &dst);

for (i = 0; i < size/2; i++)
{
// channel 1 and 2 stored as 32-bit; convert to float
UnsToFloat(*(src+i),f1,f2);

f1 = process(f1); // process channel 1 sample

FloatToUns(*(dst+i),f1,f2);
}

putBuf(out, size);
freeBuf(in);
}

How should I transfer each of the samples, f1, to my PC using HPI? I
could create a large buffer and fill it with each sample, and notify
the PC when it is filled. The PC could then start reading this
buffer - but the DSP cant write the buffer until the PC is finished
reading, which complicates things. What size should I make the
buffer? Do I really need to implement HPI interrupts, I've had
problems doing this before... Would handshaking suffice instead, with
out impacting on efficiency to greatly? I could set aside a memory
address where both the PC and DSK read and write flags. This is what
I've done in the past.

I can think of ways of doing this, but I'm sure there is a more
efficient method.

Thanks very much for your help,

Fran.




What Type of sample rate are you trying to maintain?

Try using a "ping-pong" buffer for the data you are sending to the
PC, so that a PC interface process can be reading data from one
buffer while the DSP data acquistion and processing thread can write
data to the other. If you've got enough MIPs, you'll be able to do
it at your intended sample rate.

Also consider using TI's RTDX approach, but again you may have
throughput problems.

We've implemented a similar functionality using a 5510 DSK in
our "Hard Disk Recorder" (see our web site), we record audio data
straight to a harddrive. We could probably use this experience to
get a similar system to work on a 67. We are available for more
consultation & engineering services. Contact us if you're interested.

-Shawn Steenhagen
www.appliedsignalprocessing.com --- In , "rockall_rebel" <rockall_rebel@y...>
wrote:
> Hi all,
>
> I have a c6711DSK, and I'd like to transfer signal information from
> my DSK to my PC. I'm working with the TI aic23evm codec. This is a
> 16bit two channel DAC and two channel ADC. I'm currently taking a
> signal from one of the ADCs, processing this signal, and outputting
> the resultant processed signal to the DAC. I'd now like to transfer
> the processed signal to my PC also, so I can store it as a wav file
> and display it on screen. I'm implementing my Codec communication
> using PIPes and EDMA. I have two PIPs, for rx and tx respectively,
> with 4 frames each and a frame word size of 128. My code includes
the
> following SWI -
>
> Void AudioSWI(PIP_Obj *in, PIP_Obj *out)
> {
> Uns *src, *dst;
> Uns size;
> Uns f1,f2; //each channel in floating point form
> Uns size;
>
> size = getBuf(in, &src); // size = 128
> allocBuf(out, &dst);
>
> for (i = 0; i < size/2; i++)
> {
> // channel 1 and 2 stored as 32-bit; convert to float
> UnsToFloat(*(src+i),f1,f2);
>
> f1 = process(f1); // process channel 1 sample
>
> FloatToUns(*(dst+i),f1,f2);
> }
>
> putBuf(out, size);
> freeBuf(in);
> }
>
> How should I transfer each of the samples, f1, to my PC using HPI?
I
> could create a large buffer and fill it with each sample, and
notify
> the PC when it is filled. The PC could then start reading this
> buffer - but the DSP cant write the buffer until the PC is finished
> reading, which complicates things. What size should I make the
> buffer? Do I really need to implement HPI interrupts, I've had
> problems doing this before... Would handshaking suffice instead,
with
> out impacting on efficiency to greatly? I could set aside a memory
> address where both the PC and DSK read and write flags. This is
what
> I've done in the past.
>
> I can think of ways of doing this, but I'm sure there is a more
> efficient method.
>
> Thanks very much for your help,
>
> Fran.