
Create a Custom BLE GATT Service on nRF52
Define a custom 128-bit GATT service on nRF52 with Zephyr: characteristic properties, read and write callbacks, notifications through the CCC and MTU limits.
Tag
18 posts

Define a custom 128-bit GATT service on nRF52 with Zephyr: characteristic properties, read and write callbacks, notifications through the CCC and MTU limits.
Advertise a non-connectable BLE beacon on an nRF52 with Zephyr: advertising data, bt_le_adv_start parameters, intervals and an iBeacon payload.

Install the nRF Connect SDK v2.9, build a Zephyr blinky for the nRF52840 DK with west build, flash it with west flash and read printk output over serial.

Install Zephyr 4.1 and its SDK with west on Linux or macOS, build the blinky sample for a Nucleo board, flash it, and learn what each command does.

Compare FreeRTOS, Zephyr, NuttX and ThreadX on licensing, scope, hardware support and learning curve, then pick the right RTOS with a decision table.

Send fixed-size messages between Zephyr threads and from ISRs with k_msgq, using K_MSGQ_DEFINE, put and get with timeouts, peek, purge and sizing rules.

Use struct k_work_delayable with k_work_schedule and k_work_reschedule to run work after a delay, then build a debounce, a timeout and a periodic task.

Move slow work out of a Zephyr interrupt handler with k_work_submit and the system workqueue, with the work item rules, a GPIO example and sizing tips.

Run code every N milliseconds in Zephyr with k_timer, including one-shot and periodic modes, the expiry callback rules and how to wake a thread from it.

Negative Zephyr thread priorities are cooperative and never preempted, while zero and above are preemptible. Learn the ranges, the rules and when to use each.

Use K_THREAD_DEFINE to create a Zephyr thread at build time, with stack size, priority and start delay, plus the thread entry signature and how to stop it.

Use per-board .overlay and .conf files in a boards folder so one Zephyr application builds for several boards, with the naming rules for Zephyr 4.2.