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.

CC2640R2F: How to get "ble5_simple_peripheral" to run on custom hardware?

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2642R, , CC2650, UNIFLASH, SYSCONFIG, LAUNCHXL-CC2640R2

HI:

I have a  custom hardware,Use CC2640R2FRHBR control a device.

I want to use modify "ble5_simple_peripheral" to run on my custom hardware。I have made the following attempts:

1.I modified the code according to this post,Got a simplified version of "ble5_simple_peripheral",and I set the correct RF front-end mode,"ble5_simple_peripheral" can run on my custom hardware,It can be connected to a smartphone。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/879265/cc2640r2f-how-to-remove-two-buttons-menu-two_btn_menu-and-display-from-simple_peripheral-project?tisearch=e2e-sitesearch&keymatch=simple_peripheral#

2.I tried to add the GPIO and SPI drivers to "ble5_simple_peripheral", I read "Running the SDK on Custom Hardware", but it was too brief a description to help me.

Creating a Custom Board File
TI-RTOS drivers rely on “board files” for their board-specific configuration parameters. The convention is to name these files based on the development kits provided by TI in addition to a generic Board.h with Board_* definitions to map the proper pins defined by ioc.h.

For example, for the simple_peripheral project, the following comprise the set of board files used by the CC2640R2 LaunchPad development kit:

Board.h CC2640R2_LAUNCHXL.h CC2640R2_LAUNCHXL.c
Note

simple_peripheral board files are located in <SDK_INSTALL_DIR>\source\ti\boards\CC2640R2_LAUNCHXL

TI recommends to start with the existing set of board files when porting a BLE application to custom development boards. When modifying or porting these board files, the user should consult with TI Drivers API Reference.

Tip

Board files provided by TI include TI-RTOS driver configuration data structures for various drivers. If the application does not use the associated TI-RTOS drivers, the linker will simply omit them from the application image.

The following steps provide guidance on customizing board files for a BLE-Stack 3.03.08.00 project.

Duplicate existing board files from existing CC2640R2_LAUNCHXL board files.

These files can be found at: <SDK_INSTALL_DIR>\source\ti\boards\CC2640R2_LAUNCHXL
Create a copy of the CC2640R2_LAUNCHXL directory and give it a unique meaningful name for your development platform. In this example, we call it MYBOARD.
Caution

The SimpleLink CC2640R2 SDK also contains board files for TI-RTOS kernel and driver examples. These are not compatible with the BLE-Stack 3.03.08.00 because of differences in RF driver SWI priorities and custom drivers (e.g. TRNG) required by BLE-Stack 3.03.08.00. For BLE-Stack projects, use the files specified above for reference from simple_peripheral.

In the MYBOARD directory, rename CC2640R2_LAUNCHXL.c and CC2640R2_LAUNCHXL.h to their MYBOARD.c and MYBOARD.h respectively.
Search and replace all references of CC2640R2_LAUNCHXL with MYBOARD in Board.h, MYBOARD.c and MYBOARD.h.
Add a new preprocessor define in your project’s board.c and board.h files.

Continuing with the MYBOARD example, modify board.c and board.h in <SDK_INSTALL_DIR>\source\ti\blestack\target

Replace CC2640R2_LAUNCHXL by MYBOARD in your project’s application predefined symbols (See Accessing Preprocessor Symbols or Accessing Preprocessor Symbols)

In board.h, add a link to your Board.h file.

#elif defined(CC2640R2_LAUNCHXL)
    #include "./cc2640r2lp/cc2640r2lp_board.h"
#elif defined(MYBOARD)
    #include "../../boards/MYBOARD/Board.h"
In board.c, add the highlighted lines shown below:

#elif defined(CC2640R2_LAUNCHXL)
    #include "./cc2640r2lp/cc2640r2lp_board.c"
#elif defined(MYBOARD)
    #include "../../boards/MYBOARD/Board.h"
    #include "../../boards/MYBOARD/MYBOARD.c"
Explicit references to CC2640R2_LAUNCHXL.h need to be replaced by MYBOARD.h

Modify board files to match application requirements

PIN structure to match the layout of the board.
Add peripheral driver initialization objects according to the board design.
For RF driver configuration, see Configuring the RF Front-End for Custom Hardware
I'm a first-time user of TI's development tools, and this question has been bothering me for days,Can you provide an example based on CC2640R2FRHBR with GPIO and SPI drivers included in "ble5_simple_peripheral"?Or provide a more detailed step by step like the previous link.

Thank you!

  • Hi,

    Thank you for reaching out,

    You can have a look on this guide https://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_5_30_01_00/modules/blestack/ble_posix/ble_01_posix.html .

    You also can check examples from your SDK on the example > rtos > CC2640R2_LAUNCHXL > drivers folder, here you will have GPIO and SPI examples which can help you.

    Regards,

  • Hi,

    I suggest you use the simple peripheral program as base which uses BLE 4.2.

    BLE 5 is not recommended for CC2640R2F due to the BLE 5 stack is big and you will have little room for application development. If you need BLE 5 features I suggest you use CC2642R.

    Regarding integrating GPIO and SPI to simple peripheral, there are GPIO and SPI TI drivers example programs which you can port to simple peripheral.

    -kel

  • Hi,

    Thank you very much for your help!

    My hardware is finished and the CC2640R2F is 5X5,  so I have to finish the software development on CC2640R2FRHBR

    tdy

    Regards,

  • Hi,Guillaume

    Thank you very much for your help!

    The method you provided should be step 2, the chip package on CC2640R2F LaunchPads is 7X7, so there is no need to modify the board level configuration file.
    But the chip I use for custom hardware is 5X5, step 1 should be to generate 'Board.h' and 'Board.c' for custom hardware, my confusion is that I don't know how to generate 'Board.h' and 'Board.c' for CC2640R2F 5X5 board level configuration files. And how to add them to the project "simple_peripheral"?

    Regards,

    tdy

  • Hi,

    The CC2640R2F 7x7 Launchpad has 3 board files, Board.h, CC2640R2_LAUNCHXL.c, CC2640R2_LAUNCHXL.h. The board files work specifically for the launchpad.

    For these board files to work for CC2640R2F 5x5 you need to modify them to work for your custom board.

    But, before you do that, you need to understand how these board files work together to for an example turn on a led.

    -kel

  • HI 

    I have made the following attempts:

    This is the content of the modified folder:myboard.rar

    This is the modified board.h and board.c:

    2768.board.c
    /*******************************************************************************
    
     @file  board.c
    
     @brief This file is a simple gateway to include the appropriate board.h file
            which is located in a corresponding subdirectory relative to this file.
            In this way, all projects look the same and only need to include this
            board.h. To change a board, the project only need update the board
            define in the application preprocessor options. Presently, the following
            board target defines are possible:
    
            CC2640R2DK_CXS
            CC2640R2_LAUNCHXL
    
            If a project needs to change the board defined for a particular target,
            they can modify the board.h located in the corresponding board
            subdirectory.
    
            NOTE: THIS FILE SHOULD ONLY BE CHANGED TO ADD A NEW BOARD/TARGET!
    
     Group: WCS, LPC, BTS
     Target Device: cc2640r2
    
     *******************************************************************************
     
     Copyright (c) 2015-2021, Texas Instruments Incorporated
     All rights reserved.
    
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
    
     *  Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
    
     *  Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
    
     *  Neither the name of Texas Instruments Incorporated nor the names of
        its contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.
    
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
     *******************************************************************************
     
     
     ******************************************************************************/
    
    #if defined(CC2640R2DK_CXS) || defined (CC2640R2DK_4XS) \
          || defined (CC2640R2DK_5XD) ||  defined (CC2640R2DK_7ID)
        #include "./cc2640r2em/cc2640r2em_board.c"
    #elif defined(CC2640R2_LAUNCHXL)
        #include "./cc2640r2lp/cc2640r2lp_board.c"
    #elif defined(CC2640R2_RC)
        #include "./cc2640r2rc/cc2640r2rc_board.c"
    #elif defined(myboard)
        #include "../../boards/myboard/board.h"
        #include "../../boards/myboard/myboard.c"
    #else // unknown board
        #error "***ERROR*** Invalid Board Specified! Please see board.h for options."
    #endif
    
    8562.board.h

    Predefined Symbols:

    But it does not pass compilation

  • Hi,

    Can you share the CCS console error message. It seems that something is not well define in your code.

    Also can you share your code in zip file rather than a .rar file?                                                 

    regards,

  • Description Resource Path Location Type
    #10010 errors encountered during linking; "simple_peripheral_cc2640r2lp_app.out" not built simple_peripheral_cc2640r2lp_app C/C++ Problem
    <a href="file:/C:/ti/ccs1220/ccs/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain simple_peripheral_cc2640r2lp_app C/C++ Problem
    gmake: *** [all] Error 2 simple_peripheral_cc2640r2lp_app C/C++ Problem
    gmake[1]: *** [simple_peripheral_cc2640r2lp_app.out] Error 1 simple_peripheral_cc2640r2lp_app C/C++ Problem
    unresolved symbol Board_initHook, first referenced in <whole-program> simple_peripheral_cc2640r2lp_app C/C++ Problem
    unresolved symbol TRNGCC26XX_config, first referenced in <whole-program> simple_peripheral_cc2640r2lp_app C/C++ Problem

  • "C:\\ti\\ccs1220\\ccs\\utils\\bin\\gmake" -k -j 4 all -O

    Building target: "simple_peripheral_cc2640r2lp_app.out"
    Invoking: Arm Linker
    "C:/ti/ti-cgt-arm_18.12.5.LTS/bin/armcl" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/build_components.opt" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/factory_config.opt" --cmd_file="D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/TOOLS/build_config.opt" -mv7M3 --code_state=16 -me -O4 --opt_for_speed=1 --define=myboard --define=DeviceFamily_CC26X0R2 --define=BOARD_DISPLAY_USE_LCD=0 --define=BOARD_DISPLAY_USE_UART=1 --define=BOARD_DISPLAY_USE_UART_ANSI=1 --define=CC26XX --define=CC26XX_R2 --define=ICALL_EVENTS --define=ICALL_JT --define=ICALL_LITE --define=ICALL_MAX_NUM_ENTITIES=6 --define=ICALL_MAX_NUM_TASKS=3 --define=ICALL_STACK0_ADDR --define=MAX_NUM_BLE_CONNS=1 --define=POWER_SAVING --define=STACK_LIBRARY --define=USE_ICALL --define=xdc_runtime_Assert_DISABLE_ALL --define=xdc_runtime_Log_DISABLE_ALL -g --c99 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi -z -m"simple_peripheral_cc2640r2lp_app.map" --heap_size=0 --stack_size=256 -i"C:/ti/ti-cgt-arm_18.12.5.LTS/lib" -i"C:/ti/ti-cgt-arm_18.12.5.LTS/include" --reread_libs --define=CC26X0ROM=2 --diag_suppress=16002-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D --diag_suppress=16032-D --diag_wrap=off --display_error_number --warn_sections --xml_link_info="simple_peripheral_cc2640r2lp_app_linkInfo.xml" --rom_model -o "simple_peripheral_cc2640r2lp_app.out" "./Application/att_rsp.obj" "./Application/simple_peripheral.obj" "./Application/util.obj" "./Drivers/ECC/ECCROMCC26XX.obj" "./Drivers/RF/RFCC26XX_singleMode.obj" "./Drivers/TRNG/TRNGCC26XX.obj" "./ICall/icall.obj" "./ICall/icall_cc2650.obj" "./ICall/icall_user_config.obj" "./ICallBLE/ble_user_config.obj" "./ICallBLE/icall_api_lite.obj" "./PROFILES/devinfoservice.obj" "./PROFILES/gatt_uuid.obj" "./PROFILES/gattservapp_util.obj" "./PROFILES/peripheral.obj" "./PROFILES/simple_gatt_profile.obj" "./Startup/board.obj" "./Startup/ccfg_app_ble.obj" "./Startup/main.obj" -l"configPkg/linker.cmd" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/devices/cc26x0r2/driverlib/bin/ccs/driverlib.lib" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/kernel/tirtos/packages/ti/dpl/lib/dpl_cc26x0r2.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/drivers/lib/drivers_cc26x0r2.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/display/lib/display.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/grlib/lib/ccs/m3/grlib.a" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/ble_r2.symbols" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/lib_linker.cmd" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/simple_peripheral_cc2640r2lp_stack_library.lib" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/common/cc26xx/ccs/cc26xx_app.cmd" -llibc.a
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    Board_initHook <whole-program>
    TRNGCC26XX_config <whole-program>

    error #10234-D: unresolved symbols remain

    error #10010: errors encountered during linking; "simple_peripheral_cc2640r2lp_app.out" not built
    >> Compilation failure
    makefile:180: recipe for target 'simple_peripheral_cc2640r2lp_app.out' failed
    gmake[1]: *** [simple_peripheral_cc2640r2lp_app.out] Error 1
    gmake: *** [all] Error 2
    makefile:173: recipe for target 'all' failed

    **** Build Finished ****

  • Hi,

    The guide for custom board files is okay, but the CCS project will become not portable for sharing externally. Also will take you a long time if your new to this.

    Do this delete the board.c at Startup folder.

    Go to C:\ti\simplelink_cc2640r2_sdk_5_30_00_03\source\ti\blestack\boards\CC2640R2_LAUNCHXL. Then drag and drop the 4 board files to Startup folder. Startup folder should contain these 4 board files. Then rebuild all. These 2 steps will just take about 30 seconds.

    Open CC2640R2_LAUNCHXL.h and set the correct define for your RF Front End and Bias configuration.

    After that you can modify the board files for your custom board.

    -kel

  • HI  kelI

    tried following the above steps, but the compilation still does not pass.

    TDY

     

  • **** Build of configuration FlashROM_StackLibrary for project simple_peripheral_cc2640r2lp_app ****

    "C:\\ti\\ccs1220\\ccs\\utils\\bin\\gmake" -k -j 4 all -O

    Building file: "../Startup/CC2640R2_LAUNCHXL_fxns.c"
    Invoking: Arm Compiler
    "C:/ti/ti-cgt-arm_18.12.5.LTS/bin/armcl" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/build_components.opt" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/factory_config.opt" --cmd_file="D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/TOOLS/build_config.opt" -mv7M3 --code_state=16 -me -O4 --opt_for_speed=1 --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Application" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Startup" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/PROFILES" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Include" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/controller/cc26xx_r2/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/rom" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/common/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/examples/rtos/CC2640R2_LAUNCHXL/blestack/simple_peripheral/src/app" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/icall/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/dev_info" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/roles/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/roles" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/simple_profile/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/simple_profile" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/target" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/target/_common" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/target/_common/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/heapmgr" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/icall/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/osal/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/services/src/saddr" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/services/src/sdata" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/devices/cc26x0r2" --include_path="C:/ti/ti-cgt-arm_18.12.5.LTS/include" --define=DeviceFamily_CC26X0R2 --define=BOARD_DISPLAY_USE_LCD=0 --define=BOARD_DISPLAY_USE_UART=1 --define=BOARD_DISPLAY_USE_UART_ANSI=1 --define=CC2640R2_LAUNCHXL --define=CC26XX --define=CC26XX_R2 --define=ICALL_EVENTS --define=ICALL_JT --define=ICALL_LITE --define=ICALL_MAX_NUM_ENTITIES=6 --define=ICALL_MAX_NUM_TASKS=3 --define=ICALL_STACK0_ADDR --define=MAX_NUM_BLE_CONNS=1 --define=POWER_SAVING --define=STACK_LIBRARY --define=USE_ICALL --define=xdc_runtime_Assert_DISABLE_ALL --define=xdc_runtime_Log_DISABLE_ALL -g --c99 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="Startup/CC2640R2_LAUNCHXL_fxns.d_raw" --obj_directory="Startup" --cmd_file="configPkg/compiler.opt" "../Startup/CC2640R2_LAUNCHXL_fxns.c"
    Finished building: "../Startup/CC2640R2_LAUNCHXL_fxns.c"

    Building file: "../Startup/CC2640R2_LAUNCHXL.c"
    Invoking: Arm Compiler
    "C:/ti/ti-cgt-arm_18.12.5.LTS/bin/armcl" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/build_components.opt" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/factory_config.opt" --cmd_file="D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/TOOLS/build_config.opt" -mv7M3 --code_state=16 -me -O4 --opt_for_speed=1 --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Application" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Startup" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/PROFILES" --include_path="D:/workspace_v11/simple_peripheral_cc2640r2lp_app/Include" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/controller/cc26xx_r2/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/rom" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/common/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/examples/rtos/CC2640R2_LAUNCHXL/blestack/simple_peripheral/src/app" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/icall/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/dev_info" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/roles/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/roles" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/simple_profile/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/profiles/simple_profile" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/target" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/target/_common" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/target/_common/cc26xx" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/hal/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/heapmgr" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/icall/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/osal/src/inc" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/services/src/saddr" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/services/src/sdata" --include_path="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/devices/cc26x0r2" --include_path="C:/ti/ti-cgt-arm_18.12.5.LTS/include" --define=DeviceFamily_CC26X0R2 --define=BOARD_DISPLAY_USE_LCD=0 --define=BOARD_DISPLAY_USE_UART=1 --define=BOARD_DISPLAY_USE_UART_ANSI=1 --define=CC2640R2_LAUNCHXL --define=CC26XX --define=CC26XX_R2 --define=ICALL_EVENTS --define=ICALL_JT --define=ICALL_LITE --define=ICALL_MAX_NUM_ENTITIES=6 --define=ICALL_MAX_NUM_TASKS=3 --define=ICALL_STACK0_ADDR --define=MAX_NUM_BLE_CONNS=1 --define=POWER_SAVING --define=STACK_LIBRARY --define=USE_ICALL --define=xdc_runtime_Assert_DISABLE_ALL --define=xdc_runtime_Log_DISABLE_ALL -g --c99 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="Startup/CC2640R2_LAUNCHXL.d_raw" --obj_directory="Startup" --cmd_file="configPkg/compiler.opt" "../Startup/CC2640R2_LAUNCHXL.c"
    "..\Startup\CC2640R2_LAUNCHXL.h", line 71: warning #48-D: incompatible redefinition of macro "CC2640R2_LAUNCHXL"
    Finished building: "../Startup/CC2640R2_LAUNCHXL.c"

    Building target: "simple_peripheral_cc2640r2lp_app.out"
    Invoking: Arm Linker
    "C:/ti/ti-cgt-arm_18.12.5.LTS/bin/armcl" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/build_components.opt" --cmd_file="C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/config/factory_config.opt" --cmd_file="D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/TOOLS/build_config.opt" -mv7M3 --code_state=16 -me -O4 --opt_for_speed=1 --define=DeviceFamily_CC26X0R2 --define=BOARD_DISPLAY_USE_LCD=0 --define=BOARD_DISPLAY_USE_UART=1 --define=BOARD_DISPLAY_USE_UART_ANSI=1 --define=CC2640R2_LAUNCHXL --define=CC26XX --define=CC26XX_R2 --define=ICALL_EVENTS --define=ICALL_JT --define=ICALL_LITE --define=ICALL_MAX_NUM_ENTITIES=6 --define=ICALL_MAX_NUM_TASKS=3 --define=ICALL_STACK0_ADDR --define=MAX_NUM_BLE_CONNS=1 --define=POWER_SAVING --define=STACK_LIBRARY --define=USE_ICALL --define=xdc_runtime_Assert_DISABLE_ALL --define=xdc_runtime_Log_DISABLE_ALL -g --c99 --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi -z -m"simple_peripheral_cc2640r2lp_app.map" --heap_size=0 --stack_size=256 -i"C:/ti/ti-cgt-arm_18.12.5.LTS/lib" -i"C:/ti/ti-cgt-arm_18.12.5.LTS/include" --reread_libs --define=CC26X0ROM=2 --diag_suppress=16002-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D --diag_suppress=16032-D --diag_wrap=off --display_error_number --warn_sections --xml_link_info="simple_peripheral_cc2640r2lp_app_linkInfo.xml" --rom_model -o "simple_peripheral_cc2640r2lp_app.out" "./Application/att_rsp.obj" "./Application/simple_peripheral.obj" "./Application/util.obj" "./Drivers/ECC/ECCROMCC26XX.obj" "./Drivers/RF/RFCC26XX_singleMode.obj" "./Drivers/TRNG/TRNGCC26XX.obj" "./ICall/icall.obj" "./ICall/icall_cc2650.obj" "./ICall/icall_user_config.obj" "./ICallBLE/ble_user_config.obj" "./ICallBLE/icall_api_lite.obj" "./PROFILES/devinfoservice.obj" "./PROFILES/gatt_uuid.obj" "./PROFILES/gattservapp_util.obj" "./PROFILES/peripheral.obj" "./PROFILES/simple_gatt_profile.obj" "./Startup/CC2640R2_LAUNCHXL.obj" "./Startup/CC2640R2_LAUNCHXL_fxns.obj" "./Startup/ccfg_app_ble.obj" "./Startup/main.obj" -l"configPkg/linker.cmd" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/devices/cc26x0r2/driverlib/bin/ccs/driverlib.lib" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/kernel/tirtos/packages/ti/dpl/lib/dpl_cc26x0r2.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/drivers/lib/drivers_cc26x0r2.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/display/lib/display.aem3" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/grlib/lib/ccs/m3/grlib.a" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/ble_r2.symbols" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/lib_linker.cmd" -l"D:/workspace_v11/simple_peripheral_cc2640r2lp_stack_library/FlashROM_Library/simple_peripheral_cc2640r2lp_stack_library.lib" -l"C:/ti/simplelink_cc2640r2_sdk_5_30_00_03/source/ti/blestack/common/cc26xx/ccs/cc26xx_app.cmd" -llibc.a
    <Linking>

    undefined first referenced
    symbol in file
    --------- ----------------
    TRNGCC26XX_config <whole-program>

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

    >> Compilation failure
    makefile:181: recipe for target 'simple_peripheral_cc2640r2lp_app.out' failed
    gmake[1]: *** [simple_peripheral_cc2640r2lp_app.out] Error 1
    makefile:174: recipe for target 'all' failed
    gmake: *** [all] Error 2

    构建完成 ****

  • Hi,

    Can you start from beginning and delete your simple peripheral from your workspace. Also I recommend you create your CCS workspace folder in c:\ti. Example C:\ti\ccs122_workspace.

    Copy the board files from here C:\ti\simplelink_cc2640r2_sdk_5_30_00_03\source\ti\blestack\boards\CC2640R2_LAUNCHXL to Startup folder. These board files should be the original and not modified.

    Rebuild all the stack library project then the app project. Actually this is not necessary, you can just rebuild all the app project.

    I just did the above steps yesterday and did not encounter any errors.

    -kel

  • I checked the error, my file was copied from this path, so the compilation did not pass, after changing the copied file the compilation passed, now I try to change the definition of the 5X5 chip.

  • I will provide an additional step before you go to modify the pinout from the board files. Open CC2640R2_LAUNCHXL.c and go to BoardGpioInitTable[]. Comment out all the entries in the table like this below.

    Enable hex generation.

    Rebuild all, then flash the hex file using Uniflash or SmartRF Flash Programmer2. 

    You should be able to see the device advertising using IOS LightBlue App or Android nrF Connect App. At this point a basic Bluetooth program is running on your custom board. After that you can modify the board files to work for your custom board.

    -kel

  • HI  kel

    I tried your method and now my custom hardware can be connected to my smartphone and I can start my modification work.

    tdy

  • HI  kel

    I used SYSCONFIG to generate "board.h" and "board.c" and import them into the "empty" project when I was testing the hardware. GPIO and SPI are working.

    6371.Board.c
    /*
     *  ======== Board.c ========
     *  Configured TI-Drivers module definitions
     *
     *  DO NOT EDIT - This file is generated for the CC2640R2FRHB
     *  by the SysConfig tool.
     */
    
    #include <stddef.h>
    
    #ifndef DeviceFamily_CC26X0R2
    #define DeviceFamily_CC26X0R2
    #endif
    
    #include <ti/devices/DeviceFamily.h>
    
    #include "Board.h"
    
    /*
     *  ============================= Display =============================
     */
    
    #include <ti/display/Display.h>
    #include <ti/display/DisplayHost.h>
    
    #define Display_HOSTBUFFERSIZE 256
    static char displayHostBuffer[Display_HOSTBUFFERSIZE];
    
    DisplayHost_Object displayHostObject;
    
    const DisplayHost_HWAttrs displayHostHWAttrs = {
        .strBuf = displayHostBuffer,
        .strBufLen = Display_HOSTBUFFERSIZE
    };
    
    const Display_Config Display_config[] = {
        /* Board_Display0 */
        {
            .fxnTablePtr = &DisplayHost_fxnTable,
            .object      = &displayHostObject,
            .hwAttrs     = &displayHostHWAttrs
        },
    };
    
    const uint_least8_t Display_count = 1;
    
    
    
    /*
     *  =============================== DMA ===============================
     */
    
    #include <ti/drivers/dma/UDMACC26XX.h>
    #include <ti/devices/cc26x0r2/driverlib/udma.h>
    #include <ti/devices/cc26x0r2/inc/hw_memmap.h>
    
    UDMACC26XX_Object udmaCC26XXObject;
    
    const UDMACC26XX_HWAttrs udmaCC26XXHWAttrs = {
        .baseAddr        = UDMA0_BASE,
        .powerMngrId     = PowerCC26XX_PERIPH_UDMA,
        .intNum          = INT_DMA_ERR,
        .intPriority     = (~0)
    };
    
    const UDMACC26XX_Config UDMACC26XX_config[1] = {
        {
            .object         = &udmaCC26XXObject,
            .hwAttrs        = &udmaCC26XXHWAttrs,
        },
    };
    
    
    /*
     *  =============================== GPIO ===============================
     */
    
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/gpio/GPIOCC26XX.h>
    
    /*
     *  ======== gpioPinConfigs ========
     *  Array of Pin configurations
     */
    GPIO_PinConfig gpioPinConfigs[] = {
        /* KEY */
        GPIOCC26XX_DIO_12 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING,
        /* DIO1 */
        GPIOCC26XX_DIO_07 | GPIO_CFG_IN_NOPULL | GPIO_CFG_IN_INT_FALLING,
        /* LED0 */
        GPIOCC26XX_DIO_11 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
        /* NSS */
        GPIOCC26XX_DIO_00 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
        /* RST */
        GPIOCC26XX_DIO_04 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_MED | GPIO_CFG_OUT_HIGH,
        /* BUSY */
        GPIOCC26XX_DIO_08 | GPIO_CFG_IN_NOPULL | GPIO_CFG_IN_INT_NONE,
    };
    
    /*
     *  ======== gpioCallbackFunctions ========
     *  Array of callback function pointers
     *
     *  NOTE: Unused callback entries can be omitted from the callbacks array to
     *  reduce memory usage by enabling sorting (GPIO.optimizeCallbackTableSize = true)
     */
    extern void KEYCALLBACK(uint_least8_t index);
    extern void DIO1_Callback(uint_least8_t index);
    
    GPIO_CallbackFxn gpioCallbackFunctions[] = {
        /* KEY */
        KEYCALLBACK,
        /* DIO1 */
        DIO1_Callback,
    };
    
    /*
     *  ======== GPIOCC26XX_config ========
     */
    const GPIOCC26XX_Config GPIOCC26XX_config = {
        .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
        .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
        .numberOfPinConfigs = 6,
        .numberOfCallbacks = 2,
        .intPriority = (~0)
    };
    
    
    /*
     *  =============================== PIN ===============================
     */
    
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    const PIN_Config BoardGpioInitTable[] = {
        /* Parent Signal: LED0 GPIO Pin, (DIO11) */
        Board_PIN0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
        /* Parent Signal: KEY GPIO Pin, (DIO12) */
        Board_PIN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
        /* Parent Signal: NSS GPIO Pin, (DIO0) */
        Board_PIN7 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
        /* Parent Signal: RST GPIO Pin, (DIO4) */
        Board_PIN8 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MED,
        /* Parent Signal: BUSY GPIO Pin, (DIO8) */
        Board_PIN9 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
        /* Parent Signal: DIO1 GPIO Pin, (DIO7) */
        Board_PIN5 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
        /* Parent Signal: Board_SPI0 SCLK, (DIO1) */
        Board_PIN2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
        /* Parent Signal: Board_SPI0 MISO, (DIO3) */
        Board_PIN3 | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_DIS,
        /* Parent Signal: Board_SPI0 MOSI, (DIO2) */
        Board_PIN4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
    
        PIN_TERMINATE
    };
    
    const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
        .intPriority = (~0),
        .swiPriority = 0
    };
    
    
    /*
     *  =============================== Power ===============================
     */
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    #include "Board.h"
    
    extern void PowerCC26XX_standbyPolicy(void);
    extern bool PowerCC26XX_calibrate(unsigned int);
    
    const PowerCC26XX_Config PowerCC26XX_config = {
        .enablePolicy             = true,
        .policyInitFxn            = NULL,
        .policyFxn                = PowerCC26XX_standbyPolicy,
        .calibrateFxn             = PowerCC26XX_calibrate,
        .vddrRechargeMargin       = 0,
        .calibrateRCOSC_LF        = true,
        .calibrateRCOSC_HF        = true,
    };
    
    
    /*
     *  =============================== RF Driver ===============================
     */
    
    #include <ti/drivers/rf/RF.h>
    
    const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
        .hwiPriority        = (~0),
        .swiPriority        = (uint8_t)0,
        .xoscHfAlwaysNeeded = true,
        .globalCallback     = NULL,
        .globalEventMask    = 0
    };
    
    
    /*
     *  =============================== SPI DMA ===============================
     */
    #include <ti/drivers/SPI.h>
    #include <ti/drivers/spi/SPICC26XXDMA.h>
    
    #define Board_SPICOUNT 1
    
    /*
     *  ======== spiCC26XXDMAObjects ========
     */
    SPICC26XXDMA_Object spiCC26XXDMAObjects[Board_SPICOUNT];
    
    /*
     *  ======== spiCC26XXDMAHWAttrs ========
     */
    const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[Board_SPICOUNT] = {
        /* Board_SPI0 */
        {
            .baseAddr = SSI0_BASE,
            .intNum = INT_SSI0_COMB,
            .intPriority = (~0),
            .swiPriority = 0,
            .powerMngrId = PowerCC26XX_PERIPH_SSI0,
            .defaultTxBufValue = ~0,
            .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
            .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
            .minDmaTransferSize = 10,
            .mosiPin = IOID_2,
            .misoPin = IOID_3,
            .clkPin  = IOID_1,
            .csnPin  = PIN_UNASSIGNED
        },
    };
    
    /*
     *  ======== SPI_config ========
     */
    const SPI_Config SPI_config[Board_SPICOUNT] = {
        /* Board_SPI0 */
        {
            .fxnTablePtr = &SPICC26XXDMA_fxnTable,
            .object = &spiCC26XXDMAObjects[Board_SPI0],
            .hwAttrs = &spiCC26XXDMAHWAttrs[Board_SPI0]
        },
    };
    
    const uint_least8_t SPI_count = Board_SPICOUNT;
    
    
    #include <ti/drivers/Board.h>
    
    /*
     *  ======== Board_initHook ========
     *  Perform any board-specific initialization needed at startup.  This
     *  function is declared weak to allow applications to override it if needed.
     */
    #if defined(__IAR_SYSTEMS_ICC__)
    __weak void Board_initHook(void)
    #elif defined(__GNUC__) && !defined(__ti__)
    void __attribute__((weak)) Board_initHook(void)
    #else
    #pragma WEAK (Board_initHook)
    void Board_initHook(void)
    #endif
    {
    }
    
    /*
     *  ======== Board_init ========
     *  Perform any initialization needed before using any board APIs
     */
    void Board_init(void)
    {
        /* ==== /ti/drivers/Power initialization ==== */
        Power_init();
    
        /* ==== /ti/drivers/PIN initialization ==== */
        if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
            /* Error with PIN_init */
            while (1);
        }
    
        Board_initHook();
    }
    
    3010.Board.h

  • Hi,

    I was going to use "board.h" and "board.c" to replace "CC2640R2_LAUNCHXL.c" and "CC2640R2_LAUNCHXL.h "d but it didn't work.
    I encountered some problems when copying CC2640R2_LAUNCHXL for modification, as follows:

    I am trying to modify this enumeration according to the PIN definition on my board, but its elements are used in other functions and the modification will cause the compilation to fail, how do I continue my work?5187.Startup.zip

  • Hi,

    Hi regarding the GPIO functions, If you want to go in that direction take your time to learn how everything is related in the board files Board.h, CC2640R2_LAUNCHXL.c, CC2640R2_LAUNCHXL.h.

    The easier path is to use PIN functions. You can get familiar with that by testing the pin interrupt example program in the location below.

    C:\ti\simplelink_cc2640r2_sdk_5_30_00_03\examples\rtos\CC2640R2_LAUNCHXL\drivers

    -kel

  • HI,kel

    Maybe I didn't express myself clearly, I changed Board.h, CC2640R2_LAUNCHXL.c, CC2640R2_LAUNCHXL.h according to the method you provided

    But how to modify Board.h, CC2640R2_LAUNCHXL.c, CC2640R2_LAUNCHXL.h to make it work for 5X5 chips is not clear to me.

    Modify to this point can not be modified

  • Modify to this point can not be modified

    It can be done, I have done it a lot. I will get back to you tomorrow.

    -kel

  • HI kel

    I will try again this evening

    tdy

  • HI kel

    I can already control the LED on the board, you can handle other work first, if I encounter any problems and then ask you for advice, thank you very much for your patience and guidance!

    tdy

    Regards,

  • 1376.simple_peripheral_cc2640r2lp_app.zip

    The hardware used in the project is LAUNCHXL-CC2640R2.

    I would be grateful if I could get your reply

    tdy

    regards,

  • Hi,

    I don't see in your code where you initialize the SPI by calling SPI_init(). Anyway, I suggest you create a new post regarding your new problem.

    -kel

  • HI kel

    In main.c called SPI_init().

    tdy

    regards,