Part 1
요약·해설
Compatible, loopback 배선과 세 차례 반복 출력을 보존합니다.
Compatible
zephyr,spi-bitbang
Words
9-bit
Loopback
MISO ↔ MOSI
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
원문 SHA-256
ACA1A06F5CA2521EF2FEE131CB53101566CEA901CD7243BD75E3EA8D1DEF3B21
.. zephyr:code-sample:: spi-bitbang
:name: SPI bitbang
:relevant-api: spi_interface
Use the bitbang SPI driver for communicating with a slave.
Overview
********
This sample demonstrates using the bitbang SPI driver. The bitbang driver can
be useful for devices which use a non multiple of 8 word size, for example some
LCDs which have an extra cmd/data bit.
This sample loops through some different spi transfer configurations.
Building and Running
********************
The application will build only for a target that has a :ref:`devicetree
<dt-guide>` entry with :dtcompatible:`zephyr,spi-bitbang` as a compatible.
You can connect the MISO and MOSI pins with a wire to provide a basic loopback
test for receive data.
.. zephyr-app-commands::
:zephyr-app: samples/drivers/spi_bitbang
:board: nrf52840dk/nrf52840
:goals: build flash
:compact:
Sample Output
=============
.. code-block:: console
*** Booting Zephyr OS build zephyr-v2.6.0-2939-g1882b95b42e2 ***
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
Part 3
한국어 전문 번역
개요
이 sample은 bitbang SPI driver의 사용법을 보여줍니다. Bitbang driver는 8의 배수가 아닌 word size를 사용하는 device에 유용합니다. 예를 들어 일부 LCD에는 별도의 command/data bit가 하나 더 있습니다.
Sample은 여러 SPI transfer 설정을 차례대로 반복 시험합니다.
Build와 실행
Application은 devicetree에 zephyr,spi-bitbang compatible entry가 있는 target에서만 build됩니다.
MISO와 MOSI pin을 wire로 연결하면 수신 data를 확인하는 기본 loopback test를 구성할 수 있습니다.
west build -b nrf52840dk/nrf52840 samples/drivers/spi_bitbang
west flash
Sample 출력
*** Booting Zephyr OS build zephyr-v2.6.0-2939-g1882b95b42e2 ***
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
basic_write_9bit_words; ret: 0
wrote 0101 00ff 00a5 0000 0102
9bit_loopback_partial; ret: 0
tx (i) : 0101 0102
tx (ii) : 0003 0004 0105
rx (ii) : 0003 0004 0105
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.