Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: CC1310
Tool/software: TI-RTOS
PWM_open() causing collector example to hang.
I am trying to add pwm output to the collector_cc1310lp(ti-rtos with CCS) example. Initaly just trying to get it working on the Green LED to confirm pin configuration. Going by the cc1310 pwm example that I had going and was a ble to modify I tried moving it into collector project.
First the pwm and gpt were not added in /collector_cc1310lp/Application/LaunchPad/CC13X0_LAUNCHXL.c I added only first 4 as will need even less (not sure if not adding all could be causing issue?). The naming was changed from cc1310 example to conform with the C:\ti\simplelink_cc13x0_sdk_1_50_00_08\examples\rtos\CC1310_LAUNCHXL\ti154stack\common\boards\CC13X0_LAUNCHXL\CC13X0_LAUNCHXL.h naming since it was being used. I think this is OK.
/*
* =============================== GPTimer ===============================
* Remove unused entries to reduce flash usage both in Board.c and Board.h
*/
#include <ti/drivers/timer/GPTimerCC26XX.h>
GPTimerCC26XX_Object gptimerCC26XXObjects[4];
const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[4] = {
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
};
const GPTimerCC26XX_Config GPTimerCC26XX_config[4] = {
{ &gptimerCC26XXObjects[CC13X0_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[Board_GPTIMER0A], GPT_A },
{ &gptimerCC26XXObjects[CC13X0_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[Board_GPTIMER0B], GPT_B },
{ &gptimerCC26XXObjects[CC13X0_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[Board_GPTIMER1A], GPT_A },
{ &gptimerCC26XXObjects[CC13X0_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[Board_GPTIMER1B], GPT_B },
};
/*
* =============================== PWM ===============================
* Remove unused entries to reduce flash usage both in Board.c and Board.h
*/
#include <ti/drivers/PWM.h>
#include <ti/drivers/pwm/PWMTimerCC26XX.h>
PWMTimerCC26XX_Object pwmtimerCC26xxObjects[4];
const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[4] = {
{ .pwmPin = Board_PWMPIN0, .gpTimerUnit = Board_GPTIMER0A },
{ .pwmPin = Board_PWMPIN1, .gpTimerUnit = Board_GPTIMER0B },
{ .pwmPin = Board_PWMPIN2, .gpTimerUnit = Board_GPTIMER1A },
{ .pwmPin = Board_PWMPIN3, .gpTimerUnit = Board_GPTIMER1B },
};
const PWM_Config PWM_config[4] = {
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[Board_PWM0], &pwmtimerCC26xxHWAttrs[Board_PWM0] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[Board_PWM1], &pwmtimerCC26xxHWAttrs[Board_PWM1] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[Board_PWM2], &pwmtimerCC26xxHWAttrs[Board_PWM2] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[Board_PWM3], &pwmtimerCC26xxHWAttrs[Board_PWM3] },
};
const uint_least8_t PWM_count = 4;
The init and open was added to the end of exitsting board_led.c , void Board_Led_initialize(void) ,to have it initilize so I could confirm pin was working.
(prams and handle variable declared outside init function)
PWM_Params_init(&laserPwmParams);
laserPwmParams.dutyUnits = PWM_DUTY_FRACTION;
laserPwmParams.dutyValue = 0;
laserPwmParams.periodUnits = PWM_PERIOD_HZ;
laserPwmParams.periodValue = LASER_PERIOD;
laserPwm = PWM_open(Board_PWM1, &laserPwmParams);
// PWM_setDuty(laserPwm, LASER_DUTY);
// PWM_start(laserPwm);
Project builds fine, But when PWM_open is there the example seems to hang and buttons don't work and no display update. It is continues fine if the PWM_open line is commented out.
Help please. I have no Idea where I went wrong or where to go from here.
I tried the only thing I expected could be an issue but it did not help(below).
Since I expected there could be a conflict with also having the existing pin_open() on same LED I moved the LED1 to an unused pin. Moving it did not seem to cause a problem but did not prevent my issue. Move was done by changing :
C:\ti\simplelink_cc13x0_sdk_1_50_00_08\examples\rtos\CC1310_LAUNCHXL\ti154stack\common\boards\CC13X0_LAUNCHXL\board.h
/* These #defines allow us to reuse TI-RTOS across other device families */
#define Board_LED0 Board_RLED
#define Board_LED1 Board_DIO27_ANALOG //was Board_GLED
#define Board_LED2 Board_LED0
Not sure it this was the best place and way seem like it should reassign the pin.
Thanks for any direction you can provide.