Custom Service with Modus Toolbox and FreeRTOS

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnKn_4627811
Level 1
Level 1

Hi

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.

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

AnKn,

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().

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
2 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

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

Thanks

Ganesh

0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

AnKn,

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().

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes