5 Replies Latest reply on Jan 2, 2017 3:20 AM by neuhauser.johann_1862776

    CyBle_ProcessEvents() in a FreeRTOS Task

    neuhauser.johann_1862776

      Hello Community,

         

      i´m trying to use the "BLE stack" that is provided with PSoC Creator as static library in a FreeRTOS Task.

         

      My first idea was to call "CyBle_ProcessEvents()" in the Idle Task, but this trail was not successful.

         

      Now, i have created a FreeRTOS Task for the processing of the BLE stack api´s, but this isn´t working as expected too.

         

       

         

      The task that processes the BLE stack api´s is at highest priority and it is the only task at this priority.

         

      Also the BLE_bless_isr is at the highest priority.

         

      The problem occurs in the call "CyBle_ProcessEvents()".

         

       

         

      Du you have any ideas what i do wrong or why it isn´t possible to call the api´s of the BLE stack static libraries within a FreeRTOS Task?

         

       

         

      Because the BLE library is static, i can´t debug it with the debugger.

         

       

         

      I have attached the files for the FreeRTOS Task.

         

       

         

      Thanks in advance

        • 1. Re: CyBle_ProcessEvents() in a FreeRTOS Task
          bmah

          Can you attach your full project? Is the device advertising at-least ? What is the exact issue you are facing at the BLE layer? Also, did you try increasing the task stack size?

          • 2. Re: CyBle_ProcessEvents() in a FreeRTOS Task
            neuhauser.johann_1862776

            Yes, the device is advertising at least. But i can see it only with the CySmart Android App on my Smartphone, if i want to pair my smartphone with the device i get always an error.

               

            With the CySmart version for Windows and the BLE dongle of the CY8CKIT-042-BLE kit i can´t find it anymore.

               

            Other PSoC Creator BLE examples are working perfectly.

               

             

               

            I have created some debug output over UART and only CYBLE_EVT_STACK_ON and CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP get processed.

               

             

               

            I also have an additional FreeRTOS Task that prints out the stack high water mark. Yes i have increased the task stack size.

               

             

               

            Here is my complete project workspace. I have disabled some code of my Display and NFC-Controller with macros.

               

            Don´t be confused.

               

             

               

            Thanks in advance.

            • 3. Re: CyBle_ProcessEvents() in a FreeRTOS Task
              neuhauser.johann_1862776

              Now i have started a new clean Project also with FreeRTOS 9.0, but without any additional components, except CapSense, UART, I2C.

                 

               

                 

              My Hardware is, CY8CKIT-042-BLE with EZ-BLE PRoC Evaluation Board (CYBLE-212019-EVAL) attached.

                 

               

                 

              For FreeRTOS i use only WDT1 as Tick Timer.

                 

              Idle Task is going to Deep Sleep if BLE is stopped and to Sleep if BLE is started.

                 

               

                 

              BLE isn´t working! Until now i dont use LowPowerImplementation, except Sleep, if BLE is started.

                 

              What is my fault that BLE isn´t working with FreeRTOS?

                 

              In the BLE_v3_20.pdf on page 3, there is a picture where a Software Timer is mentioned. How is this Software Timer implemented in the BLE Stack?

              • 4. Re: CyBle_ProcessEvents() in a FreeRTOS Task
                hima

                Hello,

                   

                We have a simple example on FreeRTOS with PSoC4 BLE. This is a sample project created by us and not 100% tested. But this is working with an older version of Creator. Can you please have a look at this project.

                   

                Thanks,

                   

                Hima

                • 5. Re: CyBle_ProcessEvents() in a FreeRTOS Task
                  neuhauser.johann_1862776

                  Thank for all your help.

                     

                  I have opened a Support Ticket and they could help me... This problem is hardware specific for my CYBLE-212019 EZ-BLE Module.

                     

                  The problem is that the BLE component version v3_10 and v3_20 set the cap trim values in the function CyBle_Start().

                     

                  The right value for the cap trim settings should be set after that call. The values are documented in "EZ-BLE PRoC Module Datasheet" Table 49 on page 25.

                     

                  Here is the fix for that issue:

                     

                   

                     

                  /* Start up Ble sub system */
                  apiResult = CyBle_Start( prvAppCallBack );
                  configASSERT( CYBLE_ERROR_OK == apiResult );
                      
                  /* Set ECO trim value for EZ-BLE Module(CYBLE-212019) after BLE startup,
                   * bacause BLE component (v3_10 and v3_20) setup ECO with wrong cap trim
                   * values for this module.
                   * Note: Value is from "EZ-BLE PRoC Module Datasheet" Table 49 on page 25. */
                  *(uint32*) CYREG_BLE_BLERD_BB_XO_CAPTRIM = 0x0000BCBC;

                     

                   

                     

                  This topic could be closed.