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: Triggering a CPU process every after CapTIvate scan

Part Number: MSP430FR2676

Hello,

My customer would like to implement a CPU service every after CapTIvate conversion.
For example, they would like to have an ISR, function return, or a callback
after scanning an 8-button sensor.

Could you please advise whether it would be possible or not, and if possible,
could you please recommend the mechanism or APIs ?
A sample code is also highly appreciated.


As long I found the "Active Operation Mode" looks the same as the question.
<software-dl.ti.com/.../ch_technology.html

Then, is there a material or a sample code to try the "Active Operation Mode" ?

I found an interrupt vector CAPT_IV_END_OF_CONVERSION and a flag g_bEndOfConversionFlag,
but from the link below, I was not sure if the trigger is availalble to the user code.
software-dl.ti.com/.../ch_library.html

I also found CAPT_IV_CONVERSION_COUNTER and g_bConvCounterFlag, but I was not sure if it activates after every conversion.
"Wakeup interval" parameter in the EVSW doesn't show "1". It selects from 16~512 samples.

  • Hallo,

    thanks for the post.

    I have a question to better understand your request.

    In the application with 4 buttons, you would like to continuous scan the buttons and if a touch is detected,

    to wake-up the FR2676 and blink an e.g. LED.

    Is my understanding correct?

    Thanks

    Regards

    Kostas


  • Kostas,

    Thank you for your confirmation.

    The CapTIvate hardware is required to wake-up the CPU regardless of the touch detection results or the Count values.
    The number of buttons is actually larger than eight.

    The electrode type would be mutual.

  • Hallo,

    you mean that while being in the scan mode without detection, there may be other sources which should wake up the CPU too, or a periodic wake up for other purposes?

    Regards

    Kostas

  • Kostas,

    We would like the periodic wake up.

    We would like the CPU to wake right after the CapTIvate scan completion and
    do some work before the next scan.

  • Hallo Hideaki,

    due to the way CapTIvate is designed, this can be done.

    We ca use the callback function to implement the application code.

    The callback function is automatically called each time the sensor is scanned.  With that, you get the touch result after each scan and you can also add additional application code to be executed before goes back to sleep.

    Please check the callback section of the Technology Guide (Software section).

    I have created an example, where every time the callback is called, executes touch status related tasks (e.g. LED2) and additional application task (e.g. LED1 flashing). After the execution of the callback the CPU goes back to sleep (CAPT_appSleep() ) until the next scan interrupt.

    For testing, just create a single button design in the CapTIvate Design Center GUI, Generate the source, Import the generated project into CCS and do following modifications on the imported main.c code.

     

    #include <msp430.h>                      // Generic MSP430 Device Include
    #include "driverlib.h"                   // MSPWare Driver Library
    #include "captivate.h"                   // CapTIvate Touch Software Library
    #include "CAPT_App.h"                    // CapTIvate Application Code
    #include "CAPT_BSP.h"                    // CapTIvate EVM Board Support Package
    
    
    // After every scan the LED1 will flash. LED2 is ON if touch is detected
    
    
    // Added callback function
    void my_BTN_Callback(tSensor* pSensor)
    {
        if((pSensor->bSensorTouch == true) && (pSensor->bSensorPrevTouch == false))
        {
            LED2_ON;
        }
        else if ((pSensor->bSensorTouch == false) && (pSensor->bSensorPrevTouch == true))
        {
            LED2_OFF;
        }
    // Flashing every time the callback is called
        LED1_ON;
        __delay_cycles(50000);
        LED1_OFF;
    }
    
    
    void main(void)
    {
    	//
    	// Initialize the MCU
    	// BSP_configureMCU() sets up the device IO and clocking
    	// The global interrupt enable is set to allow peripherals
    	// to wake the MCU.
    	//
    	WDTCTL = WDTPW | WDTHOLD;
    	BSP_configureMCU();
    	__bis_SR_register(GIE);
    
    	//
    	// Start the CapTIvate application
    	//
    	CAPT_appStart();
    
    	//
    	// Background Loop
    	//
    	while(1)
    	{
    		//
    		// Run the captivate application handler.
    		// Set LED1 while the app handler is running,
    		// and set LED2 if proximity is detected
    		// on any sensor.
    		//
    	    
    	    // Register the callback function “my_button_callback” to the sensor BTN00.
    	    MAP_CAPT_registerCallback(&BTN00, &my_BTN_Callback);        // Added
    	    
    	    CAPT_appHandler();                                          // Added
    
    /*	    Remove this part
    		LED1_ON;
    		if(CAPT_appHandler()==true)
    			LED2_ON;
    		else
    			LED2_OFF;
    		LED1_OFF;
    */
    		//
    		// This is a great place to add in any 
    		// background application code.
    		//
    		__no_operation();
    
    		//
    		// End of background loop iteration
    		// Go to sleep if there is nothing left to do
    		//
    		CAPT_appSleep();
    		
    	} // End background loop
    } // End main()
    

    Let me know if that is what you are looking for and helps to answer tthe question.

    Regards

    Kostas

**Attention** This is a public forum