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.

[参考译文] MSP430FR2676:是否仅将 CapTIvate 用于接近唤醒、而禁用它?

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1260932/msp430fr2676-using-captivate-only-for-wake-on-proximity-then-disabling-it

器件型号:MSP430FR2676

我有一个电容式传感器、我要监控其活动、一旦有活动、我就要唤醒该器件并开始测量它、还有另一个传感器。 我需要使用 CapTIvate 来处理唤醒、然后使用其他软件来接管。

或者是否可以使用 CapTIvate 在0.5pF 分辨率下获得绝对电容读数? 这一点不太容易判断、因为坚持只使用 CapTIvate 可能会更方便吗?

如果无法或不适合为此起诉 CapTIvate、那么我很好奇进入和退出 CapTIvate 的最佳方式是什么?

到目前为止、解决方案使用回调来设置标志和关闭 CapTIvate。 不允许主循环进入 apphandler 或 sleep、禁用计时器似乎会有所帮助。 有没有其他或更好的方法可以做到这一点?

void main(void)
{
    WDTCTL = WDTPW | WDTHOLD;
    BSP_configureMCU();

    setHiZPins();
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN0,GPIO_SECONDARY_MODULE_FUNCTION);
    MAP_CAPT_registerCallback(&wakeButton, &wakeup_CB);

    CAPT_appStart();
    __bis_SR_register(GIE);
    while(1){
        if(!g_userModeFlag){
            CAPT_appHandler();
            CAPT_appSleep();
        }else{
            GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN0);
            initPeripherals();
            startMeasuring();
            CAPT_powerOn();
            while(ovf_count < 15 || angle_reading < MAX_ANGLE);
            g_userModeFlag = false;
        }
    }
}

我看到了一个使用 CAPT_appHandler ()上的返回值的解决方案,而不是禁用 CapTIvate。 所以我想出了这样的问题。

while(1){
    bool hadActivity = CAPT_appHandler();

    if(hadActivity && !g_userModeFlag){
        //First activity after sleep, so we need to init some stuff
        MAP_CAPT_stopTimer();
        MAP_CAPT_clearTimer();
        MAP_CAPT_powerOff();
        g_userModeFlag = true;
        LED2_ON;
        //GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN0); //test to see if it helps with the circuit to put captivate pin in hi-z
        if(enableUART){
            initUART();
        }
        initComp();
        initTimer();
        startMeasuring();
    }else if(!hadActivity){
        // We sleeping, nothing special going on
        CAPT_appSleep();
        //What is the state of P3.0 aka Cap0.0 here if we set it as input when starting user mode????
    }else if(!hadActivity && g_userModeFlag){
        //first inactivity after user mode so we need to de-init some stuff
        stopMeasuring();
        g_userModeFlag = false;
        LED2_OFF;
        MAP_CAPT_powerOn();
        MAP_CAPT_startTimer();
    }
}

我主要想寻找一种利用 CapTIvate 进行测量的方法、或在器件处于唤醒状态时避开它的方法。

谢谢!