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.

[参考译文] CC1310:在同时使用传感器控制器单元的同时使用 TI-RTOS 进入睡眠模式时崩溃

Guru**** 2469140 points
Other Parts Discussed in Thread: CC1310

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1433326/cc1310-crash-on-entering-sleep-mode-with-ti-rtos-while-using-sensor-controller-unit-simultaneously

器件型号:CC1310

工具与软件:

您好!

我正在使用 CC1310上的传感器控制器单元通过 I2C 总线读取温度传感器并将数据传递到主处理器。 一切都运行正常、直到我尝试使用 Semaphore_pend (enterDeepSleepHandle、BIOS_wait_forever)信号来将主处理器置于睡眠模式。 我将使用计时器以设定的间隔布置信标。

如果我尝试在不使用传感器控制器单元的情况下将主处理器置于睡眠模式、则一切都正常。 如果我使用传感器控制器单元、但不要尝试将主处理器置于睡眠状态、一切都运行正常。

如果有任何帮助、将不胜感激。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这是我的代码、以防提供任何有用的上下文。

    下面是我在 Sensor Controller Studio 中生成的代码:

    U16 sensor1;
    U16 sensor2;
    
    i2cDeviceReadReg16MsbFirst((0x48 << 1) , 0x00; sensor1);
    i2cDeviceReadReg16MsbFirst((0x49 << 1) , 0x00; sensor2);
    
    output.temperatureSensor1 = sensor1;
    output.temperatureSensor2 = sensor2;

    以下是我的 CCS 代码:


    RTOSmain.c

    	// Initialize the SCIF operating system abstraction layer
    	scifOsalInit();
    	scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    	scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    
    	// Initialize the SCIF driver
    	scifInit(&scifDriverSetup);

    Task1main.cpp

    此函数从传感器控制器单元读取数据

    void readSensors(){
        scifSwTriggerExecutionCodeNbl(1 << SCIF_MONITOR_TEMPERATURE_TASK_ID);
        uint16_t sensor1 =
    	scifTaskData.readSensors.output.temperatureSensor1;
    	uint16_t sensor2 =
    	scifTaskData.readSensors.output.temperatureSensor2;
    }

    主循环

    main(){
        scifStartTasksNbl(1 << SCIF_READSENSORS_TASK_ID);
        
        while(){
            ... DO OTHER STUFF
            
            Semaphore_pend(enterDeepSleepHandle, BIOS_WAIT_FOREVER);
        }
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、RLB、

    您遇到了什么问题?

    此外、我还想知道、如果应用程序允许、是否可以使用 scifOsalRegisterTaskAlertCallback 中注册的方法发布信标。 如果您这样做、您是否仍然看到问题?

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Arthur R、

    我遇到的问题是、CC1310在执行"semaphore_pend (enterDeepSleepHandle、BIOS_wait_forever);"命令后立即崩溃。 由于我还实现了 CC1310的看门狗功能、因此系统将在执行上述命令后复位。 如果我禁用看门狗、系统将冻结。

    "另外,我想知道你是否可以在 scifOsalRegisterTaskAlertCallback 中注册的方法中发布信标,"

    这是可能的、但我希望它的工作方式如下:


    1.在给定的时间间隔内启动定时器。 使用" semaphore_pend (enterDeepSleepHandle、BIOS_WAIT_FOREVER);"将系统(主处理器)置于睡眠状态。

    2.使用计时器回调函数发布信标

    3.使用传感器控制器单元读取 i2c 总线上的传感器。

    4.将系统恢复休眠并重复

    SCU 不使用 RTC 执行、而是使用手动触发器" scifSwTriggerExecutionCodeNbl (1 << SCIF_READSENSORS_TASK_ID);"出于某些原因、带有"BIOS_WAIT_FOREVER "的 TI-RTOS/信标挂起不能很好地与 SCU 配合使用。

    您好!
    RLB

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、RLB、

    这是否与您正在做的事情接近? 我似乎没有看到同样的问题。

    /*
     * Copyright (c) 2015-2019, 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.
     */
    
    /*
     *  ======== empty.c ========
     */
    
    /* For usleep() */
    #include <unistd.h>
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/timer/GPTimerCC26XX.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/BIOS.h>
    // #include <ti/drivers/I2C.h>
    // #include <ti/drivers/SPI.h>
    // #include <ti/drivers/UART.h>
    // #include <ti/drivers/Watchdog.h>
    
    /* Board Header file */
    #include "Board.h"
    #include "scif.h"
    
    uint16_t counter = 0;
    GPTimerCC26XX_Handle hTimer;
    Semaphore_Handle enterDeepSleepHandle;
    
    void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
    {
        GPIO_toggle(Board_GPIO_LED0);
        Semaphore_post(enterDeepSleepHandle);
    }
    
    // SCIF driver callback: Task control interface ready (non-blocking task control operation completed)
    void scCtrlReadyCallback(void)
    {
    
    }
    
    // SCIF driver callback: Sensor Controller task code has generated an alert interrupt
    void scTaskAlertCallback(void)
    {
        counter = scifTaskData.ledBlinker.output.counter;
    }
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* 1 second delay */
        uint32_t time = 1;
        Semaphore_Params semParams;
        Semaphore_Struct semStruct;
    
        /* Call driver init functions */
        GPIO_init();
        // I2C_init();
        // SPI_init();
        // UART_init();
        // Watchdog_init();
    
        /* Configure the LED pin */
        GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        /* Turn on user LED */
        GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
    
        // Initialize the SCIF operating system abstraction layer
        scifOsalInit();
        scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    
        // Initialize the SCIF driver
        scifInit(&scifDriverSetup);
    
        // Enable RTC ticks, with N Hz tick interval
        // scifStartRtcTicksNow(0x00010000 / 1);
    
        // Start the "LED Blinker" Sensor Controller task
        //scifStartTasksNbl(1 << SCIF_LED_BLINKER_TASK_ID);
    
        /* Construct a Semaphore object to be use as a resource lock, inital count 1 */
        Semaphore_Params_init(&semParams);
        Semaphore_construct(&semStruct, 1, &semParams);
    
        /* Obtain instance handle */
        enterDeepSleepHandle = Semaphore_handle(&semStruct);
    
        GPTimerCC26XX_Params params;
        GPTimerCC26XX_Params_init(&params);
    
        params.width          = GPT_CONFIG_16BIT;
        params.mode           = GPT_MODE_PERIODIC;
        params.direction      = GPTimerCC26XX_DIRECTION_UP;
        params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
    
        hTimer = GPTimerCC26XX_open(Board_GPTIMER0A, &params);
        if(hTimer == NULL) {
            while(1);
        }
    
        xdc_runtime_Types_FreqHz  freq;
        BIOS_getCpuFreq(&freq);
        GPTimerCC26XX_Value loadVal = freq.lo / 1 - 1; //47999
    
        GPTimerCC26XX_setLoadValue(hTimer, loadVal);
        GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);
        GPTimerCC26XX_start(hTimer);
    
        while (1) {
            Semaphore_pend(enterDeepSleepHandle, BIOS_WAIT_FOREVER);
            scifSwTriggerExecutionCodeNbl(1 << SCIF_LED_BLINKER_TASK_ID);
        }
    }
    

    此外、是否有理由不使用传感器控制器任务的 RTC 调度? 请告诉我。

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Arthur R、

    大家好、我找到了一些可能相关的内容。 开始时、我没有将传感器控制器中的第二项任务视为导致该问题的潜在原因、因为我没有开始执行这项任务。 不过,我错了。  第二个任务是来自 TI-RTOS 的按钮去抖示例:
    "> software-dl.ti.com/.../gpio_event_trigger__0.html

    我正在使用 CC1310 4x4封装的定制电路板、并且还在 TI CC1310 LaunchPad 上测试了相同的代码、而该问题不会在 LaunchPad 上发生。

    该问题可能与使用4x4 CC1310封装以及 TI 传感器控制器单元去抖示例相关。


    您好!
    RLB

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、RLB、

    这是一个有趣的数据点。 在 Sensor Controller Studio 中、您是否还选择了4x4封装?

    请告诉我、

    此致、

    Arthur

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Arthur R、

    是、
    我在使用定制板时选择了4x4、在使用 Launchpad 时选择了7x7  

    您好!
    RLB

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、RLB、

    在您的定制电路板上、您是否已经证明 AIO 引脚排列与您的预期匹配?

    请注意、根据下表、DIO 和 AUXIO 匹配存在差异、具体取决于封装。

    这也适用于电源域、这可能是导致崩溃的原因:

    此外、在您的应用代码上、您还可以使用下一页中的"支持的 ADC 引脚"表 :https://dev.ti.com/tirex/explore/content/simplelink_cc13x0_sdk_4_20_02_07/docs/tidrivers/doxygen/html/_a_d_c_buf_c_c26_x_x_8h.html

    作为要选择哪些引脚的基准。

    此致、

    Arthur