Other Parts Discussed in Thread: TMDSICE3359
Tool/software: TI-RTOS
EVM HW: TMDSICE3359
Host Env: Windows
BIOS Version: 6.53.2.00
XDCTOOLS: 3.50.03.33
CCS Version: 7.2
I’m running into an issue that I haven’t been able to figure out. I’m running into an Error after I tried to add an ePWM function.
The Error reads:
No source available for "do_AngelSWI(int, void *) [C:/Users\celyj\Embedded\TireD_AM335x\TireDetect_ALPHA1\Debug\TireDetect_ALPHA1.out] at 0x80012b7c"
The problem occurs after BIOS_start() is executed. I found that I can initialize the PWM module and start/stop the module with no problems as long as the BIOS_Start() routine is not called. The PWM frequency is doing operating exactly as expected.
If I remove the spin loop and allow the code to call BIOS_Start(), the program does not execute. If I remove the configuration of the PWM, the program operates as expected with no errors.
I’m pretty sure the problem is occurring in the initialization of the PWM but I haven’t been able to figure this out.
Here is the Main Loop that shows the Spin loop. If this is enabled, the PWM works properly.
int main(void)
{
/* Call board init functions */
TD_HW_Initialization();
while(1)
{
UART_Message(UART_OPENING_MSG);
StartSensorRefClk(); //Outputs 1.25MHz on AD9
delay();
StopSensorRefClk(); //Disables 1.25MHz on AD9
delay();
}
/* Start BIOS */
BIOS_start();
return (0);
}
Here is the TD_HW_Initialization() routine. ConfigPWM2() is where the PWM is initialized.
void TD_HW_Initialization(void)
{
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK |
BOARD_INIT_UART_STDIO;
/*The Board_init routine can be found in
* C:\ti\pdk_am335x_1_0_9\packages\ti\board\src\icev2AM335x
* This routine takes the boardCfg variable and determines which peripheral
* to initialize. All of the .c files in this directory are used primarily
* for initialization of the specific board.
*/
Board_init(boardCfg);
ConfigPWM2();
}
Here is the PWM initialization. I’m setting it as an Up/Down counter and outputting the clock signal on GPMC_AD9. The PWM runs at 1.25MHz and sets the pin LOW when the count is 0 and High when the count reaches the correct value. I used the example code pwm_test.c for the initialization.
C:\ti\pdk_am335x_1_0_9\packages\ti\board\diag\pwm\src
void ConfigPWM2(void)
{
uint32_t regVal;
//See AQCTLA & AQCTLB registers in ePWM section.
// The structure below represents Bit0 --> 11
// AQ_NO_ACTION = 0
// AQ_FORCE_OUTPUT_LOW = 0x1
// AQ_FORCE_OUTPUT_HIGH = 0x2
// AQ_TOGGLE = 0x3
CSL_EpwmAqActionCfg_t aqctrla = {AQ_FORCE_OUTPUT_LOW, AQ_FORCE_OUTPUT_HIGH, AQ_NO_ACTION, AQ_NO_ACTION, AQ_NO_ACTION, AQ_NO_ACTION};
/* Enable PRCM for PWMSS2 */
HW_WR_REG32((SOC_CM_PER_REGS + CM_PER_EPWMSS2_CLKCTRL), 0x02);
/*-- Configure the PinMux and Pin --*/
// Output the PWM signal on GPMC_AD9
// conf_gpmc_ad9 Register under the Control Module section of UM
// Set the Signal Mux select to 4 (ehrpwm2B)
regVal = HW_RD_REG32(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(9));
regVal = ((regVal & ~0x07) | 0x04);
HW_WR_REG32(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(9), regVal);
// Time base clock for PWMSS2 module
// pwmss_ctrl Register in Control Module section of UM
HW_WR_REG32((SOC_CONTROL_REGS + CONTROL_PWMSS_CTRL), 0x04);
// Configure the Timebase Clock using prescaler
CSL_epwmTbTimebaseClkCfg(SOC_PWMSS2_REGS, TBCLK_FREQ, MODULE_CLK);
// Clearing phase and direction set to count up
CSL_epwmTbSyncEnable(SOC_PWMSS2_REGS, CLEAR_PHASE_REG, TB_COUNT_UP_DOWN);
// Disabling the Sync
CSL_epwmTbSyncDisable(SOC_PWMSS2_REGS);
// Configuring the EPWM_AQCTLA register
CSL_epwmAqActionOnOutputCfg(SOC_PWMSS2_REGS, CSL_EPWM_OUTPUT_CH_B, &aqctrla);
/* -- Set the PWM Duty Cycle & Frequency --*/
// PWM pulse frequency configuration
CSL_epwmTbPwmFreqCfg(SOC_PWMSS2_REGS, TBCLK_FREQ, PWM_FREQ, TB_COUNT_UP_DOWN,
TB_IMMEDIATE);
// Resetting the counter
CSL_epwmTbWriteTbCount(SOC_PWMSS2_REGS, RESET_TB_COUNT_VALUE);
}
Thank you,
Joe