4 Replies Latest reply on Oct 1, 2019 12:33 AM by AlDS_4485821

    Capsense, no output

    AlDS_4485821

      I built some simple sensors of 4 buttons in CSD mode, and have interfaced to to the CY8CKIT-145-40XX.

      However when I probe the sensor pads after programming the boards I don't see any signals on the scope.

       

       

      int main()
      {
          /* Enable Global interrupts for CapSense operation */
          CyGlobalIntEnable;
               
          /* Start EZI2C block */
          EZI2C_Start();
          
          /* Set up communication data buffer to CapSense data structure to 
          expose to I2C master at primary slave address request. */
          EZI2C_EzI2CSetBuffer1(sizeof(CapSense_ADC_dsRam), sizeof(CapSense_ADC_dsRam), 
                               (uint8 *)&CapSense_ADC_dsRam);
                               
          /* Start UART block */
          UART_Start();
      
      
          /* Set LED brightness to zero */
          LED_CONTROL_WriteCompare(PWM_MIN);
          
          /* Start PWM block */
          LED_CONTROL_Start();
        
          /* Start CapSense_ADC component */
          CapSense_ADC_Start();
                
          /* Scan the CapSense sensor */
          CapSense_ADC_ScanAllWidgets();
              
          /* Set the next scan state to ADC to perform voltage measurement */
          scanState = STATE_ADC;
      
          for(;;)
          {
              /* Initiate the CapSense or ADC scan only when previous 
                 CapSense or ADC process is completed */
              if((CapSense_ADC_NOT_BUSY == CapSense_ADC_IsBusy()) && (CapSense_ADC_AdcSTATUS_IDLE == CapSense_ADC_AdcIsBusy()))
              {
                  /* If scan state is CapSense, initiate CapSense scan and 
                     process last cycle ADC data 
                  */
                  if(scanState == STATE_CAPSENSE)
                  {
                      /* Update CapSense parameters set via CapSense Tuner */
                      CapSense_ADC_RunTuner();
                      
                      /* Scan configured sensor */
                      CapSense_ADC_ScanAllWidgets();
                                      
                      /* Read the measured voltage value from last ADC cycle */
                      mVolts = CapSense_ADC_AdcGetResult_mVolts(CapSense_ADC_AdcCHANNEL_0);
                      
                      /* Control LED brightness depending on the input voltage value and shows
                         ADC conversion value on hyperterminal */
                      ADC_DisplayState();
                                                      
                      /* Configure next scan state to ADC to perform input voltage measurement */
                      scanState = STATE_ADC;
                  }
                  else if (scanState == STATE_ADC)
                  {
                      /* Start an ADC Conversion conversion */
                      CapSense_ADC_AdcStartConvert(CapSense_ADC_AdcCHANNEL_0);
                    
                      /* Process previous cycle CapSense Data */
                      CapSense_ADC_ProcessAllWidgets();
                      
                      /* Set variable to scan CapSense sensor in the next cycle */
                      scanState = STATE_CAPSENSE;
                  }
              }
              
              /* Delay added to sample input voltage every 100 milliseconds */
              CyDelay(100);
          }
      }
      

       

      My main file is as above, I used it from a sample project and modified it to my minimal needs?

      Is there any init line that I'm missing from the above?

        • 1. Re: Capsense, no output
          AH_96

          Hello AlDS_4485821

           

          I tried the code at my end and was able to observe the CapSense scanning waveform.

          Please note that there is a 100ms delay in the code and because of this, the scanning will occur once every 200ms only.

           

           

          Make sure that the Cmod pin is populated with a 2.2nF capacitor. Also. please verify the pin connections. In the 145 kit, pin 4.1 is populated with Cmod(2.2nF).

          You can also observe the tuner to check if the CapSense component is functioning correctly.

           

          Thanks and regards

          Hari

          • 2. Re: Capsense, no output
            AlDS_4485821

            Thanks for the suggestions, when I load another project like CE210709, which is meant for the kit, I can see the scanning waveforms on some sensors.

             

            So I have a feeling that something is misconfigured in the workspace that I used. But I don't know what.

             

            Even when I configure CE210709 to suit my purposes, I find the scanning signal on only 2 sensors

            I have connected the sensors on P0_0, P0_1, P0_2 and P0_3, and I can't see the signal on the P0_0 and P0_1 pins.

             

            What kind of configuration blocks scanning to certain pins or no pins.

            Is there any IO config necessary like port direction etc. to get this to work?

            • 3. Re: Capsense, no output
              AH_96

              Hello AlDS_4485821

               

              Can you comment out the delay statement? CyDelay(100);  in line 74.

              Please share the project if you still don't observe the waveforms.


              Thanks and regards

              Hari

              1 of 1 people found this helpful
              • 4. Re: Capsense, no output
                AlDS_4485821

                Seems like I was frantically trying to change the code to get things to work, now I can't find the code that I pasted here. But I opened up the project to check one last time before trying to send the project to you, I found that the sensors were connected to P2 instead of the mentioned P0. I changed that and viola! I could seen the scan waveforms on the scope.

                So all is well as of now, and many thanks for your support!