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.

Chselect in ILEG2_DCBUS_DRV function

Expert 1800 points
Other Parts Discussed in Thread: TMS320F2812

Hi,

I need to run Phase 2 of PMSM3_1 with F2812 processor but not sure how to configure the ADCIN channels in ILEG2_DCBUS_DRV init function.  Need to change ADCIN0, ADCIN1, ADCIN6 to ADCINB1, ADCINB2, ADCINA5. 

Pl suggest.

Thx & rgds

 

  • indiantuktuk said:

    I need to run Phase 2 of PMSM3_1 with F2812 processor but not sure how to configure the ADCIN channels in ILEG2_DCBUS_DRV init function.  Need to change ADCIN0, ADCIN1, ADCIN6 to ADCINB1, ADCINB2, ADCINA5. 

    Searching the PMSM3-1 code for the string "ILEG2_DCBUS_DRV" resulted in the tidcs\DMC\c28\v32x\lib\drvlib281x\src\f281xileg_vdc.c containing the initialization routine.  If you review the f281xileg_vdc.h file in tidcs\DMC\c28\v32x\lib\drvlib281x\include directory for the ILEG2DCBUSMEAS data structure, you will see a parameter ChSelect which is used to configure which 3 ADC channels are associated with this module.

    In the f281xileg_vdc.c file, the F281X_ileg2_dcbus_drv_init() routine uses the ChSelect to setup the ADCCHSELSEQ1 register of the ADC module in the TMS320F2812.

    Look at the ADC User's Guide (SPRU060) in Section 2.5 for the definition of the ADCCHSELSEQ1 register.  You will see how this field needs to be defined in the data structure to correspond to the appropriate ADC channels.  I assume the fields CONV00, CONV01 and CONV02 need to be setup.

    ADCINB1 : 1001b
    ADCINB2 : 1010b
    ADCINA5 : 0101b

     

  • Thanks BrandonAzbell for the timely help.  Based on the understanding I modified f281xileg_vdc.h with the following definition

    typedef ILEG2DCBUSMEAS *ILEG2DCBUSMEAS_handle;
    /*-----------------------------------------------------------------------------
     Note 1 : It is necessary to call the init function to change the ADC
                register settings, for the change in the channel setting for
                ChSelect setting changes to take effect.
                The read function will not detect or act upon this change.
    -----------------------------------------------------------------------------*/
    // Default Initializer for the ILEG2DCBUSMEAS Object
    // DMC1500 + eZdsp2812: ChSelect = 0x0710
    // DMC550 + eZdsp2812: ChSelect = 0x0610
    #define ChSelect = 0x05A9;
    // Note: Assuming the base DC-bus voltage is 24 volt
    //        - ADC input for Vdc_bus range is 24*1/(24.9+1) = 0.927 volt on DMC550
    //        - Then, Vdc_bus gain = 3.0/0.927 = 3.2375 (or 0x675C in Q13)

    ====================================

    defined ChSelect as 0x05A9 which corresponds to 0000 0101 1010 1001 of the ADCCHSELSEQ1 register.

    Pl let me know if my understanding is in line with your directions.  I did complete build with the above modified header file definition and there are no errors.  Do you suggest to connect the ADC's and progress.

    thx & rgds

  • indiantuktuk said:

    Pl let me know if my understanding is in line with your directions.  I did complete build with the above modified header file definition and there are no errors.  Do you suggest to connect the ADC's and progress.

    I agree with the configuration you made.  However, just to take one small step to verify the appropriate ADC channels are getting converted and resulting in expected values, I would recommend you hookup a voltage source to each input and verify the values converted.