PSoC5LP RegistorMap of CasSense component

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

cross mob
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Hi,

We would like to use BCP(Bridge Control Panel) with PSoC5LP.

For PSoC4, RegistorMap.h file is generated automatically but PSoC5LP is not.

Therefore, these parameters of the sensor to transmit is unknown.

If it is PSoC4, Component name is CapSense, Sensor name is BUTTON0(Initial name when added),

Raw count : CapSense_BUTTON0_SNS0_RAW0_VALUE

Baseline : CapSense_BUTTON0_SNS0_BSLN0_VALUE

Diff : CapSense_BUTTON0_SNS0_DIFF_VALUE

Signal : CapSense_SNS_STATUS0_VALUE

Where should I refer to PSoC5LP?

I searched for but I did not know the corresponding register.

Regards,

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Dear MaMi_1205306​,

Please use the following parameters for PSoC 5

            MyI2C_Regs.bSnsMask = CapSense_CSD_sensorOnMask[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wRawCount = CapSense_CSD_sensorRaw[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wBaseline = CapSense_CSD_sensorBaseline[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wDiffCount = CapSense_CSD_sensorSignal[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wCentroid = CapSense_CSD_GetCentroidPos(1);

Note: CapSense_CSD is the name alias of the CapSense component I used.

Please find the attached project file. Let us know in case you need further assistance.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

0 Likes
12 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi MaMi_1205306​,

PSoC 5 device CSD component doesn't include a register map like PSoC 4's latest CapSense components.

To view data in BCP you need to create your own data structure containing the CapSense data that you need to view and then use BCP to read that data.

You can refer to the app note https://www.cypress.com/documentation/application-notes/an2397-psocr-1-and-capsenser-controllers-cap...  section "I2C with BCP for Programmable Controllers" that is similar to PSoC 5 implementation.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Bragadeesh-san,

Thank you for your reply.

I read the application note you sent me.
However, I did not understand which parameter to use in PSoC5LP.

pastedImage_0.png

Do you have sample code of single button with PSoC5LP?

Regards,

0 Likes
lock attach
Attachments are accessible only for community members.

Dear MaMi_1205306​,

Please use the following parameters for PSoC 5

            MyI2C_Regs.bSnsMask = CapSense_CSD_sensorOnMask[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wRawCount = CapSense_CSD_sensorRaw[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wBaseline = CapSense_CSD_sensorBaseline[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wDiffCount = CapSense_CSD_sensorSignal[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wCentroid = CapSense_CSD_GetCentroidPos(1);

Note: CapSense_CSD is the name alias of the CapSense component I used.

Please find the attached project file. Let us know in case you need further assistance.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
lock attach
Attachments are accessible only for community members.
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Hi,

I created a project and tried it.

Raw count is output normally, but baseline and diff value are not output.

Also, it seems that "CapSense_GetCentroidPos()" API can not be used as standard in PSoC5LP.

Regards,

0 Likes

Hi MaMi_1205306​,

CapSense_sensorOnMask[] is a discontinued variable. So you need to use CapSense_CheckIsWidgetActive to check if the button is active or not.

Difference counts gets calculated only if CapSense_UpdateEnabledBaselines(); is called. So call that API after scan is complete before reading diff counts.

I tried your code from my end baseline value is getting read by BCP. Please confirm.

Also CapSense_GetCentroidPos() can be used with PSoC 5. It gives the position of the finger in the linear slider.  It works at my end. Please confirm.

Please use the following snippet:

    CapSense_Start();

    CapSense_InitializeAllBaselines();

    for(;;)

    {

        CapSense_ScanEnabledWidgets();

        while((CapSense_IsBusy() ==1))

        {};

            CapSense_UpdateEnabledBaselines();

            MyI2C_Regs.bSnsMask = CapSense_CheckIsWidgetActive(MyI2C_Regs.bSnsIndex);

            MyI2C_Regs.wRawCount = CapSense_sensorRaw[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wBaseline = CapSense_sensorBaseline[MyI2C_Regs.bSnsIndex];

            MyI2C_Regs.wDiffCount = CapSense_sensorSignal[MyI2C_Regs.bSnsIndex];

}

BCP output:

pastedImage_16.png

00 -> Offset

01 -> Touch

3F FF -> Raw count

36 83 -> Baseline

FF -> Difference counts (It is saturating to FF because widget resolution is set to 8 bits by default by smartsense. Either reduce resolution or use manual tuning and set widget resolution to 16 bits to avoid diff counts saturation)

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Bragadeesh-san,

Thank you for your suport.

Operation was able to be confirmed also here.

Please tell us only two additional points.

(1)

Are there any commands in PSoC5LP that apply to PSoC4 "CapSense_SNS_STATUS0_VALUE".

(2)

If you use multiple sensors, please let us know how to display other sensors.

Regards,

0 Likes

Hi MaMi_1205306​,

There are two ways to achieve this:

1. Increase the no. of parameters in the structure, for example:

#WIDGET COUNT 5u // 5 buttons are present in your design

struct I2C_Regs

{

    uint8 bSnsStatus[WIDGET COUNT]; // read only value

    uint32 wRawCount[WIDGET COUNT]; // read only value

    uint32 wBaseline[WIDGET COUNT]; // read only value

    uint32 wDiffCount[WIDGET COUNT]; // read only value

    ; // read only value

} __attribute__ ((packed)) MyI2C_Regs;

or else you can use the present technique of MyI2C_Regs.bSnsIndex to read the data of the widget you like.

2.  Are there any commands in PSoC5LP that apply to PSoC4 "CapSense_SNS_STATUS0_VALUE".

--> Can you please elaborate your question?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Bragadeesh-san,

1.

It seems that "#WIDGET" cannot be used with PSoC Creator.

I ’m also trying to switch the index,
Cannot write index register.
Sending a "w 08 00 01" command will result in no ack(w 08+ 00+ 01-).

2.

"CapSense_SNS_STATUS0_VALUE" of PSoC4 corresponds to a digital status of 0(sensor off) and 1(sensor on).

Regards,

0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

After switching APIs of "EZI2C_SetBuffer1()" and "EZI2C_Start()", the sensor could be switched normally.

The following is described in AN2397

EZI2C_SetBuffer1(sizeof(MyI2C_Regs),1,(uint8*)&MyI2C_Regs);

EZI2C_Start();

However, PSoC5 does not work unless it is described below.

EZI2C_Start();

EZI2C_SetBuffer1(sizeof(MyI2C_Regs),1,(uint8*)&MyI2C_Regs);

0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

No.2 was solved by myself.

//-----------------------------------------------------------------------------------------------------------------

struct I2C_Regs

{

//   ...Omission

    uint8 wCentroid; // read only value [ON/OFF Status]

} MyI2C_Regs;

//   ...Omission

     MyI2C_Regs.wStat = CapSense_CheckIsSensorActive(MyI2C_Regs.bSnsIndex);

//-----------------------------------------------------------------------------------------------------------------

Thank you for your cooperation!

0 Likes

Hi MaMi_1205306

The right sequence of EZI2C in PSoC 5 is EZI2C_Start() and then EZI2C_SetBuffer1().

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

Bragadeesh-san,

Because BCP is faster than Tuner Helper, it is very good to use!

Thank you for telling us how to use.

Regards,

0 Likes