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.

CCS/TMS320F28379D: Using clock on GPIO pin to work with external ADC

Part Number: TMS320F28379D
Other Parts Discussed in Thread: ADS8588S, C2000WARE

Tool/software: Code Composer Studio

Good afternoon,

I am newer to working with embedded devices and I am trying to use this device in my senior design project. We will be using an external ADC to bring the input voltages and currents. I have used a timer based interrupt to send an on and off signal which was good enough to control and LED IC. However, I would like something a bit more reliable such as an external clock to work in communicating with the ADC. Is there a way to put one of the clock signals on a pin to be used in a case like this? Thanks for any help you are able to offer. I am sure I will be making a few posts for pointers throughout my senior design project.

  • Is there a reason why you are not using the on-chip ADC?
    For the clock, have you looked at the XCLKOUT pin?
  • We are using the TI ADS8588S as the external ADC because of the many built-in features that will alleviate some of the circuits we will have to design ourselves. Also, professionally built filters and PGR will probably be much better than one designed by undergrads just starting PCB work. We are building a programmable relay for power transformer protection. I appreciate your input and I will look into the XCLKOUT pin.
  • Are there any examples that are using the XCLKOUT pin? I am trying to figure out how to set it up. Sorry for delayed reply but end of semester and final exams are taking up most of my time.

  • Currently we don't have an example, but this is fairly straight forward and could be achieved with just  a few lines of code. (Refer section 3.7.4 in SPRUHM8H)

  • I am very new to working with this device and I have read the part in the manual for how it is to be done.

    "It is sometimes necessary to observe a clock directly for debug and testing purposes. The external clock output (XCLKOUT) feature supports this by connecting a clock to an external pin, GPIO73. The available clock sources are PLLSYSCLK, PLLRAWCLK, CPU1.SYSCLK, CPU2.SYSCLK, AUXPLLRAWCLK, INTOSC1, and INTOSC2. To use XCLKOUT, first select the clock source via the CLKSRCCTL3 register. Next, select the desired output divider via the XCLKOUTDIVSEL register. Finally, connect GPIO73 to mux channel 3 using the GPIO configuration registers."

    However, being a novice and not knowing what a lot of the stuff in the manual means. Where would be the best place to start to learn the device? I have downloaded the workshop material and have been going through it. I have also performed basic programs to use interrupts and set up pins to output or input as desired. Thanks again for all the help you have provided.

  • The best place to start would be the workshop material. TI has invested considerable resources in producing the workshop. The lab examples provide excellent guidance every step of the way. And the documentation that comes with the workshop is pretty solid. Once you are done with the workshop, try out the examples that come with C2000ware. The workshop and the examples should give you a solid grounding to build up further. Good luck.
  • I am currently trying to set up the XCLKOUT and have been trying to use 

    ClkCfgRegs.CLKSRCCTL3 to set up the clock source and ClkCfgRegs.XCLKOUTDIVSEL to set the division of the clock.

    When I build the code it says ClkCfgRegs is undefined so I think my compiler is messed up 

    My include options can be found below. 

    ${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INCLUDE_PATH}
    ${PROJECT_ROOT}
    ${PROJECT_ROOT}/device
    ${C2000WARE_DLIB_ROOT}
    ${CG_TOOL_ROOT}/include

    I tried to correct this by copying the blinky project and pasting my code in it to avoid compiler include issues. However, it did not correct the problem.

  • Johnathon,

    It looks like you might have an issue with the paths for the header files. Please see the F28379D workshop at:

    processors.wiki.ti.com/.../C2000_Multi-Day_Workshop

    In module 3 you will find information about using the Peripheral Register Header Files and in Lab 5 you will find information about setting up the paths (see step 3). Note, the paths are relative using ${PROJECT_ROOT}, but you can have an absolute path too.

    I think you will find the workshop materials very useful for learning more about the device. Review the materials and try the lab exercises.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Hey Ken,
    I actually tried to do Lab 5 today while working on the workshop. I was unable to get it to run correctly getting the error.
    line 11: error #10263: RAMLS4 memory range has already been

    It appears in the File: Lab_5_6_7.cmd, there are several memory locations that are being shared.
  • Johnathon,

    I am glad to hear that you are trying the lab exercises. In lab 5 there are no modifications to the file, just inspect. Compare you Lab_5_6_7.cmd file to the solutions file in case you accidently made a change. If needed, try loading the solution project. I was able to build without any issues.

    - Ken
  • I was able to scrap all my Lab 5 files and import the solution files and get them working. I was finally able to get the headers works sort of. I got it to use the #include "F2837xD_device.h" from the lab files. That brought in a lot of warnings to the project.

    This is the code I am trying to use to get the XCLKOUT to work for testing.

    Device_initGPIO();

    //GPIO_SetupPinMux(73, GPIO_MUX_CPU1, 3); // GPIO73, CPU1 is master, mux position 3 for XCLKOUT
    GPIO_setPadConfig(73, GPIO_PIN_TYPE_STD);
    GPIO_setPinConfig(GPIO_73_XCLKOUT);
    GPIO_setDirectionMode(73, GPIO_DIR_MODE_OUT);
    GPIO_setQualificationMode(73, GPIO_QUAL_SYNC);

    EALLOW;
    ClkCfgRegs.CLKSRCCTL3.bit.XCLKOUTSEL = 0;
    ClkCfgRegs.XCLKOUTDIVSEL.bit.XCLKOUTDIV = 0;
    EDIS;

    If I don't import the "F2837xD_device.h" it is undefined in the project and if I do include it it generates a lot of warnings. It is also not generating a clock signal on GPIO pin 73 so I don't think it's working anyways. 

    Thanks for all the help I appreciate it. 

  • Johnathon,

    Try using Lab 5 as a starting point. First disable the watchdog, then modify Gpio.c:

    GpioCtrlRegs.GPCGMUX1.bit.GPIO73 = 0;
    GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 3;

    Next, add:

    EALLOW;
    ClkCfgRegs.CLKSRCCTL3.bit.XCLKOUTSEL = 0;
    ClkCfgRegs.XCLKOUTDIVSEL.bit.XCLKOUTDIV = 0;
    EDIS;

    Please let me know if this solves your problem. Also, please use the green "Verified Answer" button if your code is now working.

    - Ken
  • Good Morning Ken,

    I modified the GPIO.c file to have the lines

    GpioCtrlRegs.GPCGMUX1.bit.GPIO73 = 0;
    GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 3;

    I then added the lines

    EALLOW;
    ClkCfgRegs.CLKSRCCTL3.bit.XCLKOUTSEL = 0;
    ClkCfgRegs.XCLKOUTDIVSEL.bit.XCLKOUTDIV = 0;
    EDIS;

    Do I want the eallow lines in the same GPIO.c or do I want to add those in the Main_5.c file?

    When I run the code I am getting a high signal from pin 73 but not a clock signal I am expecting. 

  • Johnathon,

    Notice that the Gpio.c already has the EALLOW/EDIS at the top and bottom of the file. Try changing XCLKOUTDIV to /8.

    - Ken
  • Johnathon,

    Also, note that you are limited to the maximum toggling rate of the GPIO pin. Check the data sheet, it should be about 25 MHz.

    Please let me know if this solves your problem. Also, please use the green "Verified Answer" button if your code is now working.

    - Ken
  • Thanks for the help Ken, I have since found a different way to set up my own communication between the device and the external ADC. I am just toggling a GPIO pin with a timer interrupt for the desired time. I am encountering an odd behavior where the ADC is sampling at half the speed. Even after using timers in the code to see that the frequency should be correct. I have been scoping the signals sent to the ADC and they appear to be correct. The external ADC is the ADS8588S
  • Johnathon,

    As you know, using the on-chip ADC would be ideal since it has many trigger sources. From what you described, it looks like the C2000 is performing as expected and I recommend posting your question about the ADS8588S to the data converter E2E forum.

    - Ken