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/LAUNCHXL-F28027: BOOSTXL-C2KLED

Part Number: LAUNCHXL-F28027
Other Parts Discussed in Thread: CONTROLSUITE, BOOSTXL-C2KLED

Tool/software: Code Composer Studio

In most PWMdriver used in the Digital Power Library like PWM_DualUpDwnCnt_CNF(int16 n, int16 Period, int16 Mode, int16 Phase), what is that "n" referring to?

I am using BOOSTXL-C2KLED (C:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\LED_Boost_PC) and in the code, the PWM setup is (LED_Boost_PC_Main.c):

PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
PWM_DualUpDwnCnt_CNF(2, prd, 0, 400);
PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400);

while in the ISR (LED_Boost_PC_ISR.asm), it is:

PWMDRV_DualUpDwnCnt_INIT 1 ; EPWM1AB
PWMDRV_1ch_UpDwnCnt_INIT 2 ; EPWM2A

The docs in C:\ti\controlSUITE\libs\app_libs\digital_power\f2802x_v3.5\Doc\DPLib.pdf doesn't explain this in detail.

regards,

Victor

  • I am comparing this with the similar hardware TMDSRGBLEDKIT ( C:\ti\controlSUITE\development_kits\Multi-DCDC-Color-LED-Kit_v1.0\LED-ColorMix_v1_0 )

    the Main.c (LED-ColorMix-Main.c) is :

    PWM_2ch_UpCnt_CNF(1, prd, 1, 0);
    PWM_2ch_UpCnt_CNF(2, prd, 0, 2);
    PWM_2ch_UpCnt_CNF(3, prd, 0, 2);
    PWM_2ch_UpCnt_CNF(4, prd, 0, 2);

    and the ISR.asm (LED-ColorMix-ISR.asm) is :

    PWMDRV_2ch_UpCnt_INIT 1 ; EPWM1AB
    PWMDRV_2ch_UpCnt_INIT 2 ; EPWM2AB
    PWMDRV_2ch_UpCnt_INIT 3 ; EPWM3AB
    PWMDRV_2ch_UpCnt_INIT 4 ; EPWM4AB

    so it got me confused.
  • Hello I have modified the BOOSTXL-C2KLED (C:\ti\controlSUITE\development_kits\C2000_LaunchPad\f2802x_examples\LED_Boost_PC\LED_Boost_PC_Main.c):

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    // PWM_DualUpDwnCnt_CNF(2, prd, 0, 400); orig
    PWM_1ch_UpDwnCnt_CNF(2, prd, 0, 400); // PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400); // orig

    seems to be working still...

    Any explanation for this?
  • Hello

    I used PWM_DualUpDwnCnt_CNF both on PWM1-2 and added Duty4 on open loop config

    LED_Boost_PC_Main.c

    long Duty4=0; // Open-loop duty
    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 0);
    PWMDRV_DualUpDwnCnt_Duty2A = &Duty3;
    PWMDRV_DualUpDwnCnt_Duty2B = &Duty4;
    extern long *PWMDRV_DualUpDwnCnt_Duty2A;
    extern long *PWMDRV_DualUpDwnCnt_Duty2B;


    LED_Boost_PC_ISR.asm

    PWMDRV_DualUpDwnCnt_INIT 1 ; EPWM1AB
    PWMDRV_DualUpDwnCnt_INIT 2 ; EPWM2AB

    PWMDRV_DualUpDwnCnt 1
    PWMDRV_DualUpDwnCnt 2

    I even used PWM_DualUpDwnCnt_CNF and PWM_1ch_UpDwnCnt_CNF

    LED_Boost_PC_Main.c

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    PWM_1ch_UpDwnCnt_CNF(2, prd, 0, 0);
  • Victor,

    I am struggling to keep up with your replies. Do you have the kit working to your satisfaction now? You clicked that the thread has been resolved. Please let me know if you have a specific question.

    To answer your original question, the 'n' in functions like PWM_DualUpDwnCnt_CNF(int16 n, int16 Period, int16 Mode, int16 Phase) is used as a way to abstract the ePWM number and therefore keep the 'driver' function generic and not coded to any specific ePWM module.


    Thanks,
    Mark
  • Hello Mark,

    So I still have the same confusion.
    Why is that in BOOSTXL-C2KLED it was declared as shown below.

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 400);
    PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400);

    While in TMDSRGBLEDKIT

    PWM_2ch_UpCnt_CNF(1, prd, 1, 0);
    PWM_2ch_UpCnt_CNF(2, prd, 0, 2);
    PWM_2ch_UpCnt_CNF(3, prd, 0, 2);
    PWM_2ch_UpCnt_CNF(4, prd, 0, 2);

    regards,

    Victor
  • Victor,
    These are two separate development kits. Naturally, they will have different Hardware, and as such, the configuration code will be different.

    Other than that they are different, what is causing your confusion between the different declarations?

    -Mark
  • Hello Mark,

    BOOSTXL-C2KLED is using PWM1AB and PWM2A (only B not used). While TMDSRGBLEDKIT is using PWM1-4AB.
    So my understanding would be:

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0); // PWM1A
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 400); // PWM1B
    PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400); // PWM2A

    In BOOSTXL-C2KLED can you declare PWM_DualUpDwnCnt_CNF also for PWM1B?
  • Victor,

    Please look at the Function definitions of the functions you provided.
    Looking at PWM_DualUpDwnCnt_Cnf.c, the Description of the function clearly states that this will configure both channel A and channel B of the EPPWM provided.
    for example, PWM_DualUpDwnCnt_CNF(1,prd,1,0) will configure both EPWM1A and EPWM1B.

    The PWM_1ch_UpDwnCnt_CNF Function (defined in PWM_1ch_UpDwnCnt_Cnf.c) will only configure the A channel of the EPWM.

    Thanks,
    Mark
  • Hello Mark,

    That is how I understand it.
    However looking at the code (with the comments how I understand it).

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0); // PWM1(A&B)
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 400); // PWM2(A&B)
    PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400); // PWM3A

    But if you look at the HW (BOOSTXL-C2KLED ), it is only using PWM1(A&B) and PWM2A.

    Furthermore, if you look at the ISR (LED_Boost_PC_ISR.asm), it is:

    PWMDRV_DualUpDwnCnt_INIT 1 ; EPWM1(A&B)
    PWMDRV_1ch_UpDwnCnt_INIT 2 ; EPWM2A

    So both the main.c and isr.asm are not in sync.

    So my comment in e2e.ti.com/.../2519328 says, either use PWM_DualUpDwnCnt_CNF on PWM1-2(A&B), or PWM_DualUpDwnCnt_CNF for PWM1(A&B) and PWM_1ch_UpDwnCnt_CNF for PWM2A

    if using both PWM_DualUpDwnCnt_CNF on PWM1-2, edit as follows:

    LED_Boost_PC_Main.c

    long Duty4=0; // added Open-loop duty for PWM2B
    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 0);
    PWMDRV_DualUpDwnCnt_Duty2A = &Duty3;
    PWMDRV_DualUpDwnCnt_Duty2B = &Duty4;
    extern long *PWMDRV_DualUpDwnCnt_Duty2A;
    extern long *PWMDRV_DualUpDwnCnt_Duty2B;

    LED_Boost_PC_ISR.asm

    PWMDRV_DualUpDwnCnt_INIT 1 ; EPWM1AB
    PWMDRV_DualUpDwnCnt_INIT 2 ; EPWM2AB

    PWMDRV_DualUpDwnCnt 1
    PWMDRV_DualUpDwnCnt 2


    if using PWM_DualUpDwnCnt_CNF on PWM1AB and PWM_1ch_UpDwnCnt_CNF on PWM2A, edit as follows:

    LED_Boost_PC_Main.c

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0);
    PWM_1ch_UpDwnCnt_CNF(2, prd, 0, 0);

    is my understanding and edit to the code above are correct?
  • Victor,

    It seems that your understanding is in line with what the code shows. I don't know what you are trying to do specifically, but you can use any of the functions however you need to use them. The Hardware is different, so porting code between the two will required changes in pin and other configurations. Feel free to modify the code and initialization as you need to. your final statements look fine to me.

    -Mark
  • Hello Mark,

    Just would like to confirm again.
    Were there some errors in the code for BOOSTXL-C2KLED?

    In main.c the codes are:

    PWM_DualUpDwnCnt_CNF(1, prd, 1, 0); // PWM1(A&B)
    PWM_DualUpDwnCnt_CNF(2, prd, 0, 400); // PWM2(A&B)
    PWM_1ch_UpDwnCnt_CNF(3, prd, 0, 400); // PWM3A

    But if you look at the HW (BOOSTXL-C2KLED ), it is only using PWM1(A&B) and PWM2A.

    And in ISR (LED_Boost_PC_ISR.asm), it is:

    PWMDRV_DualUpDwnCnt_INIT 1 ; EPWM1(A&B)
    PWMDRV_1ch_UpDwnCnt_INIT 2 ; EPWM2A

    main.c and isr.asm doesn't see to tally.
  • Victor,

    it does look like there is some extra configuration done for EPWM2B and EPWM3A. I don't see anywhere else in the code where those are used, nor are they used in the HW. Feel free to cut that out and test if it works. i am not sure if we will fix the SW in a future release, but I will file a ticket to look into it.

    -Mark