2 Replies Latest reply on Apr 15, 2020 5:47 AM by LePo_1062026

    Custom Service with Modus Toolbox and FreeRTOS



      Is there an example that illustrates the creation of a custom service with Modus Toolbox and FreeRTOS? My code is based on the BLE_Battery_Level_FreeRTOS project.
      I am able to create a custom service in the BT-Configurator. I also see that the service is initialized in libs/bless/cy_ble_custom.c. But from where do I register additional functionality, such as calling Cy_BLE_RegisterServiceEventHandler? Is the bless-library file cy_ble_custom.c supposed to be modified. Is there a way to define my service implementation within the scope of my project without touching the Cypress Bluetooth stack? I see that in the non-FreeRTOS PSoc Creator examples Cy_BLE_Start is passed a custom handler for BLE events and custom functionality is added from the handler. But in the FreeRTOS project I cannot find that function.

        • 1. Re: Custom Service with Modus Toolbox and FreeRTOS



          The BLE FreeRTOS project is no different from normal project. Only difference is the firmware flow. FreeRTOS adds some files for scheduling and Task management.


          Also there is no difference in terms  of APIs and other firmware flow between Modus Toolbox 2.1 and PSoC Creator in case of BLE application.


          In the BLE_Battery_Level_FreeRTOS project, you can see the stack_event_handler and its registration " Cy_BLE_RegisterEventCallback(stack_event_handler);" in the ble_task.c file.


          You can add the corresponding code for your custom service read and write operation inside the stack_event_handler present in the ble_task.c




          • 2. Re: Custom Service with Modus Toolbox and FreeRTOS



            When using PSoC Creator and BLE component (v2.10 and in v2.20 PDL 3.1.1) Cy_BLE_Start() is still  present in BLE.c and

            the callback variable cy_ble_config in the cy_stc_ble_config_t struct is still there.


            However, using ModusToolbox,

            • BLE "component is now called "bless" v3.40
            • cy_ble_config is still allocated
            • the struct cy_stc_ble_config_t no longer contains the callback variable
            • Cy_BLE_Start() has been removed.


            Strangely, there are still a few places in the comments of the new BLE PDL version that refers to Cy_BLE_Start().