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.

RTOS/AM3359: ePWM configuration issue

Part Number: AM3359
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

  • The RTOS team have been notified. They will respond here.
  • Hi Joe,

    Could you please attach your source files and instructions to build?  I have the pdk installed, but am having trouble finding documentation on how to build the examples.  A CCS project with your test case would be even better.  It looks to me like the pdk examples under board/diag were not meant to be used with BIOS, so there is probably some setup that is conflicting with BIOS.

    Thanks,

    Janet

  • TD_ALPHA1.zip

    EVM HW:  TMDSICE3359

    Host Env:  Windows

    BIOS Version:  6.53.2.00

    XDCTOOLS:  3.50.03.33

    CCS Version:  7.2

     

    Hi Janet,

     

    I’ve Exported the entire CCS project so hopefully it will work correctly for you. I believe all of my links are made into pdk_am335x_1_0_9.  This package is installed at:

     

    C:\ti\pdk_am335x_1_0_9

     

    I’m developing on the TMDSICE3359. In the attached zip file, I’ve commented out the spin loop and the call to ConfigPWM2() in the TD_HW_Initialization() routine.  To see the PWM work correctly, allow the spin loop to operate and uncomment the call to ConfigPWM2(). 

     

    To break the code, comment out the spin loop and allow the Main() code to call BIOS_start().

     

    Hope this helps,

     

    JC

  • Hi Joe,
    Thanks for the project. I'm trying to build now and getting some errors, which I hope I can resolve soon. I think I just need to update some paths.
    Thanks,
    Janet
  • Hi Joe,

    I'm able to build and run your project, with and without the call to BIOS_start().  How is it that you are determining whether or not PWM is not working with BIOS enabled?

    Thanks,

    Janet

  • Hi Janet,

    I was running in Debug Mode and I think I ran this same test with the debugger disconnected. 

    Using a scope I connected a probe to the PWM output signal to watch the oscillations.  When the spin loop is disabled and BIOS_Start() is called, the debugger immediately reports the SWI error and halts.  If I RESTART and then disconnect the debug cable, the program will start but no oscillations appear.  Running the same procedures with the spin loop enabled, the program operates correctly.

  • Hi Joe,

    I'm not seeing the SWI error when I load and run the program.  After loading and halting at main(), I have to disable the MMU with a GEL script, otherwise this line in ConfigPWM2() causes the program to abort:

    regVal = HW_RD_REG16((SOC_PWMSS2_REGS + PWMSS_EPWM_OFFSET) + PWMSS_EPWM_TBCTL);

    I noticed in your .cfg file, you have BIOS.swiEnabled = false.  You might try a simple program with the PWM and maybe just one BIOS task.  Start with the bare minimum changes to your .cfg file.  It looks like the .cfg file is based on one of the pdk packages/ti/drv/ tests, so it may not be easy to determine what to remove.  You could look at one ot the BIOS example's .cfg file and compare with yours.

    If after simplifying your program, you still see the failure, maybe you can try disabling the BIOS Clock (add BIOS.clockEnabled = false; to your .cfg file).  I don't think the BIOS Clock timer would interfere with PWM, but you never know.  You could also try calling ConfigPWM2() from a task, so that it runs after BIOS_start(), and see if that has any effect.

    Best regards,

    Janet

  • Hi Janet,

    Thank you for the feedback.  We as a company have decided to use a different topology therefore we'll be moving to a different processor.  This particular processor is extremely difficult to use especially if the application will not use one of the TI Development Boards.

    Thanks again for your help,

    Joe