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.

[C6713] Analog Output Question

Other Parts Discussed in Thread: TMS320C6713B, CCSTUDIO

Hello,

I am using the 6713 to filter some audio and I would like to output the result via line out (since I can't figure out if I can use any of the digital I/O ports).  The result of my filtering is a 12 bit word (four groups of 3-bits), and I am converting that to an analog signal, but I am not sure if line out can output a 4 channel signal, if that makes sense. 

Any thoughts?

Thanks.

EDIT: I think this issue can be avoided if there is a way to use GPI/O, I guess on the J1 peripherals, but I don't know if I that can be done.

EDIT: Can we access the GP I/O pins on J1?

 

  • Which hardware platform are you referencing?
    Is it the C6713 DSK from Spectrum Digital?  I assume so, as there is a J1 connector on the DSK6713.

    Do you need this data as parallel 12-bits?
    Or is there a possibility of using a serial interface like the McASP from the HPI/McASP interface which goes to J1?

  • Hi,

    It is indeed the C6713 DSK.  The J1 connector has 16 GP I/O pins, which are what I'm trying to output my data to.  It needs to be parallel, so that all the outputs "make" a single 12 bit word, so to speak.

    The main problem is that I don't know how to configure the board to be able to use those GP I/O pins and none of the literature seems to be of much help, at least none that I've found.

  • UR_PS said:

    It is indeed the C6713 DSK.  The J1 connector has 16 GP I/O pins, which are what I'm trying to output my data to.  It needs to be parallel, so that all the outputs "make" a single 12 bit word, so to speak.

    The HPI pins, which have 16-data data lines on J1, is not a General Purpose I/O.  The HPI allows for an external host to use this interface to access the C6713's memory.  This interface is mastered by the external host.

    There are 10 General Purpose I/Os multiplexed with some of those signals, but not all 16.  HD[15:8] map to GP[15:8], and HD[7] maps to GP[3] as well as HD[4] maps to GP[0].
    So you could get 10 bits of parallel data using General Purpose I/O functions of these pins.

     

    UR_PS said:

    The main problem is that I don't know how to configure the board to be able to use those GP I/O pins and none of the literature seems to be of much help, at least none that I've found.

    The C6713 datasheet found on the Product Folder provides information on the register definition for the GPIO.  It also discusses how to configure those pins to either be the HPI interface, or the GPIO and McASP.

  • Are you required to use GPIO lines (or the J1 header specifically) for this parallel interface? J4 is the external memory interface which includes the EMIF pins. The EMIF is a parallel bus typically used to connect to an external memory (or slave device). Depending on exactly what you are trying to do with this application you could simply write to one of the chip enable spaces on the EMIF and use those pins as your outputs.

  • The reason I'd like to use the GPIO lines is that I am filtering audio and the results of the filtering control the behavior of an external source (some LEDs).  I was looking at converting the results of the filter back to an analog signal, but only to have to digitize that, and with a 5 V reference, it requires a fairly accurate ADC (since I'm only using 12 bits, well 10 if there are really only 10 GPIO lines).  It sounds like using the GPIO lines is somewhat complicated since they are multiplexed and so I'd have to configure them in software, as well as using external pullup/pulldown resistors.

  • I didn't realize you are attempting to drive LEDs with these GPIOs.  Based on the earlier post, you can configure 8 HPI data lines as GPIO and use the GPIO module to control them.
    Now you are left with the other 4.

    The McASP interface, which is also multiplexed on the HPI and goes to J1, can be configured in a General Purpose I/O mode as well.  This is detailed in the TMS320C6000 DSP Multichannel Audio Serial Port (McASP) Reference Guide (SPRU041) in Section 2.8 found on the TMS320C6713B Product Folder.

    I originally did not highlight this as it is not quite as convenient as writing a single value to a GPIO data register, but you will need to split the 12-bit value.  However, it should still be capable of accomplishing your goal.

  • Brandon,

    Thanks for the reply.  If I can use digital outputs, then I will only need a total of 8 outputs.  I won't be driving the LEDs directly, there will be be a separate power supply for them. 

    Would you reccommend using the HPI data line if all I need is 8 lines or would it be easier to implement with the McASP interface (granted they are both on J1)?

    Thanks.

  • UR_PS said:

    Would you reccommend using the HPI data line if all I need is 8 lines or would it be easier to implement with the McASP interface (granted they are both on J1)?

    If you only need 8, I would think it would be easier to use the HPI data lines.

  • Ok.  The data sheet, section 3.3.3, lists the pins for J1, and there are 12 listed as GPO.  From reading the data sheet, I think I'll skip using GP0 since it serves as a control for different types of function.

    In order to enable the GPIO pins, the DC_DET pin on the connector which directly maps into the HPI_EN(HD14) on the DSP should be externally pulled down to GND, which is easy to do and is not what I'm concerned about.

    My biggest point of confusion is setting up the regiesters (GPEN, GPDIR and GPVAL) in my code because, by default, the HPI pins are
    enabled and the GPIO pins are disabled I imagine I have to enable them (set the lower 16 bits of GPEN and GPDIR to 1...1), and then use assign values to GPVAL later in my code.  I have a bunch of "If" statement that compare the filtering result to a running average, for example:

    If Y0 > Ave

    set [GP1: GP2] to 11

    If Y0=Ave

    set [GP1:GP2] to 10

    ....

    Are there examples of code that use the GPIO that you know of?

    Thanks again.

  • So I think I have the code written correctly, but I am not initializing the registers correctly, so I can't compile.  I have:

    #include <csl_gpio.h>
    #include <csl_gpiohal.h>

    and then in main():

     GP1EN = 1;

    GP2EN = 1;

    GP1DIR = 1;

    GP2DIR = 1;

    and then later, in the ISR:

        if(y0 == 0){    //compare to average
            //outputWord += 0x0 << 0;
            GP1VAL = 0;

     

    _________________________

    I also tried:

    GPEN.[2:1] = 1;

    I guess I have to delcare more things, but I don't know what or where they would go.  Any idea?

     

    I am going to change it so I use bits 4, 5, 8, 9, 10, 11, 12, 13 (I only included a snippet of code above) since HD14 has to be tied to ground to enable the GPIO?

  • You should probably either read through those header files if you want to access these registers directly or look at the CSL API Reference Guide if you want to take advantage of those functions. I am not sure why you are using those symbol names (e.g. GP1EN).

  • On page 39/148 of this document:

    http://focus.ti.com/lit/ds/symlink/tms320c6713.pdf

    it states:

    GPxEN = 1: GP[x] pin enabled

    GPxDIR = 1: GP[x] pin is an output

  • Unfortunately the register names do not directly match up with the variable names used in the CSL. Take a look at the material I mentioned before as this should with using the CSL to program the GPIO.

  • hmmm, ok, well I am missing something then.  All I see in the csl_gpiohal.h file

      #define  GPIO_GPEN_GPXEN_OF(x)         _VALUEOF(x)

      #define  GPIO_GPEN_OF(x)               _VALUEOF(x)

    In the csl_gpio.h file they list these:

    #define GPIO_PIN0          0x00000001u

    ...

    #define GPIO_PIN31         0x80000000u

    but when I put (in main()), for example:

    GPIO_PIN8 = 1;

    I get an error saying "expression must be a modifiable lvalue"

    So I don't know what to do.

     

    Do I have to use:

    GPIO_config()?

    If so, what arguments do I put in the function?  I know it has to be (GPIO_Handle hGpio,GPIO_Config *config), but I don't know what those mean.

    EDIT:  If I were to follow this example:

    GPIO_Config MyConfig = {
      0x00000031, /* gpgc */
      0x000000F9, /* gpen */
      0x00000070, /* gdir */
      0x00000082, /* gpval */
      0x00000000, /* gphm */
      0x00000000, /* gplm */
      0x00000030  /* gppol */
      };
    ...
    GPIO_config(hGpio,&MyConfig);

    How would I change those hex values to enable pins [15:8] as outputs?

  • I think what you are looking for is something like this:

    #define GPEN (*(int *)0x01B00000)

    void someFunction(){
       GPEN = somevalue;
    }
    But this completely bypasses the CSL altogether. If you were to use the CSL it would look something like this:

    GPIO_Handle hGpio;
    GPIO_Config MyConfig ={
    GPGC Value,
    GPEN Value,
    GPDIR Value,
    GPVAL Value,
    GPHM Value,
    GPLM Value,
    GPPOL Value
    };

    hGpio = GPIO_open(GPIO_DEV0, GPIO_OPEN_RESET); //Open the GPIO module
    GPIO_config(hGpio, &MyConfig); //Configure GPIO registers
    This will configure the values you specify in the MyConfig structure.

    *edit* You need to look at the GPIO module and understand how peripheral works before trying to program the registers. For example, the GPEN register is described on page 90 of the datasheet. You can see that each GPxEN bit corresponds to the same GPIO pin. For example, GP1EN corresponds to the GP1 pin. Once you make this connection you should then be able to figure out what value to use for GPEN inside the config structure.

  • Tim,

    The code has been extensively worked on, it now compiles without any errors, but when I go to Build, during the Linking process, I think, it crashes and says that all the variables that have been used to set up the GPIO are undefined symbols.  I have all the correct libraries included, so I don't think I should have linking issues.  Ideas?

  • I looked through the Build Options and I tried changing a lot of things, but still no luck.  There are a lot of settings that I don't know what they do as well.  The solution has to be something in the Build Options. 

    Help?

  • Fundamentally, the linker is unable to find the definition of the labels it is reporting.  Where are these labels you are using defined?  You need to make sure if they are in some .c file that the .c file is compiled and included in the project.  If they are in a library, you must indicate to the linker where the library is found and what the name is.

  • All the GPIO labels are defined in  csl_gpio.h and csl_gpiohal.h.  While they appear to be under Documents, Code Composer indicates that they are, in fact, in the project.  I checked all my files to see if everything that was crosslisted was included, and they are.  The thing is that this project had no problem Building prior to this GPIO implementation, so that limits what could be missing, but I can't figure it out.  I really appreciate your help so far.

  • Would making a specific Link Order change anything?

  • Would you be able to copy-and-paste the symbols that are not defined as seen by the linker report?

  • Absolutely, here they are:

    ---------------------------  stereoloop.pjt - Debug  ---------------------------
    [Linking...] "C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -@"Debug.lkf"
    <Linking>

    undefined                        first referenced
     symbol                              in file
    ---------                        ----------------
    _GPIO_GPVAL_GP4VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP6DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP3EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP1HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP1VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP3LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP8HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP3DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP8VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP4EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP2HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP4LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP5VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP7DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP5EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP3HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP2VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP5LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP4DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP6EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP4HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP1DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP6LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP6VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP8DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP7EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP5HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP3VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP7LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP5DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP1EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP1LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP8EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP6HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPDIR_GP2DIR_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP8LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPVAL_GP7VAL_OF            C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPEN_GP2EN_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPLM_GP2LM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    _GPIO_GPHM_GP7HM_OF              C:\Documents and Settings\me\My Documents\VS\stereoloop\stereoloop\Debug\stereoloop2.obj
    >>   error: symbol referencing errors - './Debug/stereoloop2.out' not built

    >> Compilation failure

    Build Complete,
      2 Errors, 0 Warnings, 0 Remarks.

  • I'm surprised the compiler doesn't complain about these.  I don't see any of these macros defined in the header files of the CSL.

    What I do find is GPIO_GPEN_GPXEN_OF.  You have replaced the X with a number and I don't think that is the intention.

    As Tim had mentioned, there is a User's Guide for the CSL at the Product Folder.  The document is TMS320C6000 Chip Support Library API Reference Guide (SPRU401).