Design guidelines to use capsense tuner with custom board

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

cross mob
jcsb1994
Level 4
Level 4
First solution authored 50 replies posted 50 sign-ins

Hi,
on my last custom board, I only had a 5 pin SWD programmer connector, and another i2c connector to communicate with a psoc devkit

pastedImage_0.png

I believe there was no way to directly use capsense tuner with this board. However, for my next iteration, I would like to do so! I would like to know my options, but it is not very clear. Can I do it with a miniprog4 programmer? I also have CYUSB232 and CYUSB234 chips, I don't know if creating a usb connector is a possibility?

Thank you!

0 Likes
1 Solution
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JeSi_4326976​,

The issue is due to incorrect set up of I2C parameters. For running tuner, you need to configure an EzI2C slave - PSoC cannot be the master. Tuner acts as the master. Please refer any CapSense CE for this.

I also want to point out that you need to use CapSense_ProcessAllWidgets API instead of UpdateAllBaseline for the new component and it is recommended to execute CapSense_RunTuner between CapSense_ProcessAllWidgets and CapSense_ScanAllWidgets.

An example firmware flow:

    /* Start the EZI2C component to tune CapSense sensors */ 

    EZI2C_Start();

   

    /* Set the CapSense data structure as the I2C buffer to be exposed to the

     * master on primary slave address interface. Any I2C host tools such as the

     * Tuner or the Bridge Control Panel can read this buffer but you can

     * connect only one tool at a time.

     */

    EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam), sizeof(CapSense_dsRam),

                            (uint8_t *)&(CapSense_dsRam));

   

    /* Start the CapSense block */

    CapSense_Start();

   

    /* Scan all the enabled widgets */

    CapSense_ScanAllWidgets();

   

    for(;;)

    {

        /* Initiate a new scan only if the CapSense block is idle */

        if(CapSense_NOT_BUSY == CapSense_IsBusy())

        {

            /* Performs full data processing of all enabled widgets */

            CapSense_ProcessAllWidgets();

           

            /* Sync with the Tuner application to fetch the latest CapSense 

             * parameters and update back the sensor data such as rawcount,

             * baseline etc.

             */

            CapSense_RunTuner();

           

            /* Scan all enabled widgets */

            CapSense_ScanAllWidgets();

        }

    }

Best regards,
Hari

View solution in original post

8 Replies
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JePI_3825071

Can I do it with a miniprog4 programmer?

Yes, this would be the easiest way to have tuner running. You can connect the SDA and SCL lines to that of the miniprog4 and use Tuner directly from PSoC creator. You don't need a secondary PSoC kit.

CYUSB232 is a USB-UART bridge and will work only with the asynchronous Tuner communication, it would be better to use CYUSB234 for synchronous I2C communication.


Synchronous communication will help in setting the parameters directly from the Tuner and avoids the need to reprogram. It eliminates any spikes in the raw count reading due to error in reading.

Best regards,

Hari

jcsb1994
Level 4
Level 4
First solution authored 50 replies posted 50 sign-ins

Very good,
that means I should be able to use the tuner with my old design, right? I tried connecting my I2C lines to the kitprog4, but the kitprog doesnt seem to be recognized by the tuner UI, no matter what is connected to itpastedImage_0.png

The kit is plugged in and the device is powered, but nothing appears on the tuner!

pastedImage_1.png

0 Likes

Don't connect the I2C SDA and SCL to the 5-pin connector (as you show in the image above).

The MiniProg3 would allow that, but the MiniProg4 does not.

The MiniProg4 connects I2C via pins 2 and 4 of the 12-pin connector.

RiOD_2845421
Nice! I should have noticed this... I tried something sketchy since I do not have a 12pin connector on my custom board. I connected the pins to 2-4 of the connector, but it unfortunately doesn't work.

pastedImage_1.png

I do get extra info that the kitprog i2c and spi are recognized now, however, so this is good news!

pastedImage_0.png

Is it possible to do some kind of wire arrangement with the onboard 5pin swd connector and a i2c connector with the kitprog4 12pin connector, or there is nothing I can do until I design my nect iteration with the 12pin connector on board? thanks!

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JePI_3825071​,

You can see under port information that the error is caused as the port cannot be opened by tuner. There is some other application that is acquiring the MiniProg. Please check if there is any other application that is acquiring the port, could be PSoC programmer, bridge control panel or even another Tuner instance that might be open.

Please close the other applications and try again.


Best regards,
Hari

Hi,

I am not the correct receipt for this discussion.

Regards,

Jean-Christophe

De : AH_96

Envoyé : lundi 23 novembre 2020 05:40

À : PIQUET Jean-Christophe

Objet : You have been mentioned by AH_96 in Re: Design guidelines to use capsense tuner with custom board in Cypress Developer Community

<http://www.cypress.com>

Cypress Developer Community <https://community.cypress.com/?et=notification.mention>

You have been mentioned

by AH_96<https://community.cypress.com/people/AH_96?et=notification.mention> in Re: Design guidelines to use capsense tuner with custom board in Cypress Developer Community - View AH_96's reference to you<https://community.cypress.com/message/259175?et=notification.mention#259175>

0 Likes
lock attach
Attachments are accessible only for community members.
jcsb1994
Level 4
Level 4
First solution authored 50 replies posted 50 sign-ins

Hi,

The problem was PSoC programmer acquiring the port as you mentioned...
I still can't read my device but I am one step further. I seem not be sending the right i2c packets to the tuner. Now I can setup my i2c settings in the tuner, but I get the "cannot read from device" error when trying to connect, even though I setup my i2c exactly as my i2c block in the topDesign. I am not sure I do what is needed in my software. I use the Capsense_RunTuner() API in my loop, but nowhere do I assign my i2c block to it, so I am not sure if I am actually sending the packets through my i2c pins. I wonder if I have to tell psoc creator somehow I am not using predetermined i2c pins that would be defined somewhere and normally linked to the kitprog i2c-usb on a development kit...

I attached my project just in case.. Thank you!

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi JeSi_4326976​,

The issue is due to incorrect set up of I2C parameters. For running tuner, you need to configure an EzI2C slave - PSoC cannot be the master. Tuner acts as the master. Please refer any CapSense CE for this.

I also want to point out that you need to use CapSense_ProcessAllWidgets API instead of UpdateAllBaseline for the new component and it is recommended to execute CapSense_RunTuner between CapSense_ProcessAllWidgets and CapSense_ScanAllWidgets.

An example firmware flow:

    /* Start the EZI2C component to tune CapSense sensors */ 

    EZI2C_Start();

   

    /* Set the CapSense data structure as the I2C buffer to be exposed to the

     * master on primary slave address interface. Any I2C host tools such as the

     * Tuner or the Bridge Control Panel can read this buffer but you can

     * connect only one tool at a time.

     */

    EZI2C_EzI2CSetBuffer1(sizeof(CapSense_dsRam), sizeof(CapSense_dsRam),

                            (uint8_t *)&(CapSense_dsRam));

   

    /* Start the CapSense block */

    CapSense_Start();

   

    /* Scan all the enabled widgets */

    CapSense_ScanAllWidgets();

   

    for(;;)

    {

        /* Initiate a new scan only if the CapSense block is idle */

        if(CapSense_NOT_BUSY == CapSense_IsBusy())

        {

            /* Performs full data processing of all enabled widgets */

            CapSense_ProcessAllWidgets();

           

            /* Sync with the Tuner application to fetch the latest CapSense 

             * parameters and update back the sensor data such as rawcount,

             * baseline etc.

             */

            CapSense_RunTuner();

           

            /* Scan all enabled widgets */

            CapSense_ScanAllWidgets();

        }

    }

Best regards,
Hari