samples/drivers/adc/adc_dt/README.html · samples/drivers/adc/adc_dt/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Drivers · ADC

Devicetree 기반 ADC

Channel별 raw ADC 값을 읽고 가능한 경우 millivolt로 변환합니다.

Official pathsamples/drivers/adc/adc_dt/README.html
Source filesamples/drivers/adc/adc_dt/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

io-channels, channel child node와 overlay 요구 사항을 설명합니다.

API

ADC driver

Config

Devicetree

Reference

Raw · mV

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 739430460F6256A5C13AA863429C5BFA36F8DFD6BAD506F84625B071B507518D
.. zephyr:code-sample:: adc_dt
   :name: Analog-to-Digital Converter (ADC) with devicetree
   :relevant-api: adc_interface

   Read analog inputs from ADC channels.

Overview
********

This sample demonstrates how to use the :ref:`ADC driver API <adc_api>`.

Depending on the target board, it reads ADC samples from one or more channels
and prints the readings on the console. If voltage of the used reference can
be obtained, the raw readings are converted to millivolts.

The pins of the ADC channels are board-specific. Please refer to the board
or MCU datasheet for further details.

Building and Running
********************

The ADC peripheral and pinmux is configured in the board's ``.dts`` file. Make
sure that the ADC is enabled (``status = "okay";``).

In addition to that, this sample requires an ADC channel specified in the
``io-channels`` property of the ``zephyr,user`` node. This is usually done with
a devicetree overlay. The example overlay in the ``boards`` subdirectory for
the ``nucleo_l073rz`` board can be easily adjusted for other boards.

Configuration of channels (settings like gain, reference, or acquisition time)
also needs to be specified in devicetree, in ADC controller child nodes. Also
the ADC resolution and oversampling setting (if used) need to be specified
there. See :zephyr_file:`boards/nrf52840dk_nrf52840.overlay
<samples/drivers/adc/adc_dt/boards/nrf52840dk_nrf52840.overlay>` for an example of
such setup.

Building and Running for ST Nucleo L073RZ
=========================================

The sample can be built and executed for the
:ref:`nucleo_l073rz_board` as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/adc/adc_dt
   :board: nucleo_l073rz
   :goals: build flash
   :compact:

To build for another board, change "nucleo_l073rz" above to that board's name
and provide a corresponding devicetree overlay.

Sample output
=============

You should get a similar output as below, repeated every second:

.. code-block:: console

   ADC reading:
   - ADC_0, channel 7: 36 = 65mV

.. note:: If the ADC is not supported, the output will be an error message.

Part 3

한국어 전문 번역

개요

이 sample은 ADC driver API의 사용법을 보여줍니다.

대상 board에 따라 하나 이상의 channel에서 ADC sample을 읽고 측정값을 console에 출력합니다. 사용한 reference의 voltage를 구할 수 있으면 raw reading을 millivolt로 변환합니다.

ADC channel의 pin은 board마다 다릅니다. 자세한 내용은 해당 board 또는 MCU datasheet를 참조하십시오.

Build와 실행

ADC peripheral과 pinmux는 board의 .dts 파일에서 구성합니다. ADC가 활성화되어 있는지, 즉 status = "okay";인지 확인하십시오.

또한 이 sample은 zephyr,user node의 io-channels property에 지정된 ADC channel이 필요합니다. 보통 devicetree overlay에서 설정합니다. boards 하위 directory에 있는 nucleo_l073rz용 예제 overlay는 다른 board에도 쉽게 맞춰 사용할 수 있습니다.

Gain, reference, acquisition time 같은 channel 설정도 devicetree의 ADC controller child node에 지정해야 합니다. ADC resolution과 oversampling 설정을 사용하는 경우 이 값들도 그곳에 지정해야 합니다. 이러한 구성의 예는 samples/drivers/adc/adc_dt/boards/nrf52840dk_nrf52840.overlay를 참조하십시오.

ST Nucleo L073RZ용 Build와 실행

nucleo_l073rz board에서는 다음과 같이 sample을 build하고 실행할 수 있습니다.

west build -b nucleo_l073rz samples/drivers/adc/adc_dt
west flash

다른 board용으로 build하려면 위의 nucleo_l073rz를 해당 board 이름으로 바꾸고, 그 board에 맞는 devicetree overlay를 제공하십시오.

Sample 출력

아래와 비슷한 출력이 1초마다 반복되어야 합니다.

ADC reading:
- ADC_0, channel 7: 36 = 65mV

참고: ADC가 지원되지 않으면 오류 message가 출력됩니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.