Read a fix rawcount value if CapSense sensor more than 8

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello, there

I have a CapSense project using CY8C4025AXI-S412 to calculate absolute capacitances value from the raw counts. When I set the total number of sensor more than 8, the raw count reading from the RAM always gives a fixed value.

Here is the function where I read the raw counts, and I put all the sensors under button0 widget, even I split the sensors into two widgets, still read a fixed value when I set the total sensor more than 8.

void ProcessAllSensors(sensor_data* p_sensor_data)

{

   

   

    interruptState = CyEnterCriticalSection();

            

            for(uint8 snsId = CSD_BUTTON0_SNS0_ID; snsId < CSD_TOTAL_SENSORS; snsId++)

            {

            p_sensor_data[snsId].rawCounts = CSD_dsRam.snsList.button0[snsId].raw[0];

            p_sensor_data[snsId].capacitance = CalculateCapacitance(p_sensor_data[snsId].rawCounts);

           

            }      

    /* Enable interrupts for servicing ISR */

    CyExitCriticalSection(interruptState);

}

When I adapt all project into the CY8CKIT-048 kit and keep all the settings and code the same, it works fine with CY8C4A45LQI-483.

My question is what difference between  CY8C4A45LQI-483 and CY8C4025AXI-S412 cause this issue?

How can I exceed the total number of sensor more than 8 on CY8C4025AXI-S412?

Here I have attached a small test project for that issue tracking.

0 Likes
1 Solution
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Yes. The equation may work for larger capacitor value range. But it may be beyond the range of PSoC4 hardware limitation. Maybe the result of 1.2nf is correct, however, the performance can only be guaranteed in datasheet spec. In some special environment, it may fail.

Thanks,

Ryan

View solution in original post

0 Likes
8 Replies
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi Derek,

Seems that the project attached is not same with the code shown in your created thread..

In the attached project, widgets process are missed. It is better to add 'CSD_ProcessAllWdigets();' in the if loop, before interruptState = CyEnterCriticalSection();

And then try again.

CSD in PSoCA and PSoC4000S are same. So the code worked on PSoC4000S can work on PSoCA too.

Thanks,

Ryan

0 Likes
Anonymous
Not applicable

Hi Ryan,

Thanks for the reply, the project attached is a test one since I am not using the widgets process API.

The process of my own one is to calculate the absolute capacitance from the raw counts.

Did you mean even I am not using the API I still need to put them before I read the raw counts value?

I will try it first, thanks.

0 Likes
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi Derek,

You're welcome.

Got it!

Yes, 'CSD_ProcessAllWidgets();' or 'CSD_ProecessWidget(wideget_index)'is required after scan completed.

Thanks,

Ryan

0 Likes
Anonymous
Not applicable

Hi Ryan,

I have tried your suggestion, it still remains the same. always 0x3E04.

Here I attached I screen copy of the debugging watch window.debugging.jpg

0 Likes
Anonymous
Not applicable

Here are the same code and settings but on CY8C4A45LQI-483, but the result is different.

10sensor on CY8C4A45_2.JPG

10sensor on CY8C4A45.JPG

0 Likes
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi Derek,

Rawcounts seem not consistent and not IDAC not tuned well.

I double-checked CSD configration in the project.

Suggestions:

1. Sense clock source: select Auto;

2. Check Enable IDAC auto-calibration; Check Enable compensation clock.

3. Enable common sense clock, sense clock frequency: select 1500 or 3000 kHz;

For cp calculation, it has been integrated in CapSense APIs.

Check Enable self-test library, then you can use CapSense_GetSensorCapacitance() to get cp of sensors.

Read CapSense datasheet for more details.

Thanks,

Ryan

0 Likes
Anonymous
Not applicable

Hi Ryan,

I have changed the configuration accordingly, it still remains a fixed value. The reason I haven't use CapSense_GetSensorCapacitance() is that it can only get capacitance range from 5pf - 255 pf, but we need 30pf - 750pf range. But I don't think this the root, we have used the equation in the datasheet to calculate capacitance up to 1.2 nf and it works fine when the sensor number is less than 8.

10sensor on CY8C4025.JPG

10sensor on CY8C4025_2.JPG

0 Likes
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Yes. The equation may work for larger capacitor value range. But it may be beyond the range of PSoC4 hardware limitation. Maybe the result of 1.2nf is correct, however, the performance can only be guaranteed in datasheet spec. In some special environment, it may fail.

Thanks,

Ryan

0 Likes