Profiler synchronization module

Use the profiler synchronization module to synchronize the timestamps of Profiler events between two devices connected over a physical wire. Timestamp synchronization is required to increase the accuracy of the measured times between the profiler events that come from two different devices.

The profiler data is collected separately from both devices using dedicated Python scripts. The data can then be merged using the merge_data.py script with sync_event used as a synchronization event for both Peripheral and Central. For more detailed information, see the Profiler documentation.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Source modules for module_state_event

module_state_event

profiler_sync

module_state_event

Sink modules for module_state_event

Note

See the Overview: Firmware architecture for more information about the event-based communication in the nRF Desktop application and about how to read this table.

Configuration

A predefined signal on the GPIO is used to simultaneously generate synchronization profiler events on both devices. For this reason, you must enable the CONFIG_GPIO option.

Make also sure that the CONFIG_EVENT_MANAGER_PROFILER_ENABLED Kconfig option is enabled and the CONFIG_EVENT_MANAGER_TRACE_EVENT_EXECUTION Kconfig option is disabled. The profiler synchronization module generates a Profiler event (sync_event) that is not an Event Manager event. For this reason, the sync_event execution is not traced.

You also need to define:

  • the GPIO port (CONFIG_DESKTOP_PROFILER_SYNC_GPIO_PORT) and the pin (CONFIG_DESKTOP_PROFILER_SYNC_GPIO_PIN) that are used for synchronization These GPIOs must be defined separately for both devices and connected using a physical wire.

  • the device role One of the devices must be set as Central (CONFIG_DESKTOP_PROFILER_SYNC_CENTRAL) and the other device must be set as Peripheral (CONFIG_DESKTOP_PROFILER_SYNC_PERIPHERAL).

Implementation details

The profiler synchronization Central generates a predefined signal that is received by Peripheral over the physical wire. Both devices generate a profiler event (sync_event) on every signal edge. That results in sync_event being generated on both devices at the same time. Timestamps of this event on both devices can be used for clock drift compensation.