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.

CC2340R5: CC2340 RF Output Problems

Part Number: CC2340R5

Hi,

I can configure the GPIO to output RF signals in the basic_ble project, but I can't output RF signals after configuring it in the connection_monitor project.

I refer to this dev.ti.com/.../ble-stack-5 .x-guide/debugging-index-cc23xx.html#debugging-rf-output

sdk:simplelink_lowpower_f3_sdk_7_40_00_64

  • Hi wangrenli,

    Here is a direct link to the BLE5-Stack Debugging Guide.  Are you using a LaunchPad or custom hardware?  Please clarify what/where specific code changes have been applied, how you are monitoring DIO11/DIO21, and why you believe the solution to be ineffective.

    Regards,
    Ryan

  • Hi,

    The development board I'm using is LaunchPad, I didn't find dbell_regs.h and HWREG_WRITE_LRF in sdk_7_40_00_64. i used HWREG instead of HWREG_WRITE_LRF, and I can output RF signals in basic_ble project, the same thing is done in the connection_monitor project can't output RF signal, I have been able to sample RSSI.

    The following files are the modification points for both projects

    /******************************************************************************
    
     @file  main_freertos.c
    
     @brief main entry of the BLE stack sample application.
    
     Group: WCS, BTS
     Target Device: cc23xx
    
     ******************************************************************************
     
     Copyright (c) 2013-2023, 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.
    
     ******************************************************************************
     
     
     *****************************************************************************/
    
    /*******************************************************************************
     * INCLUDES
     */
    
    /* RTOS header files */
    #include <FreeRTOS.h>
    #include <stdint.h>
    #include <task.h>
    #ifdef __ICCARM__
        #include <DLib_Threads.h>
    #endif
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC23X0.h>
    #include <ti/display/Display.h>
    #include <ti/drivers/UART2.h>
    #include <ti/common/cc26xx/uartlog/UartLog.h>
    #include <ti/devices/DeviceFamily.h>
    
    #include <icall.h>
    #include "hal_assert.h"
    #include "bcomdef.h"
    
    #ifndef USE_DEFAULT_USER_CFG
    #include "ble_user_config.h"
    #include "ble_stack_api.h"
    // BLE user defined configuration
    icall_userCfg_t user0Cfg = BLE_USER_CFG;
    #endif // USE_DEFAULT_USER_CFG
    
    
    
    #include DeviceFamily_constructPath(inc/hw_types.h)
    #include DeviceFamily_constructPath(inc/hw_ioc.h)
    #include DeviceFamily_constructPath(inc/hw_memmap.h)
    
    
    
    /*******************************************************************************
     * MACROS
     */
    
    /*******************************************************************************
     * CONSTANTS
     */
    
    /*******************************************************************************
     * TYPEDEFS
     */
    
    /*******************************************************************************
     * LOCAL VARIABLES
     */
    
    /*******************************************************************************
     * GLOBAL VARIABLES
     */
    
    /*******************************************************************************
     * EXTERNS
     */
    extern void appMain(void);
    extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
    
    /*******************************************************************************
     * @fn          Main
     *
     * @brief       Application Main
     *
     * input parameters
     *
     * @param       None.
     *
     * output parameters
     *
     * @param       None.
     *
     * @return      None.
     */
    int main()
    {
      /* Register Application callback to trap asserts raised in the Stack */
      halAssertCback = AssertHandler;
      RegisterAssertCback(AssertHandler);
    
      Board_init();
    
      /* IO for TX Indication */
      HWREG(IOC_BASE + IOC_O_IOC11) |= IOC_IOC11_PORTCFG_PFUNC4;
      /* IO for RX Indication */
      HWREG(IOC_BASE + IOC_O_IOC21) |= IOC_IOC21_PORTCFG_PFUNC5;
    
    
      /* Update User Configuration of the stack */
      user0Cfg.appServiceInfo->timerTickPeriod = ICall_getTickPeriod();
      user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();
    
      /* Initialize all applications tasks */
      appMain();
    
      /* Start the FreeRTOS scheduler */
      vTaskStartScheduler();
    
      return 0;
    
    }
    
    //*****************************************************************************
    //
    //! \brief Application defined stack overflow hook
    //!
    //! \param  none
    //!
    //! \return none
    //!
    //*****************************************************************************
    void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName)
    {
        //Handle FreeRTOS Stack Overflow
        AssertHandler(HAL_ASSERT_CAUSE_STACK_OVERFLOW_ERROR, 0);
    }
    
    /*******************************************************************************
     * @fn          AssertHandler
     *
     * @brief       This is the Application's callback handler for asserts raised
     *              in the stack.  When EXT_HAL_ASSERT is defined in the Stack Wrapper
     *              project this function will be called when an assert is raised,
     *              and can be used to observe or trap a violation from expected
     *              behavior.
     *
     *              As an example, for Heap allocation failures the Stack will raise
     *              HAL_ASSERT_CAUSE_OUT_OF_MEMORY as the assertCause and
     *              HAL_ASSERT_SUBCAUSE_NONE as the assertSubcause.  An application
     *              developer could trap any malloc failure on the stack by calling
     *              HAL_ASSERT_SPINLOCK under the matching case.
     *
     *              An application developer is encouraged to extend this function
     *              for use by their own application.  To do this, add hal_assert.c
     *              to your project workspace, the path to hal_assert.h (this can
     *              be found on the stack side). Asserts are raised by including
     *              hal_assert.h and using macro HAL_ASSERT(cause) to raise an
     *              assert with argument assertCause.  the assertSubcause may be
     *              optionally set by macro HAL_ASSERT_SET_SUBCAUSE(subCause) prior
     *              to asserting the cause it describes. More information is
     *              available in hal_assert.h.
     *
     * input parameters
     *
     * @param       assertCause    - Assert cause as defined in hal_assert.h.
     * @param       assertSubcause - Optional assert subcause (see hal_assert.h).
     *
     * output parameters
     *
     * @param       None.
     *
     * @return      None.
     */
    void AssertHandler(uint8_t assertCause, uint8_t assertSubcause)
    {
        Log_error2(">>>STACK ASSERT Cause 0x%02x subCause 0x%02x",
                   assertCause, assertSubcause);
    
        // check the assert cause
        switch(assertCause)
        {
        case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
            Log_error0("***ERROR***");
            Log_error0(">> OUT OF MEMORY!");
            break;
    
        case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
            // check the subcause
            if(assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
            {
                Log_error0("***ERROR***");
                Log_error0(">> INTERNAL FW ERROR!");
            }
            else
            {
                Log_error0("***ERROR***");
                Log_error0(">> INTERNAL ERROR!");
            }
            break;
    
        case HAL_ASSERT_CAUSE_ICALL_ABORT:
            Log_error0("***ERROR***");
            Log_error0(">> ICALL ABORT!");
            //HAL_ASSERT_SPINLOCK;
            break;
    
        case HAL_ASSERT_CAUSE_ICALL_TIMEOUT:
            Log_error0("***ERROR***");
            Log_error0(">> ICALL TIMEOUT!");
            //HAL_ASSERT_SPINLOCK;
            break;
    
        case HAL_ASSERT_CAUSE_WRONG_API_CALL:
            Log_error0("***ERROR***");
            Log_error0(">> WRONG API CALL!");
            //HAL_ASSERT_SPINLOCK;
            break;
    
        case HAL_ASSERT_CAUSE_STACK_OVERFLOW_ERROR:
            Log_error0("***ERROR***");
            Log_error0(">> STACK OVERFLOW!");
            HAL_ASSERT_SPINLOCK;
            break;
    
        default:
            Log_error0("***ERROR***");
            Log_error0(">> DEFAULT SPINLOCK!");
            //HAL_ASSERT_SPINLOCK;
        }
    
        return;
    }
    
    
    /* ======== RCL_Tracer_enable ======== */
    void RCL_Tracer_enable(void)
    {
      /* TX, RX Indication */
      HWREG(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) = HWREG_READ_LRF(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) | LRFDDBELL_GPOSEL0_SRC0_RFEGPO0;
      HWREG(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) = HWREG_READ_LRF(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) | LRFDDBELL_GPOSEL0_SRC1_RFEGPO1;
    }
    
    
    
    /*******************************************************************************
     */
    

    /******************************************************************************
    
     @file  main_freertos.c
    
     @brief main entry of the BLE stack sample application.
    
     Group: WCS, BTS
     Target Device: cc23xx
    
     ******************************************************************************
     
     Copyright (c) 2023, 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.
    
     ******************************************************************************
     
     
     *****************************************************************************/
    
    /*******************************************************************************
     * INCLUDES
     */
    
    /* RTOS header files */
    
    #include <FreeRTOS.h>
    #include <stdint.h>
    #include <task.h>
    
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC23X0.h>
    #include <ti/drivers/GPIO.h>
    
    #include <ti/display/Display.h>
    
    #include <ti/devices/DeviceFamily.h>
    
    #include <pthread.h>
    
    #include "npi_data.h"
    
    #include <hal_assert.h>
    #include <bcomdef.h>
    #include <string.h>
    
    /* Header files required to enable instruction fetch cache */
    #include DeviceFamily_constructPath(inc/hw_memmap.h)
    #include "rtls_ctrl_api.h"
    #include "micro_ble_cm.h"
    
    #include "micro_cm_app.h"
    
    #ifdef USE_RCL
    #include DeviceFamily_constructPath(inc/hw_fcfg.h)
    #endif
    
    
    #include DeviceFamily_constructPath(inc/hw_types.h)
    #include DeviceFamily_constructPath(inc/hw_ioc.h)
    #include DeviceFamily_constructPath(inc/hw_memmap.h)
    
    /*******************************************************************************
     * MACROS
     */
    
    /*******************************************************************************
     * CONSTANTS
     */
    
    /*******************************************************************************
     * TYPEDEFS
     */
    
    /*******************************************************************************
     * LOCAL VARIABLES
     */
    
    /*******************************************************************************
     * GLOBAL VARIABLES
     */
    
    /*******************************************************************************
     * EXTERNS
     */
    extern assertCback_t halAssertCback;
    
    extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
    
    extern Display_Handle dispHandle;
    
    extern void NPIData_postAssertNpiMsgEvent(uint8_t assertType);
    
    /*******************************************************************************
     * @fn          Main
     *
     * @brief       Application Main
     *
     * input parameters
     *
     * @param       None.
     *
     * output parameters
     *
     * @param       None.
     *
     * @return      None.
     */
    int main()
    {
      /* Register Application callback to trap asserts raised in the Stack */
      halAssertCback = AssertHandler;
    
      Board_init();
    
    
      /* IO for TX Indication */
      HWREG(IOC_BASE + IOC_O_IOC11) |= IOC_IOC11_PORTCFG_PFUNC4;
      /* IO for RX Indication */
      HWREG(IOC_BASE + IOC_O_IOC21) |= IOC_IOC21_PORTCFG_PFUNC5;
      
      
      /* Create Application task. */
      MicroCmApp_init();
      MicroCmApp_stack_init();
    
      /* Kick off RTLS Control module - Priority 2 */
      rtlsConfiguration_t rtlsConfig;
    
      rtlsConfig.rtlsCapab = (rtlsCapabilities_e)(RTLS_CAP_RTLS_CONNECTION_MONITOR | RTLS_CAP_CM);
    
      // Device ID and revision
      rtlsConfig.devId = DeviceFamily_ID;
      rtlsConfig.revNum = RTLS_CTRL_REV;
    
      rtlsConfig.maxNumConns = CM_MAX_SESSIONS;
    
      // fetch BDADDR from FCFG
      memcpy( rtlsConfig.identifier, (uint8 *)fcfg->deviceInfo.bleAddr, CHIP_ID_SIZE );
    
      rtlsConfig.rtlsAppCb = MicroCmApp_rtlsCtrlMsgCb;
    
      RTLSCtrl_open(&rtlsConfig);
    
      /* Start the FreeRTOS scheduler */
      vTaskStartScheduler();
    
      return 0;
    }
    
    /*******************************************************************************
     * @fn          AssertHandler
     *
     * @brief       This is the callback handler for asserts raised in the stack or
     *              the application.
     *
     *              An application developer is encouraged to extend this function
     *              for use by their own application.  To do this, add hal_assert.c
     *              to your project workspace, the path to hal_assert.h (this can
     *              be found on the stack side). Asserts are raised by including
     *              hal_assert.h and using macro HAL_ASSERT(cause) to raise an
     *              assert with argument assertCause.  the assertSubcause may be
     *              optionally set by macro HAL_ASSERT_SET_SUBCAUSE(subCause) prior
     *              to asserting the cause it describes. More information is
     *              available in hal_assert.h.
     *
     * input parameters
     *
     * @param       assertCause    - Assert cause as defined in hal_assert.h.
     * @param       assertSubcause - Optional assert subcause (see hal_assert.h).
     *
     * output parameters
     *
     * @param       None.
     *
     * @return      None.
     */
    void AssertHandler(uint8 assertCause, uint8 assertSubcause)
    {
      // Free NPI task to send final NPI assert message
      NPIData_postAssertNpiMsgEvent(assertCause);
    
      // Open the display if the app has not already done so
      if ( !dispHandle )
      {
        dispHandle = Display_open(Display_Type_ANY, NULL);
      }
    
      // check the assert cause
      switch (assertCause)
      {
        case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
          // check the subcause
          if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
          {
          #if !defined(Display_DISABLE_ALL)
            Display_print0(dispHandle, 0, 0, "***ERROR***");
            Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
          #endif
          }
          else
          {
          #if !defined(Display_DISABLE_ALL)
            Display_print0(dispHandle, 0, 0, "***ERROR***");
            Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
          #endif
          }
    
          break;
    
        default:
        #if !defined(Display_DISABLE_ALL)
          Display_print0(dispHandle, 0, 0, "***ERROR***");
          Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
        #endif
          HAL_ASSERT_SPINLOCK;
      }
    
      return;
    }
    
    
    
    void RCL_Tracer_enable(void)
    {
      /* TX, RX Indication */
      HWREG(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) = HWREG_READ_LRF(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) | LRFDDBELL_GPOSEL0_SRC0_RFEGPO0;
      HWREG(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) = HWREG_READ_LRF(LRFDDBELL_BASE + LRFDDBELL_O_GPOSEL0) | LRFDDBELL_GPOSEL0_SRC1_RFEGPO1;
    }
    
    
    
    /*******************************************************************************
     */
    

  • Hi,

    To confirm, is the connection monitor example working as expected otherwise or are you seeing unexpected behavior when using the example?

    Best Regards,

    Jan

  • Hi,

    It works fine, I can listen to the RSSI value after I pass in the CM parameter

  • Hi,

    Got it. To confirm, is your use-case a central or peripheral role?

    Best Regards,

    Jan

  • Hi,

    peripheral role