CY8CKIT40-41-40xx KIT CSX method without gesture

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

cross mob
Sanket24
Level 2
Level 2
5 questions asked 10 replies posted 25 sign-ins

Hello all,

i am developing software for capsense touchpad using CSX method. currently i am able to fetch XY co-ordinate from CSX gesture method.

but i whenever i am trying to get co-ordinates, at that time data is not coming properly. please send any information regarding capsense CSX block .

Thank you for help,

Sanket More 

 

0 Likes
9 Replies
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @Sanket24 ,

Could you please explain and attach the screenshots of the issue you are facing? 

Warm regards

Sobhit

0 Likes
lock attach
Attachments are accessible only for community members.
Sanket24
Level 2
Level 2
5 questions asked 10 replies posted 25 sign-ins

Hello sobhit,

Please find attached  program document for CSX method for touchpad. i am trying to fetch coordinated from touchpad. after getting touchpad co-ordinates, i am taking led indication. but indication is  not getting. (testing of touchpad) @PandaS 

Thanks for your help,

 

0 Likes
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @Sanket24 ,

Could you please share your tuner waveforms for touchpad widget. (Screeenshots)

Warm regards

Sobhit

0 Likes
lock attach
Attachments are accessible only for community members.
Sanket24
Level 2
Level 2
5 questions asked 10 replies posted 25 sign-ins

Hello Sir,

I am not aware about cap sense tuner but i am trying to take attempt on cap sense tuner. please check attached image as I got.

Thanks and regards,

sanket more

0 Likes
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi Sanket,

You are getting an error because you haven't initialized the EzI2C component in your project.

I would suggest using a code example first. There is a code example on Touch pad for CSX for this device. Try using it, open CapSense Tuner after programing and connect using USB-I2C. Observe the finger tracking in the tuner.

Warm regards

Sobhit

 

0 Likes
Sanket24
Level 2
Level 2
5 questions asked 10 replies posted 25 sign-ins

Thanks for reply sobhit,

i am getting an position on the graph of touchpad but it was happens using CSD method. Not an CSX. it is in process. if any comes positive i will revert you back. All things i am trying without using gesture feature.

Thanks and regards,

Sanket more

0 Likes
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @Sanket24 ,

I tried it at my end on CY8CKIT-041-41XX WITH CSX Touchpad without gesture.

This is the top design:

PandaS_0-1675323276284.png

CSX Settings:

PandaS_1-1675323330172.png

Widget details:

PandaS_2-1675323355369.png

The code:

#include "project.h"

/* PWM duty cycles for zero and fifty percent */
#define PWM_LED_OFF         10001
#define PWM_LED_HALF_POWER  5000

/* Scales x and y value of the touchpad to PWM compare value */
#define PWM_SCALAR          100

/*  */
#define LED_OFF             1
#define LED_ON              0

/*******************************************************************************
* Function Name: main
********************************************************************************
* Summary:
*  The main function performs the following actions:
*   1. Starts all hardware Components
*   2. Starts the timestamp
*   3. Initial scan of all CapSense widgets
*   4. Checks if scan is complete
*   4. Process all data and update time stamp
*   5. Checks if there was a gesture or if the touchpad was touched
*   6. Sends all data to the CapSense Tuner
*   7. Scans all CapSense widgets and returns to step four
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
int main(void)
{
    /* Stores the current touchpad X and Y values */
    uint32 Xcord;
    uint16 Ycord;
    
    /* Stores the current gesture */
    uint32 gesture;
    
    CyGlobalIntEnable; /* Enable global interrupts. */
    
    /* Starts all Componenets */
    EZI2C_Start();
    CapSense_Start();
    PWM_Blue_Start();
    PWM_Green_Start();
    
    /* Set up communication data buffer to CapSense data structure to be exposed to
       I2C master */
    EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam), sizeof(CapSense_dsRam), (uint8 *)&CapSense_dsRam);
    
    /* Sets up a callback function using sysTick timer isr, the callback function
       is part of the CySysTickSetCallback API */
    //CapSense_dsRam.timestampInterval = 2u;
    CySysTickStart();
    //CySysTickSetCallback(0u, CapSense_IncrementGestureTimestamp);
    
    CapSense_ScanAllWidgets();
    
    for(;;)
    {
        /* Checks if the scan was completed before trying to process data */
        if(CapSense_NOT_BUSY == CapSense_IsBusy())
        {
            CapSense_ProcessAllWidgets();

            
            /* Stores current finger position on the touchpad */            
            Xcord = CapSense_GetXYCoordinates(CapSense_TOUCHPAD0_WDGT_ID);
            Ycord = Xcord >> 16;
            Xcord = (uint16)Xcord;
            
            PWM_Blue_WriteCompare(PWM_LED_HALF_POWER);
            PWM_Green_WriteCompare(PWM_LED_HALF_POWER);
            Red_LED_Write(LED_ON);
            

            /* Check if the touchpad was touched */
            if(CapSense_GetXYCoordinates(CapSense_TOUCHPAD0_WDGT_ID) != CapSense_TOUCHPAD_NO_TOUCH)
            {
                /* Change the PWM compare value based on finger position as long as the light was not off */
                PWM_Blue_WriteCompare(PWM_Blue_ReadCompare() == PWM_LED_OFF ? PWM_LED_OFF : (Xcord * PWM_SCALAR));
                PWM_Green_WriteCompare(PWM_Green_ReadCompare() == PWM_LED_OFF ? PWM_LED_OFF : (Ycord * PWM_SCALAR));
            }

            
            /* Required to maintain sychronization with tuner interface */
            CapSense_RunTuner();
            
            /* Initiates the next scan of all widgets */
            CapSense_ScanAllWidgets();
        }
    }
}

I think there is some issue with your PWM/Led output code. You can try using CapSense Tuner to analyze the CapSense sensor signals. Please let me know if the code snippet and configuration work for you. This is built on a PSoC4100S device while your kit has PSoC4000S. So, it might need a few changes.

 

Thanks and regards,

Sobhit

0 Likes
Sanket24
Level 2
Level 2
5 questions asked 10 replies posted 25 sign-ins

Thanks for Help sobhit.

Now, i am trying to send all data to the USB HID mouse. for that i am sending byte of x data another byte for y axis then third byte for Delta X and Y. but i am not getting movement on Screen.

Thanks and regards,

Sanket More

India  

0 Likes
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @Sanket24 ,

It would be better if you could share the current project. You can share it through personal chat, in case you don't want the code base to be public.

Warm regards,

Sobhit

0 Likes