Feedback
Feedback

If you are having issues with the exercises, please create a ticket on DevZone: devzone.nordicsemi.com
Click or drag files to this area to upload. You can upload up to 2 files.

Device driver model

The Zephyr RTOS that the nRF Connect SDK is based on provides a device driver model. This driver implementation is highly decoupled from its API, which allows developers to switch out the low-lever driver implementation without modifying the application on top, because we can use the same generic API.

This decoupling has many benefits, including a high level of portability, as it makes it possible to use the same code on different boards without manually modifying the underlying driver implementation.

Recall

The Zephyr device driver model was also covered in Lesson 2 – Device driver model of the nRF Connect SDK Fundamentals course

The Zephyr device driver model is the architecture that defines the association between the generic APIs and the device driver implementations. We can split the model into three different sections, as shown in the image below.

The three sub-categories for the device driver model are

  1. Device driver APIs
  2. Device driver instances
  3. Device driver implementation

Zephyr interacts with the core operating system and various hardware devices using standardized APIs. These provide hardware abstraction that can be used from application layer. Thanks to standarized API it is possible to choose any device which supports this API and changing for different one does not require modyfing the application. List of all drivers APIs can be found in Device Driver APIs. In Exercise 1 we create the driver implementing existing sensor API

In some cases there is no existing API for specific requirements. Then it is possible to introduce custom API and integreate with Zephyr build system. Thanks to that the driver can implement custom requirements and provide abstaction to the application level. There is possible to extend application portability by implementing more drivers covering custom API. Implementing driver with custom API is covered by Exercise 3.

For both standard and custom API drivers it is possible to add power management functionality. Power Management is standarized subsystem resposible for putting device driver into suspend mode to decrease power consumption. Each device driver defines its own behavior in low power mode. Extending device driver by power management is covered by Device power management topic in this lesson. In addition Exercise 2 presents all necessary steps which are nedded to implement power management in custom driver.

Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.