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/TMS320F28335: TMS320F28335

Part Number: TMS320F28335


Tool/software: Code Composer Studio

Hi !

I want to use external interface capability  to sense AC and DC voltage  values instead of ADC .....

Is it source code  correct ?

Thanks !

 void InitXintf(void)
   {
    // This shows how to write to the XINTF registers.  The
    // values used here are the default state after reset.
    // Different hardware will require a different configuration.

    // For an example of an XINTF configuration used with the
    // F28335 eZdsp, refer to the examples/run_from_xintf project.

    // Any changes to XINTF timing should only be made by code
    // running outside of the XINTF.
  EALLOW;
  SysCtrlRegs.PCLKCR3.bit.XINTFENCLK  = 1;
  EDIS;

    // All Zones---------------------------------
    // Timing for all zones based on XTIMCLK = 1/2 SYSCLKOUT
     EALLOW;
     XintfRegs.XINTCNF2.bit.XTIMCLK      = 1;
    // No write buffering
     XintfRegs.XINTCNF2.bit.WRBUFF       = 0;
    // XCLKOUT is enabled
     XintfRegs.XINTCNF2.bit.CLKOFF       = 0;
    // XCLKOUT = XTIMCLK/2
     XintfRegs.XINTCNF2.bit.CLKMODE      = 1;

    // Zone 0------------------------------------
    // When using ready, ACTIVE must be 1 or greater
    // Lead must always be 1 or greater
    // Zone write timing
     XintfRegs.XTIMING0.bit.XWRLEAD      = 3;
     XintfRegs.XTIMING0.bit.XWRACTIVE    = 7;
     XintfRegs.XTIMING0.bit.XWRTRAIL     = 3;
    // Zone read timing
     XintfRegs.XTIMING0.bit.XRDLEAD      = 3;
     XintfRegs.XTIMING0.bit.XRDACTIVE    = 7;
     XintfRegs.XTIMING0.bit.XRDTRAIL     = 3;

    // double all Zone read/write lead/active/trail timing
     XintfRegs.XTIMING0.bit.X2TIMING     = 1;

    // Zone will sample XREADY signal
     XintfRegs.XTIMING0.bit.USEREADY     = 1;
     XintfRegs.XTIMING0.bit.READYMODE    = 1;  // sample asynchronous

    // Size must be either:
    // 0,1 = x32 or
    // 1,1 = x16 other values are reserved
     XintfRegs.XTIMING0.bit.XSIZE        = 3;

    // Zone 6------------------------------------
    // When using ready, ACTIVE must be 1 or greater
    // Lead must always be 1 or greater
    // Zone write timing
     XintfRegs.XTIMING6.bit.XWRLEAD      = 3;
     XintfRegs.XTIMING6.bit.XWRACTIVE    = 7;
     XintfRegs.XTIMING6.bit.XWRTRAIL     = 3;
    // Zone read timing
     XintfRegs.XTIMING6.bit.XRDLEAD      = 3;
     XintfRegs.XTIMING6.bit.XRDACTIVE    = 7;
     XintfRegs.XTIMING6.bit.XRDTRAIL     = 3;

    // double all Zone read/write lead/active/trail timing
     XintfRegs.XTIMING6.bit.X2TIMING     = 1;

    // Zone will sample XREADY signal
     XintfRegs.XTIMING6.bit.USEREADY     = 1;
     XintfRegs.XTIMING6.bit.READYMODE    = 1;  // sample asynchronous

    // Size must be either:
    // 0,1 = x32 or
    // 1,1 = x16 other values are reserved
     XintfRegs.XTIMING6.bit.XSIZE        = 3;
    // Zone 7------------------------------------
    // When using ready, ACTIVE must be 1 or greater
    // Lead must always be 1 or greater
    // Zone write timing
     XintfRegs.XTIMING7.bit.XWRLEAD      = 3;
     XintfRegs.XTIMING7.bit.XWRACTIVE    = 7;
     XintfRegs.XTIMING7.bit.XWRTRAIL     = 3;
    // Zone read timing
     XintfRegs.XTIMING7.bit.XRDLEAD      = 3;
     XintfRegs.XTIMING7.bit.XRDACTIVE    = 7;
     XintfRegs.XTIMING7.bit.XRDTRAIL     = 3;

    // double all Zone read/write lead/active/trail timing
     XintfRegs.XTIMING7.bit.X2TIMING     = 1;

    // Zone will sample XREADY signal
     XintfRegs.XTIMING7.bit.USEREADY     = 1;
     XintfRegs.XTIMING7.bit.READYMODE    = 1;  // sample asynchronous

    // Size must be either:
    // 0,1 = x32 or
    // 1,1 = x16 other values are reserved
     XintfRegs.XTIMING7.bit.XSIZE        = 3;
    // Bank switching
    // Assume Zone 7 is slow, so add additional BCYC cycles
    // when ever switching from Zone 7 to another Zone.
    // This will help avoid bus contention.
     XintfRegs.XBANK.bit.BANK            = 7;
     XintfRegs.XBANK.bit.BCYC            = 7;
     EDIS;
   //Force a pipeline flush to ensure that the write to
   //the last register configured occurs before returning.

     InitXintf16Gpio();
// InitXintf32Gpio();

     asm(" RPT #7 || NOP");

}