| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT Time Synchronization
This example requires the following SoftDevice: S212

Important: Before you run this example, make sure to program the SoftDevice.

The ANT Time Synchronization example is designed to showcase the capability of ANT to precisely synchronize events between multiple devices, in this case LEDs flashing in unison across multiple devices. The ANT protocol will time-correct a 2-byte clock message for when it is actually transmitted by the stack, allowing the receiving nodes to synchronize their own clock or counter, in order to align with the transmitter.

This example can be used with two or more development boards. Multiple slave endpoints can synchronize to the same master endpoint for a larger demonstration.

Time synchronization example topology using two development boards

# Transmitter

You can find the source code and the project file of the example in the following folder: `<InstallFolder>\examples\ant\ant_time_synchronization\tx`

# Receiver

You can find the source code and the project file of the example in the following folder: `<InstallFolder>\examples\ant\ant_time_synchronization\rx`

# Testing

Note: You can use a custom channel or encryption when running any of the ANT examples. When adding a new channel or encryption, remember to update ANT stack configuration.

1. Compile and program the Time Synchronization Receiver project onto the module (or multiple modules).
2. Watch as the LEDs turn on and off in a pattern starting from BSP_LED_0 > BSP_LED_1 > BSP_LED_2 > BSP_LED_3, at a fixed interval. The slave endpoints are only listening and will not synchronize with one another.
3. Compile and program the Time Synchronization Transmitter project onto the module.
4. Watch as the slave endpoint nodes synchronize to the master endpoint node. As the slave endpoints pair, they reset their LED lighting configuration and event time to precisely match Node A within up to 2 RTC clock ticks (1 tick of resolution on each node).