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.
Tool/software: TI-RTOS
I am using a TM4C1294NCPDT with CCS 6.1.2 and TIRTOS 2.16.0.08.
On the TM4C1294NCPDT, I want to use PWM1 on PIN PF1, PWM2 on pin PF2 and PWM3 on pin PF3. I found an example app called pwmled.c and used that on an eval board and everything worked well but I have some questions about using the API used in the example in my project.
The example app pwmled.c used PWM0 and API calls:
PWM_Params_init() PWM_open() PWM_setDuty()
My questions
1) where do I find the detailed documentation of the API calls PWM_Params_init() PWM_open() PWM_setDuty()?
2) In the sample application pwmled.c, the init is called with the following params PWM_open(Board_PWM0, ¶ms);
In board.h, I see #define Board_PWM0 EK_TM4C1294XL_PWM0
And in EK_TM4C1294XL.h I see:
typedef enum EK_TM4C1294XL_PWMName {
EK_TM4C1294XL_PWM0 = 0,
EK_TM4C1294XL_PWMCOUNT
} EK_TM4C1294XL_PWMName;
As you can see above, the PWM channels 1-3 are not defined in EK_TM4C1294XL.h where PWM ch 0 is.
What is the recommended way to add the other PWM1, PWM2 and PWM3 to the project or should I use the TIVA API using described in the peripheral drive library instead?
The the TIVA API would use functions PWMGenConfigure(), PWMPeriodSet(), PWNPulseWidthSet() etc...
Thanks,
Doug
Hi Doug,
I think your questions can be answered in section 5.9 on the PWM Driver of the TI-RTOS User's Guide. Normally you can find the documentation in your <TI-RTOS Installation>/docs/Users_Guide.pdf. Here is also the link to it. www.ti.com/.../spruhd4m.pdf
Please also visit the TI-RTOS wiki page for additional information. processors.wiki.ti.com/.../TI-RTOS
If you want to use the TI-RTOS to manage the PWM functions, you will need to update the typedef enum EK_TM4C1294XL_PWMName to include the additional PWM pins you want to use. Likewise, you will need to update the EK_TM4C1294XL.c as well under the PWM section.
You may also use the TivaWare PWM APIs and use the TI-RTOS's Hwi to manage the PWM interrupts.
I did have the document you shared in the link www.ti.com/.../spruhd4m.pdf
but I didn't see where it described the params and the limits etc or the params. The document references
links for more info for example <tirtos_install>\products\tidrivers_,version>\docs\html\index.html.
I did look around for that path or similar path but I didn't find the additional details I was looking for.
I think in the end I can reference the CPU doc for any additional information I need on the params.
I did add some code to EK_TM4C1294XL.c and EK_TM4C1294XL.h for the PWM devices 1,2, and 3
typedef enum EK_TM4C1294XL_PWMName {
EK_TM4C1294XL_PWM0 = 0,
EK_TM4C1294XL_PWM1, // added for pwm1
EK_TM4C1294XL_PWM2, // added for pwm2
EK_TM4C1294XL_PWM3, // added for pwm3
EK_TM4C1294XL_PWMCOUNT
} EK_TM4C1294XL_PWMName;
const PWMTiva_HWAttrs pwmTivaHWAttrs[EK_TM4C1294XL_PWMCOUNT] = {
{
.baseAddr = PWM0_BASE,
.pwmOutput = PWM_OUT_0,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN,
.baseAddr = PWM1_BASE,
.pwmOutput = PWM_OUT_1,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_8000RUN,
.baseAddr = PWM2_BASE,
.pwmOutput = PWM_OUT_2,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN,
.baseAddr = PWM3_BASE,
.pwmOutput = PWM_OUT_3,
.pwmGenOpts = PWM_GEN_MODE_DOWN | PWM_GEN_MODE_DBG_RUN
}
};
#define Board_PWM0 EK_TM4C1294XL_PWM0
#define Board_PWM1 EK_TM4C1294XL_PWM1
#define Board_PWM2 EK_TM4C1294XL_PWM2
#define Board_PWM3 EK_TM4C1294XL_PWM3
#define PWM0_BASE 0x40028000 // Pulse Width Modulator (PWM)
#define PWM1_BASE 0x40029000 // Is this correct ??
#define PWM2_BASE 0x4002A000 // Is this correct ??
#define PWM3_BASE 0x4002B000 // Is this correct ??
I think the only question I have still is confirming the base address is correct for PWM1-PWM3. From
this document www.ti.com/.../tm4c1294ncpdt.pdf I see in section 23.5 that PWM0 was
defined as 0x4002.800. On page 104 / Table 2-4 memory Map of that same document there is a table with the addresses of the
devices but I was not able to confirm the base address of PWM1-PWM3 since I didn't see the base address
for PWM1-PWM3 listed.
Thanks,
Doug