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.

CC2650 PWM

Other Parts Discussed in Thread: CC2650, SYSBIOS

I am using CC2650 on SmartRF06 EB. My question is whether you have a CC2650-specific driver implementation of PWM for my board. Could I find an example for the same? I am using TI RTOS 2.14

  • Siddharth,
    see this thread for a pre-release of the driver you are looking for e2e.ti.com/.../474000. It will be added to the next TI-RTOS release.
  • Thank you for your reply Sasha. Unfortunately, I could not get the driver working. I made a new empty minimal project in TI RTOS 2.14. Replaced Board.h and Board.c files with the ones provided in the example. Also replaced the main_pwm_sine with the one provided in your PWM driver example files.
    Errors that I get are as follows:
    > Unresolved symbol PWM_open
    > Unresolved symbol PWM_Params_init
    > Unresolved symbol PWM_setDuty

    I have even placed the PWM2.h and PWM2.c files in my include folder. It would be nice to get some insight into what could be breaking my code.
  • Siddharth,
    can you post the complete console output? The zip file in the linked thread contains only sources, so they have to be rebuilt. I would like to see from the console output whether it actually happened, and if there are any compiler warnings.
  • Hello Sasha,

    These were the steps followed by me to make the project:
    1) Opened a new TI RTOS(2.14) minimal project
    2) Removed empty_min.c, Board.h, and Board.c
    3) Replaced with the board files in the zip file, and main_pwm_sine.c
    4) Removed Heartbeatfxn from the config file of the project
    5) Add GPT timer and PWM library files in my include path of TI RTOS 2.14

    Here is the complete console output:


    **** Build of configuration Debug for project PWM_drivertest_sinewaveexample ****

    "C:\\TI\\ccsv6\\utils\\bin\\gmake" -k all
    'Building file: ../main_pwm_sine.cfg'
    'Invoking: XDCtools'
    "C:/TI/xdctools_3_31_01_33_core/xs" --xdcpath="C:/TI/tirtos_simplelink_2_14_03_28/packages;C:/TI/tirtos_simplelink_2_14_03_28/products/bios_6_42_03_35/packages;C:/TI/tirtos_simplelink_2_14_03_28/products/uia_2_00_02_39/packages;C:/TI/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M3 -p ti.platforms.simplelink:CC2650F128 -r release -c "C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6" --compileOptions "-mv7M3 --code_state=16 --float_support=vfplib --abi=eabi -me --include_path=\"C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include\" --include_path=\"C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample\" --include_path=\"C:/TI/tirtos_simplelink_2_14_03_28/products/cc26xxware_2_22_00_16101\" -g --define=DEBUG --define=ccs --diag_warning=225 --diag_warning=255 --display_error_number --diag_wrap=off --gen_func_subsections=on " "../main_pwm_sine.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring main_pwm_sine.xem3 from package/cfg/main_pwm_sine_pem3.cfg ...
    generating custom ROM library makefile ...
    Starting build of library sources ...
    making C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample/src/sysbios/rom_sysbios.aem3 ...
    gmake[1]: Entering directory `C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample/src/sysbios'
    Preprocessing library source files ...
    Creating the SYS/BIOS library that contains the APIs not included in the ROM ...
    Library build complete.
    gmake[1]: Leaving directory `C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample/src/sysbios'
    Build of libraries done.
    clem3 package/cfg/main_pwm_sine_pem3.c ...
    'Finished building: ../main_pwm_sine.cfg'
    ' '
    1 file(s) copied.
    making ../src/sysbios/rom_sysbios.aem3 ...
    gmake[1]: Entering directory `C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample/src/sysbios'
    gmake[1]: Nothing to be done for `all'.
    gmake[1]: Leaving directory `C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample/src/sysbios'
    'Building file: ../Board.c'
    'Invoking: ARM Compiler'
    "C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/bin/armcl" -mv7M3 --code_state=16 --float_support=vfplib --abi=eabi -me --include_path="C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include" --include_path="C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample" --include_path="C:/TI/tirtos_simplelink_2_14_03_28/products/cc26xxware_2_22_00_16101" -g --define=DEBUG --define=ccs --diag_warning=225 --diag_warning=255 --display_error_number --diag_wrap=off --gen_func_subsections=on --preproc_with_compile --preproc_dependency="Board.pp" --cmd_file="configPkg/compiler.opt" "../Board.c"
    "C:/TI/tirtos_simplelink_2_14_03_28/packages/ti/drivers/PWM2.h", line 577: warning #1-D: last line of file ends without a newline
    "../Board.c", line 67: warning #1-D: last line of file ends without a newline
    'Finished building: ../Board.c'
    ' '
    'Building file: ../ccfg.c'
    'Invoking: ARM Compiler'
    "C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/bin/armcl" -mv7M3 --code_state=16 --float_support=vfplib --abi=eabi -me --include_path="C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include" --include_path="C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample" --include_path="C:/TI/tirtos_simplelink_2_14_03_28/products/cc26xxware_2_22_00_16101" -g --define=DEBUG --define=ccs --diag_warning=225 --diag_warning=255 --display_error_number --diag_wrap=off --gen_func_subsections=on --preproc_with_compile --preproc_dependency="ccfg.pp" --cmd_file="configPkg/compiler.opt" "../ccfg.c"
    'Finished building: ../ccfg.c'
    ' '
    'Building file: ../main_pwm_sine.c'
    'Invoking: ARM Compiler'
    "C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/bin/armcl" -mv7M3 --code_state=16 --float_support=vfplib --abi=eabi -me --include_path="C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include" --include_path="C:/Users/siddharth/git/ac_control/Firmware/PWM_drivertest_sinewaveexample" --include_path="C:/TI/tirtos_simplelink_2_14_03_28/products/cc26xxware_2_22_00_16101" -g --define=DEBUG --define=ccs --diag_warning=225 --diag_warning=255 --display_error_number --diag_wrap=off --gen_func_subsections=on --preproc_with_compile --preproc_dependency="main_pwm_sine.pp" --cmd_file="configPkg/compiler.opt" "../main_pwm_sine.c"
    "C:/TI/tirtos_simplelink_2_14_03_28/packages/ti/drivers/PWM2.h", line 577: warning #1-D: last line of file ends without a newline
    'Finished building: ../main_pwm_sine.c'
    ' '
    'Building target: PWM_drivertest_sinewaveexample.out'
    'Invoking: ARM Linker'
    "C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/bin/armcl" -mv7M3 --code_state=16 --float_support=vfplib --abi=eabi -me -g --define=DEBUG --define=ccs --diag_warning=225 --diag_warning=255 --display_error_number --diag_wrap=off --gen_func_subsections=on -z -m"PWM_drivertest_sinewaveexample.map" --heap_size=0 --stack_size=256 -i"C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/lib" -i"C:/TI/ccsv6/tools/compiler/ti-cgt-arm_5.2.6/include" --reread_libs --warn_sections --diag_wrap=off --display_error_number --xml_link_info="PWM_drivertest_sinewaveexample_linkInfo.xml" --rom_model -o "PWM_drivertest_sinewaveexample.out" "./Board.obj" "./ccfg.obj" "./main_pwm_sine.obj" "../CC2650DK.cmd" -l"configPkg/linker.cmd" -l"libc.a" -l"C:/TI/tirtos_simplelink_2_14_03_28/products/cc26xxware_2_22_00_16101/driverlib/bin/ccs/driverlib.lib"
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    PWM_Params_init ./main_pwm_sine.obj
    PWM_open ./main_pwm_sine.obj
    PWM_setDuty ./main_pwm_sine.obj
    PWM_start ./main_pwm_sine.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "PWM_drivertest_sinewaveexample.out" not built

    >> Compilation failure
    gmake: *** [PWM_drivertest_sinewaveexample.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****
  • Hello Sasha,

    The example is working now. Thanks a lot for your help.

    The compiler was not building the timer and PWM libraries that I had added to the include path. I added them to my project folder, gave the include address to those files, and compiled. It worked after this.
  • Sasha,

    Can you also help me with the documentation that talks about how to manually add libraries to TI RTOS, so that I dont have to keep the library files in my project folder every time I have to use PWM and GPTimer?
  • Siddarth,
    I don't know of any documentation that describes manually adding library files to TI-RTOS. I haven't tried to do that, but I think you would have to copy the source for the new driver to ti/drivers in packages, the same way these files are organized in the zip file.
    The next step would be to edit the file package.bld and add the source files to CC26xxObjList in package.bld.
    Finally, you would have to rebuild TI-RTOS by running the following command in the top directory of your TI-RTOS installation where the file tirtos.mak can be found:
    C:/TI/xdctools_3_31_01_33_core/gmake.exe -f tirtos.mak drivers

    I am not really recommending you to that because the setup I am describing hasn't been tested. But, if you don't want to wait for the next TI-RTOS release with the driver integrated in the product, you can try it.

  • Thank you Sasha. I will wait for the release.
  • Hi Siddharth,

    I am following your post. I am also doing the changes as per your suggestion on the post. But In my case I am facing these issues:

    Also please suggest me , exactly where I have to add this "[ Add GPT timer and PWM library files in my include path of TI RTOS 2.14]". I did not find this path.

    Please suggest~

    Thanks n Regards

  • Hello Hsa,

    "[ Add GPT timer and PWM library files in my include path of TI RTOS 2.14]"  : 

    I added PWM2.h, PWM2.c, GPTimerCC26XX.h into my project folder as a workaround. This makes sure that these files are built by the compiler. As Sasha wrote in one of his posts above,  manually adding libraries to RTOS would require a rebuild by running the command : 

    C:/TI/xdctools_3_31_01_33_core/gmake.exe -f tirtos.mak drivers

    I chose not to do that and instead wait for the next release of TI RTOS as Sasha recommended. Perhaps, you could do the same. 

    Hope this helps. Let me know if you're able to use the PWM driver.

     

    Please click on Verify Answer if my answer helped you solve your problem.

  • Hi Siddharth,

    Thanks for your reply~

    well, I modified it as per your suggestions and rebuild by running the command: [C:/TI/xdctools_3_31_01_33_core/gmake.exe -f tirtos.mak drivers]
    I simply added PWM2.h, PWM2.c, GPTimerCC26XX.h into my project folder. But I confused here as Mr Sasha suggested: [have to copy the source for the new driver to ti/drivers in packages, the same way these files are organized in the zip file]. Which one is working well?

    Also, when I modified according to what you suggested, I am getting these errors~
    1. #10010 errors encountered during linking "projectpwm.out" not built.
    2. #10234-D unresolved symbols remain
    3. unresolved symbol heartBeatFxn, first referenced in C:\xxx\xxx\xxx\xxx\xxx\xxx\empty_min_pem3.oem3
    4. unresolved symbol PWMCC26XX_fxnTable. first referenced in ./Board.obj

    Do you know the next release 'version' of TI-RTOS (which includes the PWM driver) and when it will be released exactly ?

    Please suggest~

    Thanks n Regards
  • Hello Hsa,

    Keeping PWM2.c, PWM2.h, GPTimer26XX.c, and GPTimer26xx.h in my project folder worked for me.

    For Error number 3 in your message: Comment out the HeartbeatFxn from main file and the task configuration from the .cfg file. you should comment the following out from the config file:

    "var task0Params = new Task.Params();
    task0Params.instance.name = "heartBeat";
    task0Params.arg0 = 1000000 / Clock.tickPeriod;
    task0Params.stackSize = 512;

    Program.global.task = Task.create("&heartBeatFxn", task0Params);"

    For Error number 4: Add this in the board.c file : #include <ti/drivers/pwm/PWMCC26XX.h> and see if the header file is getting included.

    You should try out TI RTOS 2.15; its documentation says it includes PWM driver. I haven't tried it out yet. Link: http://www.ti.com/lit/ug/spruhu7b/spruhu7b.pdf

    Hope this helps.

  • Thanks Siddharth for well explanation. I will set it accordingly.

    Also, I am thinking to try the TI-RTOSv2.15, if it includes PWM driver. Is it possible for you to please let me know any example in TI-RTOSv2.15 which well explains the PWM module.

    Please suggest~

    Thanks n Regards
  • Hi Hsa,

    I think you should be able to get the PWM code working without changing RTOS.

    Sorry, I could not find a PWM driver interface example in TI RTOS 2.15 directory. I am not aware if an example exists.

    Thanks.