DSPRelated.com
Forums

Ticks in SWI period

Started by soli...@poczta.onet.pl June 24, 2008
Hello.
I'm working on c6711 and I have some doubts about clocks rate.
I use audio example from Code Composer. Because I want to implement a MELP vocoder, I set frame length in pipelines to be 180 words (to fit the MELP frame). For 8kHz sampling rate it makes one frame filled every 22,5 ms and then software interruption occurs.
c6711 works on 150MHz clock rate, so in 22,5 ms period I should get 3375000 ticks. I used CLK_gethtime() function to check it. The result was exactly the half of expected value, 1687500 ticks between SWIs. Did I make a mistake in my calculations? Or maybe something is wrong with the project settings?
BTW, MELP analysis requires about 2100000 ticks to be performed (without any optimization), so it can't be completed in one interruption period with this efficiency I have now.
Regards
Alexandra
Hi,

AFAIR all peripheral units run with SYSCLK2 which is SYSCLK1/2

HTH

Gustl

s...@poczta.onet.pl schrieb:
> Hello.
> I'm working on c6711 and I have some doubts about clocks rate.
> I use audio example from Code Composer. Because I want to implement a
> MELP vocoder, I set frame length in pipelines to be 180 words (to fit
> the MELP frame). For 8kHz sampling rate it makes one frame filled every
> 22,5 ms and then software interruption occurs.
> c6711 works on 150MHz clock rate, so in 22,5 ms period I should get
> 3375000 ticks. I used CLK_gethtime() function to check it. The result
> was exactly the half of expected value, 1687500 ticks between SWIs. Did
> I make a mistake in my calculations? Or maybe something is wrong with
> the project settings?
> BTW, MELP analysis requires about 2100000 ticks to be performed (without
> any optimization), so it can't be completed in one interruption period
> with this efficiency I have now.
> Regards
> Alexandra
>
Alexandra,

On 6/24/08, Bernhard 'Gustl' Bauer wrote:
>
> Hi,
>
> AFAIR all peripheral units run with SYSCLK2 which is SYSCLK1/2
>
> HTH
>
> Gustl
>
> s...@poczta.onet.pl schrieb:
> >
> >
> > Hello.
> > I'm working on c6711 and I have some doubts about clocks rate.
> > I use audio example from Code Composer. Because I want to implement a
> > MELP vocoder, I set frame length in pipelines to be 180 words (to fit
> > the MELP frame). For 8kHz sampling rate it makes one frame filled every
> > 22,5 ms and then software interruption occurs.
> > c6711 works on 150MHz clock rate, so in 22,5 ms period I should get
> > 3375000 ticks. I used CLK_gethtime() function to check it. The result
> > was exactly the half of expected value, 1687500 ticks between SWIs. Did
> > I make a mistake in my calculations? Or maybe something is wrong with
> > the project settings?
>

Refer to spra829.pdf.
I believe that the timer uses CPU/4 as input for 6711. I also seem to
remember that there is a timer out pin on the 6711 that you can check with a
scope.

Note: 6711, 6711B, and 6711C have slightly different timer behavior
capabilities. Also make sure that your PLL setup and clock divisors are
correct.

mikedunn

> BTW, MELP analysis requires about 2100000 ticks to be performed
> (without
> > any optimization), so it can't be completed in one interruption period
> > with this efficiency I have now.
> > Regards
> > Alexandra
>
--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
solita,

A possible explanation is the amount of time that interrupts are disabled is interfering with the
counting of the clock cycles.

A good explanation can be found in the TI document: spra829.pdf

R. Williams
---------- Original Message -----------
From: s...@poczta.onet.pl
To: c...
Sent: Tue, 24 Jun 2008 05:28:05 -0400
Subject: [c6x] Ticks in SWI period

> Hello.
> I'm working on c6711 and I have some doubts about clocks rate.
> I use audio example from Code Composer. Because I want to implement a MELP vocoder, I set
> frame length in pipelines to be 180 words (to fit the MELP frame). For 8kHz sampling rate
> it makes one frame filled every 22,5 ms and then software interruption occurs. c6711 works
> on 150MHz clock rate, so in 22,5 ms period I should get 3375000 ticks. I used
> CLK_gethtime() function to check it. The result was exactly the half of expected value,
> 1687500 ticks between SWIs. Did I make a mistake in my calculations? Or maybe something
> is wrong with the project settings? BTW, MELP analysis requires about 2100000 ticks to be
> performed (without any optimization), so it can't be completed in one interruption period
> with this efficiency I have now. Regards Alexandra
------- End of Original Message -------
Hello.
>I'm working on c6711 and I have some doubts about clocks rate.
>I use audio example from Code Composer. Because I want to implement a MELP vocoder, I set frame length in pipelines to be 180 words (to fit the MELP frame). For 8kHz sampling rate it makes one frame filled every 22,5 ms and then software interruption occurs.
>c6711 works on 150MHz clock rate, so in 22,5 ms period I should get 3375000 ticks. I used CLK_gethtime() function to check it. The result was exactly the half of expected value, 1687500 ticks between SWIs. Did I make a mistake in my calculations? Or maybe something is wrong with the project settings?
>BTW, MELP analysis requires about 2100000 ticks to be performed (without any optimization), so it can't be completed in one interruption period with this efficiency I have now.
>Regards
>Alexandra
>

Well...the situation sems to be a bit more compicated.
I used user LEDs as interruption indicators - turning on in the beginning of interruption, turning off in the end. I checked the period. It was 45ms, and this is twice as much as expected (180 samples with 8kHz sampling frequency last 22,5ms). This makes sense with the number of ticks now. The counter used by CLK_gethtime is incremented every four CPU cycles, so in 45ms it would be about 1687500 ticks.
Now the problem is: why 22,5ms frame generates 45ms interruption?
Alexandra,

On 6/26/08, s...@poczta.onet.pl wrote:
>
> Hello.
> >I'm working on c6711 and I have some doubts about clocks rate.
> >I use audio example from Code Composer. Because I want to implement a MELP
> vocoder, I set frame length in pipelines to be 180 words (to fit the MELP
> frame). For 8kHz sampling rate it makes one frame filled every 22,5 ms and
> then software interruption occurs.
> >c6711 works on 150MHz clock rate, so in 22,5 ms period I should get
> 3375000 ticks. I used CLK_gethtime() function to check it. The result was
> exactly the half of expected value, 1687500 ticks between SWIs. Did I make a
> mistake in my calculations? Or maybe something is wrong with the project
> settings?
> >BTW, MELP analysis requires about 2100000 ticks to be performed (without
> any optimization), so it can't be completed in one interruption period with
> this efficiency I have now.
> >Regards
> >Alexandra
> >
>
> >
> >
> Well...the situation sems to be a bit more compicated.
> I used user LEDs as interruption indicators - turning on in the beginning
> of interruption, turning off in the end. I checked the period. It was 45ms,
> and this is twice as much as expected (180 samples with 8kHz sampling
> frequency last 22,5ms). This makes sense with the number of ticks now. The
> counter used by CLK_gethtime is incremented every four CPU cycles, so in
> 45ms it would be about 1687500 ticks.
> Now the problem is: why 22,5ms frame generates 45ms interruption?
>

You need to check your 'I/O count' - Is the example that you are using for
stereo?? [Reading a left and right for each sample].

Whatever the problem, it is likely a logic problem involving reading 'twice
as much data as you think it is'. If you do not see it in the code,
instrument your code with some extra variables that count the number of
samples per frame to help you locate the problem.

mikedunn

>

--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
solita,

You have captured the period of the interrupt at 45ms when 22.5msec was expected.
what is the duration of each interrupt? Perhaps the duration of the interrupt processing is greater
than 22.5msec and the result is only every second interrupt source event is actually being serviced.

R. Williams

---------- Original Message -----------
From: s...@poczta.onet.pl
To: c...
Sent: Thu, 26 Jun 2008 03:36:34 -0400
Subject: [c6x] Re: Ticks in SWI period

> Hello.
> >I'm working on c6711 and I have some doubts about clocks rate.
> >I use audio example from Code Composer. Because I want to implement a MELP vocoder, I set frame
length in pipelines to be 180 words (to fit the MELP frame). For 8kHz sampling rate it makes one
frame filled every 22,5 ms and then software interruption occurs.
> >c6711 works on 150MHz clock rate, so in 22,5 ms period I should get 3375000 ticks. I used
CLK_gethtime() function to check it. The result was exactly the half of expected value, 1687500
ticks between SWIs. Did I make a mistake in my calculations? Or maybe something is wrong with the
project settings?
> >BTW, MELP analysis requires about 2100000 ticks to be performed (without any optimization), so it
can't be completed in one interruption period with this efficiency I have now.
> >Regards
> >Alexandra
> >
>
> >
> >
> Well...the situation sems to be a bit more compicated.
> I used user LEDs as interruption indicators - turning on in the beginning of interruption,
> turning off in the end. I checked the period. It was 45ms, and this is twice as much as
> expected (180 samples with 8kHz sampling frequency last 22,5ms). This makes sense with the
> number of ticks now. The counter used by CLK_gethtime is incremented every four CPU cycles,
> so in 45ms it would be about 1687500 ticks. Now the problem is: why 22,5ms frame
> generates 45ms interruption?
------- End of Original Message -------
Alexandra-

> >I'm working on c6711 and I have some doubts about clocks rate.
> >I use audio example from Code Composer. Because I want to implement a MELP vocoder, I set frame length in pipelines to be 180 words (to fit the MELP frame). For 8kHz sampling rate it makes one frame filled every 22,5 ms and then software interruption occurs.
> >c6711 works on 150MHz clock rate, so in 22,5 ms period I should get 3375000 ticks. I used CLK_gethtime() function to check it. The result was exactly the half of expected value, 1687500 ticks between SWIs. Did I make a mistake in my calculations? Or maybe something is wrong with the project settings?
> >BTW, MELP analysis requires about 2100000 ticks to be performed (without any optimization), so it can't be completed in one interruption period with this efficiency I have now.
> >
> Well...the situation sems to be a bit more compicated.
> I used user LEDs as interruption indicators - turning on in the beginning
> of interruption, turning off in the end. I checked the period. It was
> 45ms, and this is twice as much as expected (180 samples with 8kHz
> sampling frequency last 22,5ms). This makes sense with the number of
> ticks now. The counter used by CLK_gethtime is incremented every four
> CPU cycles, so in 45ms it would be about 1687500 ticks.
> Now the problem is: why 22,5ms frame generates 45ms interruption?

Is this a DSK 6711 board? If not, what is the A/D interface?

-Jeff
Aswering all the questions:
1. In fact, I did not check if I used codec settings for stereo. However, I added some variables to find the number of samlpes in one frame and it's OK (180 samples). Well... maybe codec really reads more data, I have to check it, but the size of processed frame is proper.
2. Duration of interruption processing is small enough. If the processing is not finished when the next SWI occurs, some synch errors appear and the whole program crashes... so I know immediately that something is wrong. It doesn't matter if the processing time is 5ms or 20ms, as long as it is not longer than interruption period, SWIs appear when the input frame is filled and ready, so the period is fixed.
3. It is c6711 DSK board and I use built-in AD535.
solita,

You have stated that the interrupt rate/period is twice too long.
You have ask as to why that would be.
Now your saying that the interrupt rate is just fine, because no data is being missed.
SO what is the actual problem?

R. Williams

---------- Original Message -----------
From: s...@poczta.onet.pl
To: c...
Sent: Fri, 27 Jun 2008 02:25:02 -0400
Subject: [c6x] Re: Ticks in SWI period

> Aswering all the questions:
>
> 1. In fact, I did not check if I used codec settings for stereo. However, I added some
> variables to find the number of samlpes in one frame and it's OK (180 samples). Well...
> maybe codec really reads more data, I have to check it, but the size of processed frame is
> proper.
> 2. Duration of interruption processing is small enough. If the processing is not finished
> when the next SWI occurs, some synch errors appear and the whole program crashes... so I
> know immediately that something is wrong. It doesn't matter if the processing time is 5ms
> or 20ms, as long as it is not longer than interruption period, SWIs appear when the input
> frame is filled and ready, so the period is fixed.
> 3. It is c6711 DSK board and I use built-in AD535.
------- End of Original Message -------