14 Replies Latest reply on Oct 20, 2014 12:15 PM by user_1377889

    How to enable/disable sensor autoreset by soft on CY8C24994,?

    romain.desirest

      Hi,

         

      I would like to be able to allow a long button touch detection time (>15s) but i also must keep the sensor autoreset as enable.

         

      I tried it by setting the baseline_update_threshold at its max (255) but it's not sufficient enough.

         

      So my idea is to disable the sensor autoreset each time  a long touch is detected (by a timer).

         

      I searched on cypress datasheet, applications notes, forums and google but didn't found any information on how to do that.

         

      So my questions are : is it possible ? is there any register, variable or function to access the sensor autoreset setting ?

         

      Thanks,

        • 1. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
          content.librarian

           Unfortunately, you can't do it without changing the code. Is there a particular reason for keeping the autoreset on ?

             

          You can always keep a software baseline reset for an unwanted condition.

             

          -Prakhar

          • 2. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
            romain.desirest

            Hi, Thanks for your help.

               

             

               

            I must keep the autoreset on because of environnementals electromagnetismes conditions.

               

            But if i could turn the autoreset off for 15sec (time needed for long touch) and then turn it on it would be OK.

               

            The thing is, I don't know how to turn it on/off by soft.

               

            So my question is which register should i write ? and how to access it ?

               

            Any documentation or weblink would be helpfull.

               

             

               

            Regards,

            • 3. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
              arvi

               Hi,

                 

               

                 

              You can use the Macro, "CSD_AUTORESET", where CSD is your user module name.

              • 4. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                arvi

                Hi,

                   

                I think I misunderstood your requirement. The macro is read-only and can't be used to ALTER autoreset status.

                   

                 

                   

                If you're requirement is to change the Autoreset function (enable/disable) during runtime from within the firmware, you'll have to make some minor modifications to your usermodule code as follows:

                   

                 

                   

                 

                   

                1. Open CSD_1hl.asm from lib>Library Source Files folder

                   

                 

                   

                2. Find the following section -> 

                   

                 

                   

                 

                   

                ;@PSoC_UserCode_INIT@ (Do not change this line.)

                   

                ;---------------------------------------------------

                   

                ; Insert your custom declarations below this banner

                   

                 

                   

                and add the following lines after the above banner:

                   

                 

                   

                 

                   

                export CSD_1_AUTORESET_custom

                   

                export _CSD_1_AUTORESET_custom

                   

                 

                   

                 

                   

                 

                   

                 

                   

                3. Also allocate some space for the variables:

                   

                 

                   

                ;------------------------

                   

                ; User Variable Allocation

                   

                ;------------------------

                   

                CSD_1_AUTORESET_custom: BLK 1

                   

                _CSD_1_AUTORESET_custom: BLK 1

                   

                 

                   

                 

                   

                4. In the same file, search for "CSD_1_AUTORESET" and replace it with the variable name "CSD_1_AUTORESET_custom"

                   

                 

                   

                 

                   

                5. Now in your code, you can invoke your variable by adding a reference declaration "extern CSD_1_AUTORESET_custom"

                   

                Autoreset function can be toggled ON/OFF with CSD_1_AUTORESET_custom = 1 or CSD_1_AUTORESET_custom = 0;

                   

                 

                   

                 

                   

                Please try this out and let me know how it goes.

                   

                 

                   

                 

                   

                Regards,

                   

                Arvind

                • 5. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                  arvi

                   Another change which I missed, is to replace the "IF" statements with "tst"

                     

                   

                     

                  See the code snippets as follows (in CSD_1hl.asm) :

                     

                   

                     

                  Original:

                     

                   

                     

                   

                     

                  IF (CSD_1_AUTORESET)

                     

                     cmp [X+CSD_1_waSnsDiff+MSB], 0

                     

                     jz   .AddBucketLSB

                     

                     mov  A, 255

                     

                     jmp  .AddBucketConst

                     

                  ELSE

                     

                     ; Compare to Noise Threshold

                     

                     cmp [X+CSD_1_waSnsDiff+MSB], 0

                     

                     jnz  .InitLowBaselineReset

                     

                     mov A, [CSD_1_bNoiseThreshold]

                     

                     cmp A, [X+CSD_1_waSnsDiff+LSB]

                     

                     jc .InitLowBaselineReset

                     

                  ENDIF

                     

                   

                     

                   

                     

                   

                     

                   

                     

                  Modify to:

                     

                   

                     

                   

                     

                  tst [CSD_1_AUTORESET_custom], 0

                     

                  jz .ARST_disabled

                     

                     cmp [X+CSD_1_waSnsDiff+MSB], 0

                     

                     jz   .AddBucketLSB

                     

                     mov  A, 255

                     

                     jmp  .AddBucketConst

                     

                  .ARST_disabled:

                     

                     ; Compare to Noise Threshold

                     

                     cmp [X+CSD_1_waSnsDiff+MSB], 0

                     

                     jnz  .InitLowBaselineReset

                     

                     mov A, [CSD_1_bNoiseThreshold]

                     

                     cmp A, [X+CSD_1_waSnsDiff+LSB]

                     

                     jc .InitLowBaselineReset

                     

                   

                     

                  -Arvind

                  • 6. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                    francesco.falcinelli

                     Hello, I also have the same problem with the PSOC1 CY8C21234.

                       

                    I tried to replace the IF statements in the CSDhl.asm file, but when I try to compile the code, he returns the original code before the modify.

                       

                    How I can solve this?

                       

                    Thanks

                       

                    Francesco Falcinelli

                    • 7. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                      user_14586677

                      This might help -

                         

                       

                         

                          

                         

                                http://www.cypress.com/?id=4&rID=92671     Custom User Modules with PSoC® Designer™ 5.4 - KBA86943

                         

                       

                         

                      Regards, Dana.

                      • 8. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                        francesco.falcinelli

                         Hi,

                           

                        thanks for your help.

                           

                        Now, when I try to compile, I have some errors:

                           

                        main.c(66):undeclared identifier `CSD_baBtnFThreshold'

                           

                        main.c(66): type error: pointer expected

                           

                        main.c(90):[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function  takes or returns values other than int ----> call to CSD_ScanAllSensors() function

                           

                        main.c(91):[warning] [MISRA 2200]calling an undeclared function may cause unexpected behavior if the function takes or returns values other than int ----> call to CSD_UpdateAllBaselines() function

                           

                        My User Module is named CSD, not CSD_1 and I modified the code for CSD.

                           

                        Thanks

                           

                        Francesco 

                           

                         

                           
                                
                           
                                
                        • 9. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                          user_1377889

                          Very difficult to say what the reason for the compile-errors is when it is not a typo. Can you post your complete project, so that we all can have a look at all of your settings? To do so, use
                          Creator->File->Create Workspace Bundle (minimal)
                          and attach the resulting file.
                           

                             

                          Bob

                          • 10. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                            user_14586677

                            To post a PSOC Designer archive -

                               

                             

                               

                            “File”                                                           Designer

                               

                            “Archive Project”

                               

                             

                               

                            Regards, Dana.

                            • 11. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                              francesco.falcinelli

                               Hi,

                                 

                              I've attached my project created with PSOCdesigner 5.3.

                                 

                              Thanks

                                 

                              Francesco

                              • 12. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                                user_14586677

                                Seems to me that the string is not getting assigned to anything ? I get an error

                                   

                                here -

                                   

                                 

                                   

                                ; Determine whether the wizard was called after place, rename or update operation
                                CSD_WIZARD_PROCESSED:                      equ 0
                                IF CSD_WIZARD_PROCESSED^1
                                "Wizard_was_not_called_after_place_rename_configuration_change_or_update_Open_Chip_Editor_open_Wizard_press_OK_button_and_generate_project"
                                ENDIF

                                   

                                 

                                   

                                Maybe Bob can comment on this.

                                   

                                 

                                   

                                Otherwise looks like a Cypress error and you should file a CASE -

                                   

                                 

                                   

                                    

                                   

                                          

                                   

                                To create a technical case at Cypress -

                                   

                                 

                                   

                                www.cypress.com

                                   

                                “Support”

                                   

                                “Technical Support”

                                   

                                “Create a Case”

                                   

                                 

                                   

                                You have to be registered on Cypress web site first.

                                   

                                 

                                   

                                Regards, Dana.

                                • 13. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                                  francesco.falcinelli

                                   Thank you for your reply.

                                     

                                  I did not understand what it means to:

                                     

                                  ; Determine whether the wizard was called after place, rename or update operation

                                     

                                  CSD_WIZARD_PROCESSED:                      equ 0
                                  IF CSD_WIZARD_PROCESSED^1
                                  "Wizard_was_not_called_after_place_rename_configuration_change_or_update_Open_Chip_Editor_open_Wizard_press_OK_button_and_generate_project"
                                  ENDIF

                                     

                                  I created a technical case at Cypress.

                                     

                                  Regards

                                     

                                  Francesco

                                  • 14. Re: How to enable/disable sensor autoreset by soft on CY8C24994,?
                                    user_1377889

                                    When you for instance rename the CSD component you have to use the wizard (just open, then OK) so that some internals can be processed. That will solve your problem.

                                       

                                     

                                       

                                    Bob