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.

Cannot see PWM output on pin PF1,PF2, PF3 on TIVA C Connected Launchpad 1294 XL

Hello,

I am trying since many months to obtain at least 4-8 PWM outputs from my connected Launchpad.

I am using the TI-RTOS example PWMLED to construct a project according to my needs. The aim is to have 4 PWM outputs to control the 4 motors of a Quadcopter.

I have followed all the recommendations of a post made by Emmanuel which explains how to create many instances of PWM . I test my PWM output by connecting the output pin PF0 to a ESC then to a motor. At present, I get the motor running well on PF0, but not on PF1.

Here I paste the modifications I done to the three files EKTM4C1294XL.c, EK_TM4C1294XL.h, Board.h and pwmled.c. I don't know if its possible for me to send the whole project. But its very simple - load the example project from TI resource explorer and do the modifs below.

I would highly appreciate if someone can identify what is missing for me to get the same output as I am obtaining on PF0 similary on PF1, PF2, PF3 and PF4

---------------------------------------------------------(EKTM4C1294XL.c)------------------------------------------

PWMTiva_Object pwmTivaObjects[EK_TM4C1294XL_PWMCOUNT];

/* PWM configuration structure */

const PWMTiva_HWAttrs pwmTivaHWAttrs[EK_TM4C1294XL_PWMCOUNT] = {

{

PWM0_BASE,

PWM_OUT_0,

PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN

},

{

PWM0_BASE,

PWM_OUT_1,

PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN

},

{

PWM0_BASE,

PWM_OUT_2,

PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN

},

{

PWM0_BASE,

PWM_OUT_3,

PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN

}

};

const PWM_Config PWM_config[] = {

{&PWMTiva_fxnTable, &pwmTivaObjects[0], &pwmTivaHWAttrs[0]},

{&PWMTiva_fxnTable, &pwmTivaObjects[1], &pwmTivaHWAttrs[1]},

{&PWMTiva_fxnTable, &pwmTivaObjects[2], &pwmTivaHWAttrs[2]},

{&PWMTiva_fxnTable, &pwmTivaObjects[3], &pwmTivaHWAttrs[3]},

{NULL, NULL, NULL}

};

/*

* ======== EK_TM4C1294XL_initPWM ========

*/

void EK_TM4C1294XL_initPWM(void)

{

/* Enable PWM peripherals */

SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);

/*

* Enable PWM output on GPIO pins. PWM output is connected to an Ethernet

* LED on the development board (D4). The PWM configuration

* below will disable Ethernet functionality.

*/

GPIOPinConfigure(GPIO_PF0_M0PWM0);

GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0);

GPIOPinConfigure(GPIO_PF1_M0PWM1);

GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1);

GPIOPinConfigure(GPIO_PF2_M0PWM2);

GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2);

GPIOPinConfigure(GPIO_PF3_M0PWM3);

GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_3);

PWM_init();

}

---------------------------------------------------------------(EK_TM4C1294XL.h)--------------------------------------------------

typedef enum EK_TM4C1294XL_PWMName {

EK_TM4C1294XL_PWM0 = 0,

EK_TM4C1294XL_PWM1,

EK_TM4C1294XL_PWM2,

EK_TM4C1294XL_PWM3,

 

EK_TM4C1294XL_PWMCOUNT

} EK_TM4C1294XL_PWMName;

 

 

----------------------------------------------------------(Board.h)------------------------------------

#define Board_PWM0 EK_TM4C1294XL_PWM0

#define Board_PWM1 EK_TM4C1294XL_PWM1

#define Board_PWM2 EK_TM4C1294XL_PWM2

#define Board_PWM3 EK_TM4C1294XL_PWM3

 

--------------------------------------------------------------------------(PWMled.c)----------------------------------------------------------------

PWM_Handle pwm1;

PWM_Handle pwm2 = NULL;

PWM_Params params;

uint16_t pwmPeriod = 20000; // Period and duty in microseconds

uint16_t duty = 0;

uint16_t dutyInc = 100;

uint16_t dutyARM = 1000;

uint16_t dutyCALH = 2000;

uint16_t dutyCALL = 1000;

uint16_t dutyRUN = 1200;

uint16_t CAL_time = 2000;

uint16_t arm_time = 3000;

 

PWM_Params_init(&params);

params.period = pwmPeriod;

pwm1 = PWM_open(Board_PWM0, &params);

if (pwm1 == NULL) {

System_abort("PWM0 did not open");

}

if (Board_PWM1 != Board_PWM0) {

// params.polarity = PWM_POL_ACTIVE_LOW;

pwm2 = PWM_open(Board_PWM1, &params);

}

/* Loop forever incrementing the PWM duty */

// while (1) {

PWM_setDuty(pwm1, dutyCALH);

if (pwm2) {

PWM_setDuty(pwm2, dutyCALH);

}

Task_sleep((uint16_t) CAL_time);

PWM_setDuty(pwm1, dutyCALL);

if (pwm2) {

PWM_setDuty(pwm2, dutyCALL);

}

// duty = (duty + dutyInc);

// if (duty == pwmPeriod || (!duty)) {

// dutyInc = - dutyInc;

// }

Task_sleep((uint16_t) CAL_time);

PWM_setDuty(pwm1, dutyARM);

if (pwm2) {

PWM_setDuty(pwm2, dutyARM);

}

Task_sleep((uint16_t) arm_time);

PWM_setDuty(pwm1, dutyRUN);

if (pwm2) {

PWM_setDuty(pwm2, dutyRUN);

}

// }

}

  • Hello Vikram,

    Which TI RTOS version are you using?

    Regards
    Amit
  • Greetings Amit,

    Firm/I noted this statement - very first post, "I am using the TI-RTOS example PWMLED."

    I would have answered - but firm/clients refuse to, "lock ourselves in" to single vendor locked "solutions" - and portions of poster's code are not "pure" Stellaris/TM4 API.

    Once again - as always - there is no/zero justification for use of the RTOS - and the clarity & power of the tried/true/tested Stellaris/TM4C API is compromised when brought under the (apparent) "heavy hand" of TI-RTOS .

  • Hello Amit,

    This is the name of the folder of RTOS - sure you will get the version from it.

    tirtos_tivac_2_10_01_38

    Important to tell you that after I swapped Board_PWM1 to Board_PWM0 in the pwmled.c, I am getting PWM output on pin PF1. I added two new pwmhandles pwm3 and pwm4 and linked them with Board_PWM2 and Board_PWM3. after doing this I am also getting signal on PF2 and PF3. I cannot send you the new pwmled.c right-now but I will do it asap. Given I am losing the signal frequently, I fear there is some loose connections problem. I have soldered the right-angled header to my Tiva TM4C1294XL Connected Launchpad . Now it seems I must get a female connector to this header to ensure perfect connection. But I am definitely getting some signal on PF0, PF1, PF2 and PF3 even if it is intermittent. I will test it thoroughly and give you a report asap.

    Thanking you,

    Vikram

  • Hello Vikram,

    OK, sure keep us posted.

    Regards
    Amit
  • pwmled.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    /*
    * Copyright (c) 2014, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    /*
    * ======== pwmled.c ========
    */
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/System.h>
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    /* TI-RTOS Header files */
    #include <ti/drivers/PWM.h>
    /* Example/Board Header files */
    #include "Board.h"
    /*
    * ======== pwmLEDFxn ========
    * Task periodically increments the PWM duty for the on board LED.
    */
    Void pwmLEDFxn(UArg arg0, UArg arg1)
    {
    PWM_Handle pwm1;
    PWM_Handle pwm2;
    PWM_Handle pwm3;
    PWM_Handle pwm4;
    PWM_Params params;
    uint16_t pwmPeriod = 20000; // Period and duty in microseconds
    uint16_t duty = 0;
    uint16_t dutyInc = 100;
    uint16_t dutyARM = 1000;
    uint16_t dutyCALH = 2000;
    uint16_t dutyCALL = 1000;
    uint16_t dutyRUN_PF0 = 1050;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Hello Amit,

    I attached the pwmled.c

    I will come back to you as I have the signals.

    Regards,
    Vikram

  • Hello Vikram,

    The first step would be to eliminate RTOS configuration and do a simple TivaWare initialization of PWM for the 4 PWM outputs. You may refer to the following example code

    D:\ti\TivaWare_C_Series-2.1.2.111\examples\peripherals\pwm\reload_interrupt.c

    Regards
    Amit
  • Hi Amit,

    I remade all the connections. I am getting all the 4 outputs after some code corrections. I even added 2 additional PWM outputs PG0 and PG1. they are also working correctly.

    As a next step I will try to do as you say--based only on Tivaware. I have downloaded a project you attached in one of your posts on TM4C PWM - it is the same you mention above(reload_interrupt.c) but the signals are for 1294XL. I have already started adding the code for 4 PWM outputs. As soon as I complete and test, I will let you know.

    Best regards,
    Vikram

  • Hello Vikram,

    So in TI RTOS environment the for PWM outputs are working if only one is used at a time?

    Regards
    Amit
  • Hello Vikram

    Looks like your post content was missing!!!

    Regards
    Amit
  • On 9 Feb 2016 22:49, "Vikram Jhurry" <vikram.jhurry@gmail.com> wrote:
    >
    > Hi Amit,
    > On Monday, I have set the 6 PWMs running each at a different duty cycle (varying between 1ms and 2ms) but same period (20ms). I connected the six PWMs one at a time to a ESC+Motor. The motor is running at the desired speed for every output.
    >
    > Today I modified the program to run the 4  PWMs at same duty cycle (1.1ms) and same period(20ms) to test at what speed the quadcopter starts taking off. I connected 2 ESCs+motor at a time and both are running at the same speed. I am sure if I connect all 4 ESC+motor, they will all run.
    >
    > regards,
    > Vikram
    >
    >
    > On Tue, Feb 9, 2016 at 12:56 PM, Amit Ashara <bounce-310847@mail.e2e.ti.com> wrote:
    >>
    >>  
    >>
    >> A Message from the TI E2E™ Community
    >>
    >>  
    >>
    >> Amit Ashara replied to Cannot see PWM output on pin PF1,PF2, PF3 on TIVA C Connected Launchpad 1294 XL.
    >>
    >> Hello Vikram,
    >>
    >> So in TI RTOS environment the for PWM outputs are workingworkare
  • Hi Amit,
    got some problems to login to forums...
    On Monday, I have set the 6 PWMs running each at a different duty cycle (varying between 1ms and 2ms) but same period (20ms). I connected the six PWMs one at a time to a ESC+Motor. The motor is running at the desired speed for every output.
    Today I modified the program to run the 4 PWMs at same duty cycle (1.1ms) and same period(20ms) to test at what speed the quadcopter starts taking off. I connected 2 ESCs+motor at a time and both are running at the same speed. I am sure if I connect all 4 ESC+motor, they will all run.
    regards,
    Vikram
  • Hello Vikram,

    OK, keep us posted.

    Regards
    Amit
  • Hi Amit,
    I am having a bad issue: my Launchpad is no longer turning on.
    I may have done something wrong when I connected a +5V to header pin 2 (+5V). I usually power the Launchpad with ICDI usb cable and the JP1 setting has always been ICDI. But when I connected the Launchpad to my system, I powered it by connecting a +5 V coming form a Lipo battery through a power module.
    Everything was running fine like this, the motors were turning as I told you. but now the board is not turning on.
    I made some tests and measured some voltages at the test points etc:
    I get +5V on JP1 on selection ICDI which means power is coming on the USB cable. But there is not the +3.3V on the JP3 jumper - so the problem seems to be around U4.
    On U4, on pin 2, I get the +5V correct. The EN1 pin 3 is also +4.5 V so I think this is correct. Pin 8 is also around +4.52V. But I don't get the +5V on pin 7.
    Since there is not this +5V, U5 is not making the +3.3V. That's the situation, I will highly appreciate if you could advise, or I should post in another forum.
    Thanking you,
    Vikram.
  • Hello Vikram,

    Sounds like a damaged device. I would suggest replacing the device.

    Regards
    Amit
  • Hello Vikram,

    Before replacing the device with a new one, I would suggest removing the 3.3V header JP3 and supplying current limited 3.3V to the micro to see all is OK. Do note that in this approach you would need to set the current limit at 200mA (for safety reason) and have a good GND between the power supply and the board. Also the 5V would not be available.

    Regards
    Amit
  • Hi Vikram,

    I had a similar problem. The TI example pwmled example uses GPIO PF0 and the EK_TM4C1294XL.C and .h are set up only to provide PWM using PWM generator block 1. I have modified those files and board.h and now have PWM working on GPIO PF2 which is exactly what I want. I suspected this was the problem but would have struggled without your solution.

    Thank you,

    Russ

  • Hello Russ

    A similar issue on timers also had the same solution.

    e2e.ti.com/.../504308

    Regards
    Amit