Other Parts Discussed in Thread: MSPWARE
Tool/software: Code Composer Studio
Hello!
How to trigger the CapTIvate channel of the microcontroller without using the design center (I have designed a board inhouse).
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.
Tool/software: Code Composer Studio
Hello!
How to trigger the CapTIvate channel of the microcontroller without using the design center (I have designed a board inhouse).
Hi Nikhil,
Would you be able to provide some additional detail around what you are trying to do?
Nikhil Sonna said:How to trigger the CapTIvate channel of the microcontroller without using the design center (I have designed a board inhouse).
It sounds like you have created your own board with one or more sensors. The CapTIvate Design Center is used to create the software to run on that device based on your sensor design. Once you have software set up for the MSP430FR2633 MCU, you can check touch detection flags in the software and then decide what action to take.
Please provide some additional information about where you are in your design process, and I can help guide you to the right information. The software library documentation provides a how-to section with information on how to go about extracting touch/no touch data from the CapTIvate Software Library.
Regards,
Walter
Nikhil,
To your question:
Nikhil Sonna said:(Can I use the code generated by the Design Center to achieve the same?)
Yes, you certainly can! If you have generated a new software project in CapTIvate Design Center for your specific board, and you have that project set up in an IDE (Code Composer Studio or IAR Embedded Workbench), then you can poll the sensor touch status in software. Code examples of how to achieve this can be found in the software library user's guide:
You can test the sensor/element status flags in software, then decide how you want to report the status information out.
Walter
Nikhil Sonna said:I am unable to poll the status of the channel.
Nikhil,
Can you please elaborate on this statement or post a code snippet of what you are doing? That way we can better determine where the issue is.
Walter
Please ignore previous post. Here is the code I am using along with the configuration details.
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
#include "CAPT_Touch.h"
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.
//
WDT_A_hold(WDT_A_BASE);
BSP_configureMCU();
__bis_SR_register(GIE);
extern void CAPT_calibrateSensorWithEMC(tSensor *pSensor);
LED1_ON;
__delay_cycles(1000000);
LED1_OFF;
while(1)
{
/***************************Code under test***************************************************************/
extern tElement PRX00_E00;
if(PRX00_E00.bProx == true)
{
LED1_ON;
}
else
{
LED2_OFF;
}
/**********************************************************************************************************/
//CAPT_appSleep();
} // End background loop
} // End main()
Configuration file: (Generated by Design Center)
// Sensor: PRX00, Element: E00
uint16_t PRX00_E00_RawCnts[CAPT_SELF_FREQ_CNT];
tCaptivateElementTuning PRX00_E00_Tuning[CAPT_SELF_FREQ_CNT];
tElement PRX00_E00 =
{
.ui8RxPin = 1,
.ui8RxBlock = 0,
.ui8TouchThreshold = 10,
.pRawCount = PRX00_E00_RawCnts,
.pTuning = PRX00_E00_Tuning,
};
I have connected the electrode patch to CAP0.1(in the design center as well as hardware).
Task:- By detecting the proximity I wish to glow up the LED.
I even tried for a normal capacitive touch button feature. Not working.
Code:
extern tElement BTN00_E00;
if(BTN00_E00.bTouch == 1)
{
LED1_ON;
}
else
{
LED2_OFF;
}
Button Config file (Generated by design center)
//Sensor: BTN00
const tCycle* BTN00_Cycles[1] =
{
&BTN00_C00,
};
tButtonSensorParams BTN00_Params;
tSensor BTN00 =
{
// Basic Properties
.TypeOfSensor = eButtonGroup,
.SensingMethod = eSelf,
.DirectionOfInterest = eDOIDown,
.pvCallback = NULL,
.ui8NrOfCycles = 1,
.pCycle = BTN00_Cycles,
.pSensorParams = (tGenericSensorParams*)&BTN00_Params,
// Conversion Control Parameters
.ui16ConversionCount = 500,
.ui16ConversionGain = 200,
.ui8FreqDiv = 2,
.ui8ChargeLength = 0,
.ui8TransferLength = 0,
.bModEnable = false,
.ui8BiasControl = 3,
.bCsDischarge = true,
.bLpmControl = false,
.ui8InputSyncControl = 0,
.bTimerSyncControl = false,
.bIdleState = true,
// Tuning Parameters
.ui16ProxThreshold = 10,
.ui16NegativeTouchThreshold = 20,
.ui16ErrorThreshold = 8191,
.ui16TimeoutThreshold = 1000,
.ProxDbThreshold.DbIn = 1,
.ProxDbThreshold.DbOut = 0,
.TouchDbThreshold.DbIn = 1,
.TouchDbThreshold.DbOut = 0,
.bCountFilterEnable = true,
.ui8CntBeta = 1,
.bSensorHalt = false,
.bPTSensorHalt = true,
.bPTElementHalt = true,
.ui8LTABeta = 7,
.bReCalibrateEnable = true,
};
Hi Nikhil,
Looking at your code, you are missing several critical function calls to the CapTIvate Software Library that must be made for the capacitive sensing functionality to work correctly.
You have removed the call to CAPT_appStart(), which in turn calls the needed start-up functions such as CAPT_initUI() and CAPT_calibrateUI(). Then, in your background while(1) loop, you check the status flags but never actually update the proximity sensor.
I recommend that you start from the beginning with CapTIvate Design Center, and use it to create a new starter project for a single proximity sensor. Then you can import that project and test it. If it works, that all you have to add are the checks to the prox status as you have right now- but you can't remove the existing calls to init, calibrate, and measure the UI.
I recommend that you go through the workshop on creating a new sensor design project:
Here is a video on the topic as well:
Regards,
Walter
Maricela,
As stated in our previous thread, you don't need to have CapTIvate Design center connected to your PCB for it to operate. You can generate code via the Design Center and import that into CCS as you've asked for.
No one else will be able to provide code for your specific board because we don't know how you have it setup (i.e. number of sensors, type of sensors, etc). This is something you can do in Design Center without connecting to your PCB and generate the appropriate code.
Best regards,
Caleb Overbay
**Attention** This is a public forum