Skip navigation
2364 Views 9 Replies Latest reply: Jun 26, 2010 6:01 PM by benjaminshinobi RSS
benjaminshinobi Just Startin' 11 posts since
Feb 24, 2010
Currently Being Moderated

Jun 21, 2010 2:40 PM

n00b question (starting the main loop)

I've been trying to figure out what is going on with the filter example, and just make the LED's blink. The problem I am seeing is that the main "LOOP" subroutine is not being called if I take out the interrupt code (everything below the main loop) and make the vectors4.inc file only JMP to the main loop. To make it more succinct, how/where/when is the vectors subroutine being called in vectors4.inc?

 

let me know if you guys need any more info

  • audioartillery Just Startin' 80 posts since
    Apr 18, 2008
    Currently Being Moderated
    Jun 22, 2010 1:39 PM (in response to benjaminshinobi)
    Re: n00b question (starting the main loop)

    I'm not sure I quite follow what you're trying to do but without the interrupt code you'll find very little works.  The GUI debug variables and the audio in/out functionality are both interrupt-driven.

      • audioartillery Just Startin' 80 posts since
        Apr 18, 2008
        Currently Being Moderated
        Jun 24, 2010 8:34 AM (in response to benjaminshinobi)
        Re: n00b question (starting the main loop)

        I wrote a walkthru of the example code a while back, you may find it useful:

         

        http://www.tcddk.com/wiki/index.php?title=GettingStarted

         

        I suggest putting tweaks in the RX "even" ISR.  The main loop is really just an idle loop.

      • RedPandaCurt Just Startin' 23 posts since
        Oct 30, 2009
        Currently Being Moderated
        Jun 24, 2010 12:15 PM (in response to benjaminshinobi)
        Re: n00b question (starting the main loop)

        If you want to turn the TwoBandStereoEQ example into a "hello world" without actually digging through the interrupt code, here is where the audio processing happens within the interrupt handler (in main.asm):

         

            ;Process Left Channel   (left input sample is in a)       

                move    #>Switch_1,r6           ; point to x:mem (switch states)

                move    #>Filter_1_K,r4         ; point to x:mem (coefficients)

                move    #>Filter_1_A_Left,r3    ; point to y:mem (filter mem)

                bsr     TwoBand_EQ              ; input in a, output in a

                move    a,y:LeftOutput


            ;Process Right Channel  (r6 is currently pointing to Switch 1)        

                move    y:RightInput,a          ; load right input sample in a

                move    #>Filter_1_K,r4         ; point to x:mem (coefficients)

                move    #>Filter_1_A_Right,r3   ; point to y:mem (filter mem)

                bsr     TwoBand_EQ              ; input in a, output in a

                move    a,y:RightOutput

         

        The simplest pass-through example is to replace the above code with:

           ;Process Left Channel 

               move y:LeftInput,a

                nop ; replace with left audio processing

                move    a,y:LeftOutput


            ;Process Right Channel        

                move    y:RightInput,a

                nop ; replace with right audio processing

                move    a,y:RightOutput

        (The first move and nop are actually unnecessary, since the left input sample happens to be in a at that point already.)  If you also delete everything below the following lines, you have a simple pass-through template you can use as a starting point:
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        ; Common Subroutines
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        While testing stuff out, I often make one channel a pass-through to use as a reference on an oscilloscope.

          • RedPandaCurt Just Startin' 23 posts since
            Oct 30, 2009
            Currently Being Moderated
            Jun 24, 2010 6:27 PM (in response to benjaminshinobi)
            Re: n00b question (starting the main loop)

            To really understand what's going on, you should download the DSP56300 Family Manual.  Section 2.3.2 "Exception Processing State (Interrupt Processing)" of the DSP56300 Family Manual describes the interrupt vectors, and chapter 11 describes the startup procedure and memory map.  Table 2-2 on page 2-7 (35 of 512 in the PDF) corresponds to vectors4.inc.

          • RedPandaCurt Just Startin' 23 posts since
            Oct 30, 2009
            Currently Being Moderated
            Jun 26, 2010 5:14 AM (in response to benjaminshinobi)
            Re: n00b question (starting the main loop)


            Does it just go to whatever is in p memory first?

             

            Essentially, yes.  The hardware reset vector is the first entry in the vector table and the vector table is at p:0.  In your first message you mentioned jumping to the main loop.  If you set the reset vector to jump to LOOP (instead of START), I think you'd be skipping the code that sets up the SHI communication with the microcontroller.  The microcontroller is what controls the LED, so you wouldn't see anything happen.  One other trick is that turning on LED_Red in the DSP code will only cause the LED to glow faintly, so if that's what you are doing to test your code, you won't see what you expect.  Here is a workaround for that:

                 http://uk.line6.com/supportarchive/thread/45045

             

            What I would suggest is starting from the TwoBandStereoEQ just to explore, since you can start with a working example and tweak one thing at a time.  You could first manipulate the LED in the sample processing code, then move it to the main LOOP, then get rid of the sample processing code, disable ESAI interrupts, then start commenting out initialization code in the START section until you get to the bare minimum.  At that point you'll know enough to build up your own code from scratch.

More Like This

  • Retrieving data ...

Bookmarked By (0)