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.

Digital motor control Driver Library

Other Parts Discussed in Thread: DRV8412

Hi,

I wish to make multiple instances in CAP_DRIVE macro. But I think that f2803xdrvlib.h has some errors.

#ifndef  __F2803xDRVLIB_H__
#define __F2803xDRVLIB_H__


// Used to indirectly access all EPWM modules
volatile struct EPWM_REGS *ePWM[] =
       { &EPwm1Regs,   //intentional: (ePWM[0] not used)
       &EPwm1Regs,
     &EPwm2Regs,
     &EPwm3Regs,
     &EPwm4Regs,
     &EPwm5Regs,
     &EPwm6Regs,
     &EPwm7Regs,
     
      };


// Used to indirectly access eQEP module
volatile struct EQEP_REGS *eQEP[] =
       { &EQep1Regs,
        &EQep1Regs,   
      };

// Used to indirectly access eQEP module
volatile struct ECAP_REGS *eCAP[] =
       { &ECap1Regs,
        &ECap1Regs,   
      };
     
#endif // __F2803xDRVLIB_H__

 I think it should be like this..

// Used to indirectly access eCAP modules

Volatile struct ECAP_REGS *eCAP[] =

{ &ECap1Regs,  //intentional: (eCAP[0] not used)

  &ECap1Regs,

  &ECap2Regs,

  &ECap3Regs,

   &ECap4Regs,

};

Pls comment,

Regards

Raghu

  • Raghu,

    The 'F2803x device only has 1 eCAP peripheral inside it.  This is why we defined the ECAP_REGS structure as we did in f2803xdrvlib.h.


    Thank you,
    Brett

  • hello Brett Larimore

    could you tell me how to change the Coefficient kp,ki,kd  in the code of pfc+aci v1.7 kit?  in my Application,ac input is 220v,pfc output is 400v, load is ahout 100w;i found the PF value  is only 80%. i want to change the Coefficient kp,ki,kd in the current loop and volt loop ,but i do not know to change the current loop first or change the volt loop first ,or change them together? 

  • Dear Brett,

    Do we have  a driver lib for f28069?

    Thanks,

    Raghu.

  • ge xijie,
    I would recommend starting your own thread.

    Raghu,
    Unfortunately, we do not have a motor driver library specifically for the 'F2806x series of devices.  The 'F28035 set of drivers will be compatible so I would recommend using those if possible.  The only thing to note is that the 'F28035 driver library will not take advantage of the floating point unit on the 'F2806x device.


    Thank you,
    Brett

  • Dear Brett,

    I tried using the CAP_EVENT_DRV (cap_event_drv.pdf) as given in the folder f2803x_v1.1(as this is the lib used in 2xDC.motor example code for DRV8412 experimenter kit)

    main()

    {

    CAP_INIT_MACRO(cap1); // Call init macro for cap1

    }

    void interrupt periodic_interrupt_isr()

    {

    Uint16 Status;

    Uint32 EventPeriod;

    status = CAP_MACRO(cap1); // Call the capture read macro

    // if status==1 then a time stamp was not read,

    // if status==0 then a time stamp was read

    if(status==0)

    {

    EventPeriod=(int32)(cap1.EventPeriod); // Read out new time stamp

    }

    }

    The following errors were reported on build.

    1. Variable not declared status.

    So, I changed it to Status.

    2. Error expression.

    This macro does not return any value.   ( I am not good in writing macros) 

    So,I changed it like this

    Status = (int16)(cap1.CapReturn);  //  This works.

    I had seen the f2803xcap.h header file & think that the event flag bit must be cleared after each read...

    So that we know pulses are continously arriving at cap pin.

    #define CAP_MACRO(v)                                                                                                                                                    \
        if(ECap1Regs.ECFLG.bit.CEVT1 != 0)/* Check status of one entry of first event of ECAP1 pin */                   \
        {                                                                                                                                                                                            \
        v.EventPeriod = ECap1Regs.CAP1;  /* Stamp the timer counter difference between two edges detected*/ \
        v.CapReturn=0;                   /* Then, return zero*/                                                                                                         \

           EALLOW;                       /* Enable EALLOW */                                                                                                              \
           ECap1Regs.ECFLG.bit.CEVT1 = 0      /* Clear event1 flag*/                                                                                  \
           EDIS;                         /* Disable EALLOW */                                                                                                                \    
        }                                                                                                                                                                                            \
        else                                                                                                                                                                                     \
        {                                                                                                                                                                                            \
        v.CapReturn=1;                   /* Else, return one */                                                                                                          \
        } 

    Pls comment.

    Kind regards

    Raghu.

  • Hi,

    I connected a sensor generating a square wave of 600khz to 700khz(0 - 3volts) to pin1 of J3 connector of DRV8412EVM with f2803x control card. I have used the

    above said capture library to get the Event period value. The results I got was not as expected.

    1. The Cap1.EventPeriod value on the real time debugger showed 11 - 12 counts . some times it displayed a value 78

    2. So I opened the CAP1, CAP2, CAP3, CAP4 registers in the watch window. to my surprise I found only CAP1 register got updated. 

    The above reading was got with the default setting provided in the macro.

    3. I then changed the prescaler / filter to 2  from 1 & found that the now the display showed a constant count value of 89. Even then

    no updates where seen on CAP2,3,4. all showing 0.

    Why was it not possible to see CAP2,3,4 values on the debugger watch window as they should get latched on the rising edge of pulses?

    Any ideas?

    Note :

    The Cap macro is configured as CAPTURE_MODE, CONTINUOUS_MODE, CAPLDEN_ENABLE, CTRRST1_DIFFERENCE_TS, EVTFLTPS_DIFFERENCE_TS

    & CAP1POL_RISING_EDGE(DEFAULT)

    SYSTEM CLOCK SPEED 60MHZ.

    Regards

    Raghu.