- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are trying to read raw capacitance data using a PSoc series 4000 (proto kit CY8CKIT-145-40XX).
Reading the manuals (!!!) it is documented a low level reading function named:
CapSense_GetSensorCapacitance()
however when compiling code using this function, the function is not found.
Is there anybody who kindly can help us to solve this issue: either by suggesting how to call the function or by suggesting any other "low level" reading function?
We need to read raw capacitance data ("analog" capacitance measurements).
Thank you in advance for any support on this topic.
Giorgio Cannata
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should check the BIST(build in self test) checkbox in CapSense component configuration GUI and then compile the project. This API is not generated by default by component, until you enable the BIST option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My comments below are with respect to the newer CapSense v5.0 component. This matters because that component uses the newer API (which you probably want if you are just starting out). The new API uses a Get and SetParam interface.
Here is a snippet of code I use to read the sensors raw capacitance signal
// read the sensor raw capacitance
uint32 tmpUint32;
CapSense_GetParam(CapSense_LLS_SNS0_RAW0_PARAM_ID,&tmpUint32);
gCurrentCapacitance = (uint16)(tmpUint32 & 0xFFFF);
There are lots of params you can get and set and they are documented in the datasheet in the High Level API section. For example here is a snippet of my code to get/set the idac's. I use the EZI2C interface on my board and keep shadow copies to know when things changed, hence the extra code. The params interface uses Uint32 even though not all params are that big (something to keep in mind).
// update the IDAC values if the registers changed via I2C interface
tmpUint8 = gReg->IDAC;
if(gIDACShadow != tmpUint8 )
{
tmpUint32 = (uint32)tmpUint8;
gIDACShadow = tmpUint8;
cystatusRet = CapSense_SetParam(CapSense_LLS_IDAC_MOD0_PARAM_ID, tmpUint32);
//CapSense_Start();
cystatusRet = CapSense_GetParam(CapSense_LLS_IDAC_MOD0_PARAM_ID, &tmpUint32);
gReg->IDAC = gIDACShadow = (uint8)(tmpUint32 & 0xFF);
}
tmpUint8 = gReg->CompIDAC;
if(gCompgIDACShadow != tmpUint8 )
{
tmpUint32 = (uint32)tmpUint8;
gCompgIDACShadow = tmpUint8;
cystatusRet = CapSense_SetParam(CapSense_LLS_SNS0_IDAC_COMP0_PARAM_ID, tmpUint32);
//CapSense_Start();
cystatusRet = CapSense_GetParam(CapSense_LLS_SNS0_IDAC_COMP0_PARAM_ID, &tmpUint32);
gReg->CompIDAC = gCompgIDACShadow = (uint8)(tmpUint32 & 0xFF);
}
Now in the Low Level API I discovered some useful stuff like reading the capacitance in pF and reading the PSoC voltage. Having the capacitance in pF is pretty handy for experimenting and messing around.
Important: to get these library calls you have to "enable self-test library" under the CapSense Advanced tab. This is not documented well or at all and took me forever to figure out.
// Bits [7..0] are the capacitance (in pF) of the CSD electrode
uint32 sensorCap = CapSense_GetSensorCapacitance(CapSense_LLS_WDGT_ID, CapSense_LLS_SNS0_ID);
if( (sensorCap & CapSense_TST_BAD_PARAM) == 0 ) gReg->sensorCapacitance = (uint8)(sensorCap & 0xFF);
gReg->sensorVdda = CapSense_GetVdda(); // value is in mV;
CapSense_Start(); // this is needed to get the raw capacitance working again after sensorCapacitance call (455 uS)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should check the BIST(build in self test) checkbox in CapSense component configuration GUI and then compile the project. This API is not generated by default by component, until you enable the BIST option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much indeed for the suggestion
Giorgio
Prof. Giorgio Cannata
Automatic Control
DIBRIS – Universita’ di Genova
Via Opera Pia 13, 16145 Genova
Tel: +39 010 3532223
Skype: giorgio.cannata.unige
Fax: +39 010 3532154
email: <mailto:giorgio.cannata@unige.it> giorgio.cannata@unige.it