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.

TI-RTOS-MCU: PWM driver / example

Part Number: TI-RTOS-MCU

Hi, 


I am trying to find an example for PWM usage on TI RTOS version ti/bios_6_76_03_01 but I don't see it under the drv/ folder.

 

I am trying to find the APIs and an example code for PWM usage on a custom boat=rd (BeagleBone black running on TI RTOS in my case). 

 

Please help me locate it.

 

Thank you,

Arshiya Tabassum

  • Hi, Arshiya,

    What device are you working on? If you can specify the SoC, we'll get the right expert to help  you.

    Rex

  • I am working on Beaglebone Black - the SoC on it is AM335x

  • Hi, Arshiya,

    Ok. I'll move the thread to Sitara Forum. Expert in Sitara team will help you.

    Rex

  • Sure, Thank you so much! How long before I can expect a response from that team?

  • Hi, 

    Just wanted to check the status of response for my concern? This is kind of urgent, can you please let me know when can I expect a response?

  • Hi Arshiya,

    Arshiya Tabassum said:
    Please help me locate it.

    There isn't an ePWM LLD. You'll need to use the Starterware (CSL) level API for ePWM, and integrate this into your RTOS app.

    Please see this E2E thread: https://e2e.ti.com/support/processors/f/791/t/887926

    Please see <PDK>\packages\ti\starterware\examples\dcan\readme.txt for details on integrating Starterware into RTOS applications.

    Regards,
    Frank

  • Hi Frank,

    Thank you for your response.

    I am trying to add TI RTOS support to the epwm starterware example to test the example on BeagleBone Black according to the discussion on this thread:  https://e2e.ti.com/support/processors/f/791/t/887926

    I am following the readme.txt file in starterware/dcan folder to setup the project. However the board I am trying to use is bbbAM335x (BEAGLEBONEBLACK) and the readme.txt file has instructions only for evmAM335x or evmAM437x.

    I am able to run the script for AM335x, however I am not able to detect the epwm project. I have attached a screenshot for your reference. 

    Can I use the same procedure for my EVM, if not is there a guide for bbbAM335x EVM to add TI RTOS Support for the Starterware examples?

    Thank you.

    Arshiya Tabassum

  • Arshiya Tabassum said:
    Can I use the same procedure for my EVM, if not is there a guide for bbbAM335x EVM to add TI RTOS Support for the Starterware examples?

    The DCAN readme.txt should be consulted for general guidance. You'll need account for platform-specific differences between AM335x GP EVM and BBB. I suggest you compare some PDK LLD examples which are supported for the GP EVM & BBB (e.g. UART LLD, see <PDL>\packages\ti\drv\uart\test\am335x\armv7\bios).

    Arshiya Tabassum said:
    I am able to run the script for AM335x, however I am not able to detect the epwm project

    It's not possible to create a CCS project for the ePWM example using method described in "Creating CCS Projects". Instead, use method described in "Building DCAN Loopback Example for RTOS - Using Makefile".

    > cd <PDK>\packages\ti\starterware
    > gmake epwm_app_haptics_motor PLATFORM=am335x-evm BOARD=AM335x PROFILE=release
    OR
    > gmake epwm_app_haptics_motor PLATFORM=am335x-evm BOARD=AM335x PROFILE=debug

    Resulting binaries are located in <PDK>\packages\ti\starterware\binary\epwm_app_haptics_motor\bin\am335x-evm\gcc

    When porting starterware code into an TI-RTOS application, use OSAL (or TI-RTOS) APIs for configuring:

    • GIC (interrupt controller)
    • MMU/cache

    Regards,
    Frank

  • Hi Frank,

    Thank you for the reply. 

    I tried used the method described in the section: "Building DCAN Loopback Example for RTOS - Using Makefile". I am getting errors. I tried both the commands you mentioned above. Please see the screenshots below.

    I tried changing the PLATFORM and BOARD to seee if that works. Still got the same issue.

    Thank you.

    Arshiya Tabassum

  • Hi Arshiya,

    It works for me. I installed AM335x PRSDK 6.3.0.106 to c:\ti

     c:\ti_am335x_06_03_00_106\pdk_am335x_1_0_17\packages
    # pdksetupenv.bat
    ***************************************************
    Environment Configuration:
    ***************************************************
        SDK_INSTALL_PATH        : c:/ti_am335x_06_03_00_106
        PDK_INSTALL_PATH        : c:/ti_am335x_06_03_00_106/pdk_am335x_1_0_17/packages
        GMAKE_INSTALL_PATH      : c:/ti_am335x_06_03_00_106/xdctools_3_55_02_22_core
        PDK_SOC                 : am335x
        PDK_VERSION             : 1_0_17
        RULES_MAKE              : c:/ti_am335x_06_03_00_106/pdk_am335x_1_0_17/packages/ti/build/Rules.make
    ***************************************************

    Next:

    # cd ti\starterware
    # gmake epwm_app_haptics_motor PLATFORM=am335x-evm BOARD=AM335x PROFILE=release

    My build log is attached.

    Regards,
    Frank

    0211.build_log.txt

  • Hi Frank, 

    Thank you for trying to build from your end.

    However, you have used am335x-evm as your board and I am trying to use bbbAM335x as the board for which it is not able to recognize the example project.

    Please guide me keeping in consideration my setup:

    Board: BEAGLEBONE BLACK WIRELESS

    (bbbAM335x)

    Processor: AM335x

    Thank you,

    Arshiya Tabassum

  • Hi Arshiya,

    Please issue "gmake help" from the starterware folder. You'll notice the following:

    PLATFORM=[am335x-evm / am43xx-evm]

    The Starterware make files only accept these two platforms.

    Some Starterware examples execute on BBB even when PLATFORM=am335x-evm. If a particular example isn't supported on BBB, this will be displayed in the UART console output when the example is executed.

    The gpio_app_led_blink works on BBB:

                 StarterWare GPIO Application!!
                BOARDInit status [0x0]
                 SoC                   : [AM335X]
                 Core                  : [A8]
                 Board Detected        : [BEAGLEBONEBLACK]
                 Base Board Revision   : [UNKNOWN]
                 Daughter Card Revision: [UNKNOWN]
                GPIO Instance number: 1
                Pin number: 23
    
                Now blinking the LED ...        
    

    The epwm_app_haptics_motor example doesn't work on BBB:

                 StarterWare EPWM Application!!
                BOARDInit status [0x0]
                 SoC                   : [AM335X]
                 Core                  : [A8]
                 Board Detected        : [BEAGLEBONEBLACK]
                 Base Board Revision   : [UNKNOWN]
                 Daughter Card Revision: [UNKNOWN]
                Invalid device ID!!
                Device is not available on this board!
                This example is not supported on this board!
    

    To get ePWM working on BBB, you'll need to use Starterware ePWM API in your TI-RTOS app.

    The API functions are located in startware/include/epwm.h.

    A Starterware example which uses the Starterware ePWM API functions (but doesn't work on BBB) is epwm_app_haptics_motor.

    You'll need to account for any platform-specific differences between the supported platform and BBB. This part is up you.

    Regards,
    Frank

  • Arshiya,

    I'm completely unfamiliar with this TI-RTOS driver, and I'm unable to locate this header file anywhere in PRSDK 6.3.0.106, including anywhere in BIOS 6.76.03.01. It appears it's supported for Tiva-C, not AM335x.

    I've looped in a colleague who may have more information.

    Regards,
    Frank

  • Hi All,

    SYS/BIOS does not ship drivers. TI-RTOS for TivaC includes SYS/BIOS and RTOS-aware drivers. The drivers in TI-RTOS for TivaC are only for TivaC devices (e.g. TM4C12x) and not applicable for AM335x devices. 

    Todd

  • Hi Frank,

    Thank you for the detailed explanation. That part is clear now.

    So, to re-iterate, I can use the starterware APIs for ePWM as they are ( located here: startware/include/epwm.h) for implementing the PWM in my RTOS project. 

    You'll need to account for any platform-specific differences between the supported platform and BBB. This part is up you.

    By this, I can think of the board specific files I need to change according to my board. What else might come into picture from your understanding just to not miss out on anything?

    Thank you,

    Arshiya Tabassum

  • Sure, thank you for the clarification Todd! 

  • Hi Arshiya,

    Arshiya Tabassum said:
    I can use the starterware APIs for ePWM as they are ( located here: startware/include/epwm.h) for implementing the PWM in my RTOS project.

    Yes.

    Arshiya Tabassum said:
    What else might come into picture from your understanding just to not miss out on anything?

    I can't of anything else we haven't already covered in this thread.

    Regards,
    Frank

  • Hi Frank,

    As mentioned earlier, I am using AM335x in my project. I am trying to utilize the EHRPWM2A (P8 header on BeagleBone Black)

    I am using the steps mentioned in one the API for pwm initialization as follows:

    uint32_t EPWMAppInit(epwmAppPwmObj_t *pPwm)
    {
        int32_t status = S_PASS;
    	uint16_t ePwmSubmodType = PINMUX_SS_PWMSS_EHRPWM0;
    
        /* Clock Configuration  */
        status = PRCMModuleEnable(CHIPDB_MOD_ID_PWMSS, pPwm->instNum, 0);
        if(S_PASS != status)
        {
            CONSOLEUtilsPrintf("\n FAILURE!!! Clock Configuration failed !\n");
        }
        else
        {
            /* PinMux Configuration */
            status = PINMUXModuleConfig(CHIPDB_MOD_ID_PWMSS, pPwm->instNum, &ePwmSubmodType);
            if(S_PASS != status)
            {
                CONSOLEUtilsPrintf("\n FAILURE!!! Pin Muxing failed !\n");
            }
            else
            {
                /* Get the functional clock value of PWMSS */
                /* TODO: This value has to be provided by the PRCM data base */
                pPwm->funcClk = SOC_EHRPWM_2_MODULE_FREQ;
    
                /* Enable clocks for EPWM module inside the PWM sub system. */
                EHRPWMClockEnable(pPwm->instAddr);
    
                /* Enable Time base clock for PWMSS module */
                SOCCtrlPwmssTimebaseClkEnable(pPwm->instNum);
    
                /* EPWM channel configuration */
                EpwmAppPwmCfg(pPwm);
            }
        }
    
        return status;
    }

    /* Get the functional clock value of PWMSS */
                /* TODO: This value has to be provided by the PRCM data base */
                pPwm->funcClk = SOC_EHRPWM_2_MODULE_FREQ;

    What does it mean by getting the value from PWMSS? Is it from the PRCMModuleEnable()?

    Thank you,
    Arshiya


  • Hi Frank,

    I am using the haptics-motor example to create the sequence of pwm initialization, please let me know if this example can be followed for general guidance. I wanted to understand the flow for opening the PWM like other peripherals I2C, SPI etc.

    I look forward to your response.

    Thank you,

    Arshiya Tabassum

  • Hi Arishya,

    Arshiya Tabassum said:
    please let me know if this example can be followed for general guidance

    Yes, it should be possible to use it for general guidance.

    Arshiya Tabassum said:
    I wanted to understand the flow for opening the PWM like other peripherals I2C, SPI etc.

    Please check Starterware or LLD examples for those peripherals for guidance.

    Regards,
    Frank