This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

aic3204.c and .h can anyone send me them?

Other Parts Discussed in Thread: TMS320C5515

Hi TI Community,


I am working on a project using the TMs320C5515 eZdsp USB Stick, it uses the AIC3204 codec.

I have set up some projects using the board and code composer studio v4 to test the inputs/outputs etc. All seems to be working fine.

I just have an issue with some missing files. In the projects and examples I see online people are referencing aic3204.c and aic3204.h, I don't have those files, I have found some online but most are missing the setup for gain and samples. I have searched for the files online but can't seem to find them, does anyone have them from a project they are using that they could send on this forum?


Thanks in advance!

James

  • Hi James,

    Could you be referring to the files from the C5000 Teaching ROM? Check out Chapter 20 for C5515 eZdsp.

    http://e2e.ti.com/group/universityprogram/educators/w/wiki/2040.c5000-teaching-rom.aspx

    /*****************************************************************************/
    /*                                                                           */
    /* FILENAME                                                                  */
    /* 	 aic3204.c                                                               */
    /*                                                                           */
    /* DESCRIPTION                                                               */
    /*   Setup functions for aic3204 codec on the TMS320C5505 USB Stick.        */
    /*                                                                           */
    /* REVISION                                                                  */
    /*   Revision: 1.00	                                                         */
    /*   Author  : Richard Sikora                                                */
    /*---------------------------------------------------------------------------*/
    /*                                                                           */
    /* HISTORY                                                                   */
    /*                                                                           */
    /*   Revision 1.00                                                           */
    /*   20th December 2009. Created by Richard Sikora from Spectrum Digital     */
    /*                       code. Created new functions for codec read          */
    /*                       and write.                                          */
    /*                                                                           */
    /*****************************************************************************/
    /*
     *
     * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
    */
    
    
    #include "usbstk5505.h"
    #include "aic3204.h"
    #include "usbstk5505_gpio.h"
    #include "usbstk5505_i2c.h"
    
    Int16 counter1; // Counters for monitoring real-time operation.
    Int16 counter2;
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  _AIC3204_rget( regnum, regval )                                         *
     *                                                                          *
     *      Return value of codec register regnum                               *
     *                                                                          *
     * ------------------------------------------------------------------------ */
    Int16 AIC3204_rget(  Uint16 regnum, Uint16* regval )
    {
        Int16 retcode = 0;
        Uint8 cmd[2];
    
        cmd[0] = regnum & 0x007F;       // 7-bit Device Address
        cmd[1] = 0;
    
        retcode |= USBSTK5505_I2C_write( AIC3204_I2C_ADDR, cmd, 1 );
        retcode |= USBSTK5505_I2C_read( AIC3204_I2C_ADDR, cmd, 1 );
    
        *regval = cmd[0];
        USBSTK5505_wait( 10 );
        return retcode;
    }
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  _AIC3204_rset( regnum, regval )                                         *
     *                                                                          *
     *      Set codec register regnum to value regval                           *
     *                                                                          *
     * ------------------------------------------------------------------------ */
    Int16 AIC3204_rset( Uint16 regnum, Uint16 regval )
    {
        Uint8 cmd[2];
        cmd[0] = regnum & 0x007F;       // 7-bit Device Address
        cmd[1] = regval;                // 8-bit Register Data
    
        return USBSTK5505_I2C_write( AIC3204_I2C_ADDR, cmd, 2 );
    }
    
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  aic3204_enable( )                                                       *
     *                                                                          *
     * ------------------------------------------------------------------------ */  
    
    void aic3204_hardware_init(void)
    {
     	SYS_EXBUSSEL |= 0x0020;  // Select A20/GPIO26 as GPIO26
    	USBSTK5505_GPIO_init();
    	USBSTK5505_GPIO_setDirection(GPIO26, GPIO_OUT);
    	USBSTK5505_GPIO_setOutput( GPIO26, 1 );    // Take AIC3204 chip out of reset
    	USBSTK5505_I2C_init( );                    // Initialize I2C
    	USBSTK5505_wait( 100 );  // Wait  
    }
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  aic3204_disable( )                                                      *
     *                                                                          *
     * ------------------------------------------------------------------------ */
    
    void aic3204_disable(void)
    {
        AIC3204_rset( 1, 1 );                   // Reset codec
      	USBSTK5505_GPIO_setOutput( GPIO26, 0 ); // Put AIC3204 into reset
        I2S0_CR = 0x00; 
    }
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  aic3204_codec_read( )                                                   *
     *                                                                          *
     * ------------------------------------------------------------------------ */
    
    void aic3204_codec_read(Int16* left_input, Int16* right_input)
    {
    	volatile Int16 dummy;
    	
    	counter1 = 0;
    	
    	/* Read Digital audio inputs */
        while(!(I2S0_IR & RcvR) )
        {
        	counter1++; // Wait for receive interrupt
        }	
    	
        *left_input = I2S0_W0_MSW_R;         // Read Most Significant Word of first channel
         dummy = I2S0_W0_LSW_R;              // Read Least Significant Word (ignore) 
        *right_input = I2S0_W1_MSW_R;        // Read Most Significant Word of second channel
         dummy = I2S0_W1_LSW_R;              // Read Least Significant Word of second channel (ignore)
     	        
    }
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  aic3204_codec_write( )                                                  *
     *                                                                          *
     * ------------------------------------------------------------------------ */
     
    void aic3204_codec_write(Int16 left_output, Int16 right_output)
    {
    	counter2 = 0;
    	
        while( !(I2S0_IR & XmitR) )
        {
       	counter2++; // Wait for transmit interrupt
        }	
    	I2S0_W0_MSW_W = left_output;         // Left output       
        I2S0_W0_LSW_W = 0;
        I2S0_W1_MSW_W = right_output;        // Right output
        I2S0_W1_LSW_W = 0;
    }
    
    /* ------------------------------------------------------------------------ *
     *                                                                          *
     *  End of aic3204.c                                                        *
     *                                                                          *
     * ------------------------------------------------------------------------ */
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    6813.aic3204.h

    Reagrds,
    Mark

  • Hi Mark,

    Thanks so much for your quick reply, I was looking for the aic3204.c and .h files with a function to change the gain and samples too. I'm trying to read in signals from an electric guitar, it works fine for line in but I get nothing when I just plug a guitar in, so I think I need to up the gain in, I tried to do this by changing the register values on 59 and 60 but with no luck.

    Do you have a version of the teaching ROM for the 5515 instead of 5505? I looked at the link and chapter 9 would work very well but won't compile ("error 5369 this XAR may corrupt the upper 7 bits..." and a couple of error 9999) I'm assuming because it's a miss match of 5505 to 5515.

    Thanks,

    James

  • James,

    The C5505 Teaching ROM was intended for C5505 and C5515 eZdsps.

    Both C5505 eZdsp and C5515 eZdsp share the same audio codec and it is on the same I2S port, so examples that run on the C5505 should run on the C5515 also.

    Chapter 20 is specifically for C5515 eZdsp - it uses its OLED display, which is not present on C5505 eZdsp

    In this teaching ROM the project files must be created manually, then files imported. See Chapter 1 for specific project settings like ptrdiff_size = 32 and memory model = huge.

    Anyway, I have created the project files in the attached zip. Try it out.

    Screen shots show CCS5.5 project settings for ptrdiff_size = 32 and memory model = huge

    Hope this helps,
    Mark

    1462.CH9 Guitar Effects.zip

  • Hi Mark,


    I am getting errors about a missing make file, is this due to me having code composer v4? Should I upgrade to the latest version? or go for v5?

    Will my ccsv4 still work if I get v5 too?

    Thanks for your help!

    James

  • Hi Mark,

    So I've downloaded and installed ccsv5.5 and the project you sent complies fine! I can't seem to find the board support library for the 5515 board, could you offer any guidance?

    Thanks again,

    James

  • Hi Mark,

    Another update, I've added the support libraries, and it seems to be working (sort of) I can connect with the board and run the code, it works when I connect a laptop to the line in and play some music, but it won't work with a guitar plugged in, I increased the gain to 48, still no luck, any tips? anything I'm missing?

    Cheers,

    James

  • James,

    It is here: http://support.spectrumdigital.com/boards/usbstk5515/

    You may also find the chip support library useful: http://www.ti.com/tool/sprc133 (get C55XCSL-LOWPOWER)

    Gain is discussed in Chapter 2 - check the PPT slides.

    main.c calls set_sampling_frequency_and_gain()

    •Modify the following #defines in main.c:

    #define SAMPLES_PER_SECOND 48000
    #define GAIN_IN_dB         20

    GAIN_IN_dB should be less or equal to than 48.

    Hope this helps,
    Mark

  • Hi Mark,


    I already tried to change the ADC gain up to 48. I looked through the power point that came with chapter 9 but it doesn't give any more pointers, are there any other things you would suggest? I would look into putting the headphone volume up but I can't get any signal at all from a guitar input so I think this would be futile?


    Do you have anymore pointers?

    Thanks for your help so far, once I get a guitar signal in and out of this board I'll be no more bother! I feel like it must just a simple setting now.

    James

  • Hi Mark/Anyone else,

    Thanks for you help so far, it has been very useful. Just in-case anyone else runs into a similar issue, I solved my problem somewhat just by driving my guitar signal through a unity gain op amp. I think the problem was due to an inconsistency with impedance on the line from the guitar and the input to the DSP board, the op-amp has very high input impedance and very low output impedance. The signal that I now get when I stream audio straight through is rather noisy and harsh, but I can try and fix that with a better op-amp circuit and some filtering on the DSP board.

    Thanks again for your help Mark,

    James

  • James,

    Thanks for sharing your solution.

    I have seen this C5505/C5515 board with Teaching ROM software used with an electric guitar before without any amplifiers. There are even slides in the Teaching ROM showing a guitar connected.

    Could it be different pickups?

    Let us know how it goes.

    Regards,
    Mark