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.

[参考译文] CC2642R:ADC Sensor Controller Studio x SCIF 框架

Guru**** 2538950 points
Other Parts Discussed in Thread: SIMPLELINK-CC13XX-CC26XX-SDK

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1120801/cc2642r-adc-sensor-controller-studio-x-scif-framework

器件型号:CC2642R
主题中讨论的其他器件:SIMPLELINK-CC13XX-CC26XX-SDK

您好!

我是一个新手、使用传感器控制器和传感器控制器工作室。

当 ADC 超过高阈值时、我需要快速响应。 我想示例 ADC Windows Monitor 就是这样做的。  

我刚刚更改了这个示例的 IO 和 adcWindowHigh 限制、当我使用任务测试执行这个示例时、它工作正常。 我可以看到预期的行为和正确的值。


但是、当我将项目导入到 Code Composer Studio 中时、我无法看到相同的行为、中断永远不会发生。

我尝试添加一个易失性变量来持续运行应用程序、但该变量永远不会改变。

这是我的更改代码:

  

...
// Task data
Task_Struct myTask;
Char myTaskStack[1024];


// Semaphore used to wait for Sensor Controller task ALERT event
static Semaphore_Struct semScTaskAlert;
volatile uint8_t state;




void scCtrlReadyCallback(void) {

} // scCtrlReadyCallback




void scTaskAlertCallback(void) {

    // Wake up the OS task
    Semaphore_post(Semaphore_handle(&semScTaskAlert));

} // scTaskAlertCallback




PIN_Config pLedPinTable[] = {
    Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    PIN_TERMINATE
};
PIN_State ledPinState;


void taskFxn(UArg a0, UArg a1) {
    PIN_Handle hLedPins;

    // Enable LED pins
    hLedPins = PIN_open(&ledPinState, pLedPinTable);

    // Initialize the Sensor Controller
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    scifInit(&scifDriverSetup);
    scifStartRtcTicksNow(0x00010000 / 8);

    // Configure and start the Sensor Controller's ADC window monitor task (not to be confused with OS tasks)
    scifTaskData.adcWindowMonitor.cfg.adcWindowHigh = 3300;
    scifTaskData.adcWindowMonitor.cfg.adcWindowLow  = 0;
    scifStartTasksNbl(BV(SCIF_ADC_WINDOW_MONITOR_TASK_ID));

    // Main loop
    while (1) {

        // Wait for an ALERT callback
        Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);

        // Clear the ALERT interrupt source
        scifClearAlertIntSource();

        // Indicate on LEDs whether the current ADC value is high and/or low
        if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_LOW) {
            PIN_setOutputValue(hLedPins, Board_GLED, 1);
            state = 1;
        } else {
            PIN_setOutputValue(hLedPins, Board_GLED, 0);
            state = 2;
        }
        if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_HIGH) {
            PIN_setOutputValue(hLedPins, Board_RLED, 1);
            state = 3;
        } else {
            PIN_setOutputValue(hLedPins, Board_RLED, 0);
            state = 4;
        }

        // Acknowledge the alert event
        scifAckAlertEvents();
    }

} // taskFxn
...

这是调试信息:

当我仅使用 HAL 驱动程序读取同一个 DIO 时、实际上可以读取与  使用任务测试时相同的值。

这是我的 ADC 配置:

我使用:

Sensor Controller Studio:版本2.6.0.132。

Code Composer Studio:版本:11.1.0.00011。

两者都具有 SimpleLink CC13x2 26x2 SDK 3.40.00.02。

提前感谢、

Cristiane Bellenzier Piaia

 

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

    您好、克里斯蒂安、

    以下是 传感器控制器基础 SLA 的链接。  我没有使用 IOID_30观察类似的行为、但我使用 SIMPLELINK-CC13XX-CC26XX-SDK 6.10版进行评估、并且没有将 adcWindowHigh/adcWindowLow 值与其默认值进行更改。  我建议您尝试相同的操作、并在更改应用程序之前准确验证默认示例工程是否已导入到 CCS 中。  使用极端值将很难触发"窗口"功能。  您无需在 CCS 中配置 ADC、因为这已经通过 Sensor Controller Studio 代码生成来实现。

    此致、
    Ryan

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

    早上好、Ryan、

    感谢您的快速回复。  

    我尝试了你说的。 在我的新测试中、我将 DIO 更改为使用30。  

    传感器控制器的结果相同、工作正常:

    但当我在 Code Composer 中尝试时、中断 不会发生。 :(

    代码是默认代码、在此测试中、我没有更改任何内容:

      

    //*****************************************************************************
    //  SENSOR CONTROLLER STUDIO EXAMPLE: ADC WINDOW MONITOR FOR LAUNCHPAD
    //  Operating system: TI-RTOS
    //
    //  The Sensor Controller is used to sample a single ADC channel and monitor
    //  the value. The Sensor Controller updates a bit-vector that indicates
    //  whether the ADC value is:
    //  - Below a configurable low threshold
    //  - Above a configurable high threshold
    //
    //  The Sensor Controller notifies the application when the bit-vector changes
    //  (triggering scTaskAlertCallback()), and the application sets the LEDs as
    //  follows:
    //  - Green LED is set whenever the ADC value is below the low threshold
    //  - Red LED is set whenever the ADC value is above the high threshold
    //
    //
    //  Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
    //
    //
    //  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.
    //****************************************************************************/
    #include "ex_include_tirtos.h"
    #include "scif.h"
    
    
    #define BV(n)               (1 << (n))
    
    
    // Display error message if the SCIF driver has been generated with incorrect operating system setting
    #if !(defined(SCIF_OSAL_TIRTOS_H) || defined(SCIF_OSAL_TIDPL_H))
        #error "SCIF driver has incorrect operating system configuration for this example. Please change to 'TI-RTOS' or 'TI Driver Porting Layer' in the Sensor Controller Studio project panel and re-generate the driver."
    #endif
    
    // Display error message if the SCIF driver has been generated with incorrect target chip package
    #ifndef SCIF_TARGET_CHIP_PACKAGE_QFN48_7X7_RGZ
        #error "SCIF driver has incorrect target chip package configuration for this example. Please change to 'QFN48 7x7 RGZ' in the Sensor Controller Studio project panel and re-generate the driver."
    #endif
    
    
    // Task data
    Task_Struct myTask;
    Char myTaskStack[1024];
    
    
    // Semaphore used to wait for Sensor Controller task ALERT event
    static Semaphore_Struct semScTaskAlert;
    
    
    
    
    void scCtrlReadyCallback(void) {
    
    } // scCtrlReadyCallback
    
    
    
    
    void scTaskAlertCallback(void) {
    
        // Wake up the OS task
        Semaphore_post(Semaphore_handle(&semScTaskAlert));
    
    } // scTaskAlertCallback
    
    
    
    
    PIN_Config pLedPinTable[] = {
        Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    PIN_State ledPinState;
    
    
    void taskFxn(UArg a0, UArg a1) {
        PIN_Handle hLedPins;
    
        // Enable LED pins
        hLedPins = PIN_open(&ledPinState, pLedPinTable);
    
        // Initialize the Sensor Controller
        scifOsalInit();
        scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
        scifInit(&scifDriverSetup);
        scifStartRtcTicksNow(0x00010000 / 8);
    
        // Configure and start the Sensor Controller's ADC window monitor task (not to be confused with OS tasks)
        scifTaskData.adcWindowMonitor.cfg.adcWindowHigh = 800;
        scifTaskData.adcWindowMonitor.cfg.adcWindowLow  = 400;
        scifStartTasksNbl(BV(SCIF_ADC_WINDOW_MONITOR_TASK_ID));
    
        // Main loop
        while (1) {
    
            // Wait for an ALERT callback
            Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);
    
            // Clear the ALERT interrupt source
            scifClearAlertIntSource();
    
            // Indicate on LEDs whether the current ADC value is high and/or low
            if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_LOW) {
                PIN_setOutputValue(hLedPins, Board_GLED, 1);
            } else {
                PIN_setOutputValue(hLedPins, Board_GLED, 0);
            }
            if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_HIGH) {
                PIN_setOutputValue(hLedPins, Board_RLED, 1);
            } else {
                PIN_setOutputValue(hLedPins, Board_RLED, 0);
            }
    
            // Acknowledge the alert event
            scifAckAlertEvents();
        }
    
    } // taskFxn
    
    
    
    
    int main(void) {
        Task_Params taskParams;
    
        // Initialize the board
        Board_initGeneral();
    #ifdef Board_shutDownExtFlash
        Board_shutDownExtFlash();
    #endif
    
        // Configure the OS task
        Task_Params_init(&taskParams);
        taskParams.stack = myTaskStack;
        taskParams.stackSize = sizeof(myTaskStack);
        taskParams.priority = 3;
        Task_construct(&myTask, taskFxn, &taskParams, NULL);
    
        // Create the semaphore used to wait for Sensor Controller ALERT events
        Semaphore_Params semParams;
        Semaphore_Params_init(&semParams);
        semParams.mode = Semaphore_Mode_BINARY;
        Semaphore_construct(&semScTaskAlert, 0, &semParams);
    
        // Start TI-RTOS
        BIOS_start();
        return 0;
    
    } // main
    

    现在、我将尝试使用您使用的同一 SDK、但我需要它与版本3.40.00.02配合使用。因为 我的项目使用此版本。

    在高级方面、谢谢您、

    Cristiane Bellenzier Piaia

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

    当您通过 CCS 调试器运行固件时、IOID_30引脚是否已处于高电平、低阈值是否按预期中断?  使用较新的 SDK 进行验证将确定  问题是与旧 SDK 有关、还是与您的项目设置/预期有关。  使用 SCS GPIO 事件触发器或 PIN/GPIO TI 驱动程序 创建中断回调是否更容易、或者您的应用是否需要 ADC 读数?

    此致、
    Ryan

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

    您好、Ryan、

    很抱歉、使用6.10 SKD 更新测试的延迟。

    我在6.10 SDK 中尝试了相同的示例、并且可以与传感器控制器和 Code Composer 一起工作。

    我接收到具有预期行为的中断。  

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

    在3.40版本中、我没有按预期接收到中断。 我可以在6.10版中看到这一点。

    我可以验证其他解决方案、但我需要非常快速的响应、因为我需要解决电源故障情况、响应时间至关重要。

    再次感谢您的回答、

    Cristiane Bellenzier Piaia

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

    感谢您提供测试的更多详细信息。  您是否需要有关此主题的任何其他回复、或者 E2E 主题是否可以结束?  目前为止我唯一能找到的相关问题涉及一个变通办法、它在 adcEnableSync 和 adcGenManualTrigger 之间添加了一个延迟: https://e2e.ti.com/f/1/t/878137 

    此致、
    Ryan

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

    您好、Ryan、

    权变措施对我无效、我仍然没有接收到中断。

    我现在将直接尝试使用比较器的解决方案。

    再次感谢、

    Cristiane Bellenzier Piaia

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

    为什么  不能将 解决方案迁移到最新的 SDK?  这将包括两年以上的错误 BLE5修复、更新的功能和升级的工具。  还有 BLE5-Stack 迁移指南 可帮助完成此过程。

    此致、
    Ryan