1 2 3 4 Previous Next 54 Replies Latest reply on Jun 27, 2016 10:17 PM by userc_40243 Go to original post
      • 15. Re: about PSoc 4 BLE(Technical Support)

        Hi bob,

           

        I heard about flash memory that it stores last written data .

           

        I also  want to know how to write and read data in flash such that onTime and offTime works properly(ie last written onTime and offTime value are taken automatically from flash memory).

           

        I am using PSoc4

           

        I found that  function(uint32 CySysFlashWriteRow(uint32 rowNum, const uint8 rowData[]) is used to write data in flash.

           

         

           

        Now I am using

           

         ondelayData[0] = wrReqParam->handleValPair.value.val[0];
                        ondelayData[1] = wrReqParam->handleValPair.value.val[1];
                        ondelayData[2] = wrReqParam->handleValPair.value.val[2];
                        ondelayData[3] = wrReqParam->handleValPair.value.val[3];
                        ondelayData[4] = wrReqParam->handleValPair.value.val[4];
                         ondelayData[5] = wrReqParam->handleValPair.value.val[5];
                    ondelayData[6] = wrReqParam->handleValPair.value.val[6];
                    ondelayData[7] = wrReqParam->handleValPair.value.val[7];

           

        to write data

           

        and combined bytes by

           

        onTime=(ondelayData[0]*10000000)+(ondelayData[1]*1000000)+(ondelayData[2] *100000) +(ondelayData[3] *10000) +(ondelayData[4] *1000) +(ondelayData[5] *100) +(ondelayData[6] *10)+ (ondelayData[7]*1);

           

        Regards,

           

        Joany.

        • 16. Re: about PSoc 4 BLE(Technical Support)

          Hi Bob ,

             

          You have said to use 

             

            if(i>=5)

             

                  {
                      alertLevel = NOALERT;
                     break;
                  }

             

          to reset automatically.

             

          This I tried before and now also I tried .It just blink once and stop .Not after 5 times.

             

          Please give suggestions.

             

          Thanks and regards 

             

          Joany

          • 17. Re: about PSoc 4 BLE(Technical Support)
            JoMe_264151

            Sorry, but I cannot deduct from your code what exactly you want to perform.

               

            What has your blinking LED to do with the alert state which will change with every call to StackEventHandler()

               

            Why are you using a slow blinking 2Hz ?

               

            What you want with the blinking when the alert state is changing when not yet 5 blinks. (Set up a table)

               

            Why don't you use an independent interrupt driven counter event to blink the LED

               

             

               

            Bob

            • 18. Re: about PSoc 4 BLE(Technical Support)
              JoMe_264151

              There are some restrictions to consider:

                 

              Writing to flash changes internal clocking which get in conflict with a running BLE. Radio has to be shut down before.

                 

              There is a "Supervisory Flash" that allows for storing some data. An example is available in the 100 BLE Projects blog.

                 

               

                 

              Flash may not be written too often. Depending on ambient temperature it may be as low as a few K times.

                 

               

                 

              Bob

              • 19. Re: about PSoc 4 BLE(Technical Support)

                Hi Bob,

                   

                Now just I am doing simple project with 5 blinks.

                   

                ok.I will try by using an independent interrupt driven counter event to blink the LED.

                   

                Thanks and regards

                   

                From Joany

                • 20. Re: about PSoc 4 BLE(Technical Support)
                  JoMe_264151

                  When you use a timer component it will be easier to perform. Take a TCPWM configured as timer with 500ms, so you'll get a blink frequency of 1Hz.

                     

                  No delays, no waiting, no for/while loops within your interrupt handler!!!

                     

                   

                     

                  Bob

                  • 21. Re: about PSoc 4 BLE(Technical Support)

                    Hi Bob,

                       

                    Thank you for your suggestions.I will try it and contact you.

                       

                    Regards  Joany.

                    • 22. Re: about PSoc 4 BLE(Technical Support)

                      Hi Bob,

                         

                      I tried with timer interrupt but it didn't work.

                         

                      I have attached the project.

                         

                      Please give suggestions.

                         

                      By Joany

                      • 23. Re: about PSoc 4 BLE(Technical Support)

                        Hi Bob,

                           

                        I referred your example related to SFlash.Should I want to write a separate program to write datas on SFlash?Should I create registers?

                           

                        Can I assign any starting address of user SFlash row?

                           

                        By Joany

                        • 24. Re: about PSoc 4 BLE(Technical Support)
                          JoMe_264151

                          No offending: But your experiences in programming are not yet too good.

                             

                          Stick to following advices:

                             

                          Care for correct indentation this will help you to keep track of program flow. Could be helpful to set indenting with tabs.

                             

                          Avoid else ifs These are commonly mis-interpreted by us programmers.

                             

                          Avoid blank lines except for single ones separating blocks of code

                             

                          Use comments to indicate what you want to do Only this way you can compare with what you actually did

                             

                          Under Creator->Help you can access the "System Reference Guide". There is a chapter how to declare and define interrupt handlers.

                             

                          Use the isr_StartEx() mechanism and do not tamper in the created files.

                             

                          Regarding your last post

                             

                          Should I want to write a separate program to write datas on SFlash? When you are meaning writing a subroutine / function, that will be ok.

                             

                          Should I create registers? You cannot create registers, they are already there.

                             

                          Can I assign any starting address of user SFlash row? Not sure what you mean: The complete flash area is divided into rows of equal size. Writing to flash will write one row completely. There are constants defining the number of rows and the size of each one.

                             

                           

                             

                          Bob

                          • 25. Re: about PSoc 4 BLE(Technical Support)

                            ok .Thanks Bob .I will try.

                               

                            By Joany

                            • 26. Re: about PSoc 4 BLE(Technical Support)

                              Hi Bob,

                                 

                              Thanks. Using the isr_StartEx() mechanism.I set the flag. I  made the firmware such a way that system is going to deep sleep only when the Blinking process has been stopped.Now its working fine.

                                 

                              I will contact you later.

                                 

                              By Joany

                              • 27. Re: about PSoc 4 BLE(Technical Support)
                                JoMe_264151

                                Makes me feel glad to have helped you!

                                   

                                 

                                   

                                Bob

                                • 28. Re: about PSoc 4 BLE(Technical Support)

                                  Hi,

                                     

                                  In my project when LED is ON voltage is 0v and when LED is OFF voltage is 3.3v.

                                     

                                  I want to know how to interchange the voltage of  LED ON and LED OFF.

                                     

                                                            That is when LED is ON voltage must be 3.3v and when LED is OFF voltage must be 0v.

                                     

                                  Do I  need to modify in cydwr file??

                                     

                                  Give suggestion.I have hereby attach the project.

                                     

                                  By Joany

                                  • 29. Re: about PSoc 4 BLE(Technical Support)
                                    JoMe_264151

                                    That depends on the board layout. I frequently use

                                       

                                    //***********************************************************************************//
                                    //**************** Definitions and Macros *******************************************//
                                    //***********************************************************************************//
                                    #define    FALSE                    (0)                                            //    Define logical false and true values
                                    #define    TRUE                    (!FALSE)                                    //    
                                    #define    forever                    TRUE                                        //    I like that for infinite loops

                                       

                                    #define    ActiveHigh                TRUE                       //    LEDs are active high in this application
                                     

                                       

                                    #define LEDON                    ActiveHigh                                    //    LED state definition
                                    #define LEDOFF                    !LEDON                                      //    Now we can use LED_Write(LEDOFF)

                                       

                                     

                                       

                                    Bob