Introduction to Zephyr Part 5: Devicetree Bindings | DigiKey
Автор: DigiKey
Загружено: 2025-04-03
Просмотров: 4311
Описание:
Devicetree bindings in Zephyr bridge the gap between hardware description and driver code. In this tutorial, we explore how bindings define what Devicetree properties are required and how they should be interpreted by drivers. With bindings, hardware details remain in the Devicetree files and YAML schemas; enabling clean, platform-agnostic C code that automatically adapts to different boards or peripherals.
Shawn is hosting a free, hands-on webinar that walks you through the process of developing your own device driver in Zephyr. Check it out! https://event.on24.com/wcc/r/4870160/...
You can find a written version of this tutorial here: https://www.digikey.com/en/maker/tuto...
The GitHub repository for this course (including solutions to the challenges) can be found here: https://github.com/ShawnHymel/introdu...
Focusing on the ESP32-S3 Analog-to-Digital Converter (ADC), we look at how its binding files (espressif,esp32-adc.yaml and the generic adc-controller.yaml) specify properties such as reference voltage, gain, resolution, and more. We walk through creating an overlay file (esp32s3_devkitc.overlay) to enable and configure ADC0, assign channel 0 to GPIO1, and set properties like zephyr,gain and zephyr,vref-mv.
On the code side, you’ll see how Devicetree macros like DEVICE_DT_GET() and ADC_CHANNEL_CFG_DT() dynamically fetch the right drivers and configurations—no hardcoded addresses or board-specific #defines needed. This approach drastically reduces errors and simplifies your codebase, as changes in the overlay automatically propagate to the build and application.
Beyond the ADC, this same pattern applies to other peripherals like UART, I2C, SPI, or PWM. Each device has a corresponding YAML binding file that lists required properties, and Zephyr enforces these at build time. As a fun challenge, we suggest combining the ADC input with a PWM output to drive an LED, illustrating how Devicetree and bindings unify hardware configuration across multiple subsystems.
Stay tuned for the next episode, where we’ll create our own device driver and fully leverage Kconfig, Devicetree, and bindings to produce truly portable, maintainable embedded applications!
Official Zephyr documentation: https://docs.zephyrproject.org/latest...
Introduction to RTOS: • Introduction to RTOS Part 1 - What is a Re...
ESP32-S3-DevKitC: https://www.digikey.com/en/products/d...
Maker.io - https://www.digikey.com/en/maker
DigiKey’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with DigiKey on Facebook / digikey.electronics
And follow us on X: https://x.com/digikey
0:00 Intro
1:00 Hardware Overview
2:57 DeviceTree Nodes
5:09 ADC Binding
18:12 Compatible Strings
19:04 Driver Header
23:16 ADC Demo Application
39:55 Going Further
40:31 Challenge: PWM Controller
44:09 Conclusion
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: