1 2 Previous Next 20 Replies Latest reply on Nov 3, 2016 8:03 AM by user_301665782

    Code issues related to reset

    user_301665782

      Hi Every one

         

      Thank you for the possibility to ask questions here.

         

      This may be a silly question.

         

      Assume  that  you are verified that all  project's components  are  correctly started and the variables that should be initialized are OK.

         

      What can be the reason  that certain code  just  run ok one time  after the  end of chip's program from PSoC Creator or after Power on Reset ?

         

      Thank you very much foe any help.

         

      Regards

        • 1. Re: Code issues related to reset
          user_1377889

          Stack corruption is the most probable reason for that. Post your project and we check it.

             

           

             

          Bob

          • 2. Re: Code issues related to reset
            user_301665782

            Hi Bob

               

            Thank you.

               

            I will do some cosmetic to the code because  comments are a mix between English/Spanish and I will post it.

               

            thank you again

               

            Regards,

            • 3. Re: Code issues related to reset
              user_301665782

              Hi Bob

                 

               

                 

              Please see attached bundle.

                 

              The project is about a star network through Infrared link with a kind of RC5 encoding scheme.

                 

              The attached project has an IrGateway Project which send messages  to the different  sensors in loop fashion , with a time gap between messages.

                 

              That message is to address a different sensor through the sensor number and sensor type.

                 

              The sensor 'answer sending  data trough a payload is not yet implemented.

                 

              I'm stuck at this point: Sending the request -  the sensor  board capability  to recognize that the message is for it.

                 

              How the project is implemented:

                 

              For the IrGateway project  I am using a CY8CIKit-050.

                 

              Currently I have implemented  only two sensors with CY8CKIT-059 each one.

                 

              Actually there is not sensor at all at this point.

                 

              I 'm only sending a constant value as request for  each sensor.

                 

              That constant  value include Sensor  number and sensor type plus Header/ Preamble and CRC.

                 

              Facts:

                 

              1-Trough Debugging I verified that each sensor receive its payload  correctly .

                 

              1-Trough the scope I verified that the pulse train send to each sensor is OK.

                 

              2-Each sensor board has an additional led which show me with short blink  that the message was not addressed to it and  with long Blink when the message was addressed to it.

                 

              3-At IrGateway Project the main loop is just  set sensor number in a SN variable and call a function which does the request first for sensor #0  wait 2 seconds  and  it does a same with sensor #1.

                 

              Issue #1: each sensor board recognize that a payload was received  but issue a short blink showing me that the message was not addressed to it, which is not  true (point 1).

                 

              Issue #2: While the IrGateway board is sending messages , if  I do a power cycle the code run correctly just once afterward. 

                 

              Issue #3: The same as issue #2 happens once I finish to flash the code.

                 

              Note: I am not  professional programmer  neither Psoc 5 expert.

                 

              I hope it is clear enough so you can help me with that.

                 

              Thank you so much.

                 

              Best regards,

                 

              Alex

              • 4. Re: Code issues related to reset
                user_301665782

                Hi Bob again !

                   

                I forgot  to tell you that each couple IrGateway - Sensor#  is working OK separately beside that it is necessary to do a power cycle or  flash the code  so that it start running. 

                   

                 

                   

                I only get the code running with the following to conditions:

                   

                Condition #1

                   

                Gateway - Sensor #0  is  working Ok  -  Sensor 1 just recognize a wrong request.(Payload)
                int main()

                   

                     SN=0;
                      RqtsAnswer( SN );
                      CyDelay(2000);
                      
                   //   SN=1;
                   //  RqtsAnswer( SN );
                    //  CyDelay(2000);
                    
                      

                   

                 

                   

                Condition #2

                   

                 

                   

                 

                   

                Gateway - Sensor #1  is Ok  - Sensor 0 just recognize a wrong request (  Payload)

                   

                int main()
                      SN=0;
                      RqtsAnswer( SN );
                      CyDelay(2000);
                      
                    SN=1;
                    RqtsAnswer( SN );
                    CyDelay(2000);
                   

                   

                 

                   

                 

                   

                The worse issue is as I mentioned in the last post.:

                   

                 

                   

                int  main()

                   

                 

                   

                      SN=0;
                      RqtsAnswer( SN );
                      CyDelay(2000);
                      
                      SN=1;
                     RqtsAnswer( SN );
                     CyDelay(2000);
                    

                   

                 

                   

                Additional info     

                   

                The receiver is a TSOP 36436 hooked up to Demod_input on each receiver,

                   

                 

                   

                Thank you very much

                   

                Alex

                • 5. Re: Code issues related to reset
                  user_1377889

                  Alex, it is too difficult to follow with just some code snippets.

                     

                   

                     

                  Bob

                  • 6. Re: Code issues related to reset
                    user_301665782

                    Hi Bob

                       

                    How should I send you the 344 MB bundle ?

                    • 7. Re: Code issues related to reset
                      user_1377889

                      Delete the generated files and clean the project before building the bundle.

                         

                       

                         

                      Bob

                      • 8. Re: Code issues related to reset
                        user_301665782

                        Hi Bob

                           

                        Ok

                           

                        Alex

                        • 9. Re: Code issues related to reset
                          user_301665782

                          Hi Bob

                             

                          I did like you told me, but in spite to deleted all generated source and clean all project, the zip  is very heavy, around 340 MB.

                             

                          Please see the attached one which has the Standard Cypress Libraries deleted.

                             

                          Let me know if it does work, if doesn't I can send PDF for each file

                             

                          Thank you very much.

                             

                          Alex

                          • 10. Re: Code issues related to reset
                            anks

                            Please debug your project and check whether it is going to an infinite loop-

                               

                            CY_ISR(IntDefaultHandler)
                            {

                               

                                while(1)
                                {
                                    /***********************************************************************
                                    * We must not get here. If we do, a serious problem occurs, so go
                                    * into an infinite loop.
                                    ***********************************************************************/
                                }
                            }

                            • 11. Re: Code issues related to reset
                              user_301665782

                              Hi Anks

                                 

                               

                                 

                              Thank you very much for your help.

                                 

                              Could you please be a little be more specific about what I should do?

                                 

                              There are one Emitter and two receivers.

                                 

                              On pervious post I've mentioned that the each Emitter-Receiver work OK  but in this case 80% the time the code start running only if I do a power-cycle or I flash the code into the Psoc5 device.

                                 

                              So in what situation I need to insert  this snippet?

                                 

                              CY_ISR(IntDefaultHandler)
                              {

                                 

                                  while(1)
                                  {
                                      /***********************************************************************
                                      * We must not get here. If we do, a serious problem occurs, so go
                                      * into an infinite loop.
                                      ***********************************************************************/
                                  }
                              }

                                 

                              On the Emitter, on the receiver or over the three boards.

                                 

                              Sorry if I do not understand your valuable help.

                                 

                              Thank you

                                 

                              Alex.

                              • 12. Re: Code issues related to reset
                                user_301665782

                                Hi Anks

                                   

                                Thank you for your help.

                                   

                                Can you be more specific about where I need to insert that loop please?

                                   

                                I mean, on the Emitter end or Receivers end. - There are to receiver end by now.

                                   

                                Thank you for your valuable help

                                   

                                Alex

                                • 13. Re: Code issues related to reset
                                  user_1377889

                                  This loop already exists in cyboot.c. When your project gets stuck when debugging, halt it and see where you are. The call stack will be of much help. That above loop is called in case of dramatic errors as addressing non-existing memory, invalid instruction and similar catastrophes.

                                     

                                   

                                     

                                  Bob

                                  • 14. Re: Code issues related to reset
                                    user_301665782

                                    Hi Bob and Anks

                                       

                                    Thank you very much both of you.

                                       

                                    I will try that.

                                       

                                    Alex

                                    1 2 Previous Next