3 Replies Latest reply on Dec 1, 2016 4:22 PM by glenn-edgar_1523231

    capsense using generic widgets for psoc 4m


      I am using a capacitive sensor to measure soil moisture.  The approach is similar to the liquid level capsense application note.  I got the solution to work on the psoc 5lp system, but I am having problem getting the solution to work on a psoc 4m.   I am using the cy8kit-043 for the psoc 4m.




      I set up one generic widget on P6.5 and the CMOD on P4.2.   I am assuming that the kit provides the necessary capacitor on P4.2 for the CMOD.  The generic widget is configured to 14 bit scan resolution.  The other parameters follow the guidelines in the liquid level app note.




      I used the following code segment as shown below.




      volatile int32 sensor_value;


      int main(void)
          CyGlobalIntEnable; /* Enable global interrupts. */


             CapSense_1_ScanSensor(0);  // CapSense_1_SENSOR_GENERIC0_0__GEN which is zero
             if( CapSense_1_IsBusy() != 0 )
             sensor_value = CapSense_1_ReadSensorRaw(0);




      The sensor_value was 0x3fff , irrespective of what was connected to the P6.5 pin.


      Any ideas on what I am doing wrong.