좀더 간결하게 만들수 없을까?




2017년 초에 만들었던 원형 PCB형태는 겨우 2개의 카메라를 콘트롤 하는것에 비해 크기가 너무커서 좀 더 작게 만들어 보기로 했습니다.

( http://raspberrypicamera.tistory.com/59 )


경험없이 급하게 만들다 보니, SD 카드 소켓도 거꾸로 달고... 

HDMI도 오배선 나고... 여러가지 문제가 많기도 했습니다. 


무엇보다 무선 lan은 속도가 느리고, 유선 lan으로 network 연결하면 선도 복잡해지고 지저분해지는 어려움이 있어서 기왕 시작한거 한번더 만들기로 했습니다.


기존 보드는 raspberry pi 3의 형태로 dual 카메라를 제작했다면, 이번에는 CM3 모듈(SD 카드 소켓 없는 모델)을 활용하였습니다.

https://www.raspberrypi.org/products/compute-module-3/ )


속도는 느려지겠지만 emmc 대신에 메모리 확장이 쉽게 될 수 있도록 하기 위함입니다.(아무래도 사진과 동영상을 많이 촬영하려면 용량이 커야 하기도 하구요)


동시에 여러 카메라를 콘트롤하기 위해서 network 연결이 될 수 있도록 허브칩을 활용해서 간결하게 구성했습니다.( 4채널 허브칩이므로 최대 카메라 8개까지 구성이 가능하지만 파워 문제도 있고 해서 일단 6개 카메라만- CM 보드 3개 - 장착.)



각설하고...

 

기존원형 PCB와는 다르게 외부 연결선은 파워 USB(마이크로) 외에는 없습니다. 



 빨리 조립해 보고 싶어서 3D 프린터로 간단하게 케이스를 만들다 보니, 깜박하고 충전 배터리 장착할 부분을 못 넣었지만 그냥저냥 평가용으로 사용은 가능합니다.




외부 모니터(HDMI, 또는 터치 LCD) 대신에 스마트폰을 활용하기로 했습니다.

무선으로 연결해야 이동도 편하고, 휴대가 쉽기 때문이기도 하구요

(속도 문제는 5G wifi로 해결 했습니다. 중국산이지만 매우 매우 저렴합니다.)




흠... 이정도면 뭐.....



손에 딱 들어 오는 크기라 맘에 들기는 했지만, 여전히 오배선 문제와 각종 F/w를 구동시키는 문제가 산넘어 산이였습니다. (물론 아직도 하고 있지만요..)



시간이 되면 

그동안 겪었던 S/W 설치와 나름 개발했던 F/w관련 이야기를 정리해 보겠습니다.

Posted by 이미지쿡

기존에 제작했던 매트릭스 카메라는 6개의 카메라를 동시에 콘트롤 하는 방식이 아니라 순차적으로 촬영하는 방식입니다.

(http://raspberrypicamera.tistory.com/44?category=720509) - Multi Camera Adapter Module for Raspberry Pi


장점으로는 비용이 적게 들고 고정된 물체를 촬영하는데는 적합합니다만 단점은 움직이는 물체가 있을 경우 매트릭스 카메라로서 역할을 다하지 못합니다. ㅠㅜ


하여 2개 카메라를 동시에 콘트롤 할 수 있도록 듀얼 카메라 촬영이 가능한 raspberry pi3 보드를 새롭게 제작하고.. 





이것을 다시 적층해서 2개 보드로 카메라 4개를 동시에 콘트롤 할 수 있게 배치했습니다. 




아래쪽에는 고용량 배터리를 장착해서 이동중 촬영이 가능하도록 구성했습니다.(https://www.aliexpress.com/item/Tablet-pc-3-7V-5400mAH-polymer-lithium-ion-battery-Li-ion-battery-for-tablet-pc-7/1695916257.html?spm=a2g0s.9042311.0.0.cEcbJ3)



4개가 잘 동작하는 것을 확인했으니... 이제 보드 한장 더 올리면 6개까지 동시 촬영이 가능하고, 계속해서 확장할 수 있다는 기대감에 기뻤습니다....


한층더 올려 볼까요?

6개까지 설치했습니다.. ^^


계속 올려서 12개까지 올릴수 있도록 거치대도 만들고..




좌우 상하로 움직일 수 있도록 고프로 카메라 관절(!)도 부착했습니다.




Posted by 이미지쿡

Raspberry Pi3 wifi & Bluetooth

combo chip 분석



Pi3에 부착된 BCM43438에 대한 H/W(PCB연결) 분석 해봤습니다.

관련회로도나 pin layout을 찾지 못해서 기존에 분석했던것 처럼, detaching후 연결도를 먼저 확인했습니다.

 


 

BCM43438이라는 정보만으로는 자료를 찾아봐도 어떤 part를 사용했는지 정확하게 알수 없습니다. 다행히 구글 진을 찾아 보니, BCM43438KUBG라고 나옵니다. 물론 이것만 가지고 추가로 글링해서 찾아 봤지만 상세한 정보를 얻지 못했습니다.(회로도, pin layout등...)

 

 


 

노력끝에 Broadcom 커뮤니티에서 찾기는 했는데, 최근에 다시 들어가서 찾아보니 자료가 나오지 않습니다. 아마도 삭제한것 같기도합니다. 2016년 6월에 받아 놓은 자료를 올려 놓겠습니다.

 

(Data sheet)4343W.pdf

(Ref_Design)BCM94343WWCD1_1_Rev04.pdf

BCM94343WWCD1_1_Rev04.DSN

 

관련회로도는 위의 BCM94343WWCD1_1_Rev04.pdf를 열어보면
BCM94343WWCD1_1은 BCM4343W WLBGA + STM32F411로 구성되어 있는 DevKit인듯합니다. STM32F411은 관심 밖이므로 제외하고, BCM4343W WLBGA와  BCM43438KUBG 차이점을 알아야 하는데,  우선 wifi combo chip을 제거후 PCB 상의 Ball 배치도와 BCM4343W WLBGA data sheet상 Mechanical information을 비교해 봤습니다.

 

 

 좌측이 PCB상의 ball 배치이고 우측이 BCM4343W WLBGA 의 Ball 배치인데 74 ball로  BCM43438KUBG 보다 많다는 것을 알 수 있습니다. (붉은색 화살표) 그외에 핀들은 배치가 동일한 것으로 보아서 BCM43438KUBGBCM4343W WLBGA 의 Lite 버전임을 예측할 수 있습니다. 실제로 그런지 추가 조사를 해봤습니다.

 

1) 정상 보드에서 GPIO 값을 읽어보면 wifi와 연결된 부분은 아래와 같이 확인됩니다.

 

BANK1 (GPIO 28 to 45):
  GPIO 28: level=0 fsel=6 alt=2 func=PCM_CLK
  GPIO 29: level=1 fsel=6 alt=2 func=PCM_FS
  GPIO 30: level=0 fsel=6 alt=2 func=PCM_DIN
  GPIO 31: level=0 fsel=6 alt=2 func=PCM_DOUT
  GPIO 32: level=1 fsel=7 alt=3 func=TXD0
  GPIO 33: level=1 fsel=7 alt=3 func=RXD0
  GPIO 34: level=0 fsel=7 alt=3 func=SD1_CLK
  GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD
  GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0
  GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1
  GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2
  GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3


 

2 ) 다음으로 위의 GPIO 번호별로 PCB 상태의 ball 위치와 연결된 부분을 확인해봅니다.

 

 

3 ) 이것을 다시 BCM4343W WLBGA의 Data sheet상에 있는ball map과 비교하면 일치 여부를 알 수 있습니다. 확인 결과 동일했습니다.

 

 

(Ref_Design)BCM94343WWCD1_1_Rev04.pdf의 Schematic 참조하여 정리해 보면 다음과 같습니다.

 

 

관련 사이트에서 제공된 아래 BOM을 참고하고 위의 회로도와 연계해서 정리하면 아래 사진과 같습니다. (detaching 전/후 비교) 

(BOM)100-129295-0010_Rev04.xls

 

 

 

 

손품을 좀 팔기는 했지만, Raspberry Pi3의 Wifi & Bluetooth combo chip이 어떻게 연결되었는지는 확인이 되었습니다.

 

이칩을 알리 익스프레서에서 구매해서 조립해 보았는데(개당 5달러 구입) 동작하지 않았습니다. chip이 문제일 수도 있으나, 30여개중에서 하나도 동작하지 않는 것으로 봐서는 다른 문제가 있는듯합니다.

 

구매해서 동작시키는 일은 하지 마시기 바랍니다. 돈,시간,건강에 아주 않좋은 영향을 미칩니다. ㅠ.ㅜ

 

 

 

 



Posted by 이미지쿡

DEVICE TREES, OVERLAYS AND PARAMETERS


오번역이 있을수 있습니다.

잘못된 곳을 알려주시면 수정하도록 하겠습니다. ^^


Raspberry Pi's latest kernels and firmware, including Raspbian and NOOBS releases, now by default use Device Tree (DT) to manage some resource allocation and module loading. This change is to alleviate the problem of multiple drivers contending for system resources, and to allow HAT modules to be auto-configured.

라즈베리안과 NOOBS릴리즈를 포함하여 라즈베리파이의 최신 커널과 펌웨어는 기본적으로 특정한 리소스 할당과 모듈 로딩을 관리하기 위한 디바이스 트리(DT)를 기본적으로 사용한다. 이러한 변화는 시스템 리소스에 대해 경합하는 여러 드라이버의 문제를 해소하고 HAT 모듈을 자동으로 구성 할 수 있도록 한다.

The current implementation is not a pure Device Tree system - there is still board support code that creates some platform devices - but the external interfaces (I2C, I2S, SPI), and the audio devices that use them, must now be instantiated using a Device Tree Blob (DTB) passed to the kernel by the loader (start.elf).

현재 구현은 순수 디바이스 트리 시스템이 아니고 어떤 플렛폼 디바이스를 만드는 보드 지원 코드이다. 외부 인터페이스(I2C,I2C,SPI)와 그것을 사용하는 오디오 디바이스는 로더(start.elf)에 의해 커널로 연결되는 Device Tree Blob(DTB)를 이용해서 인스턴스화 해야 한다.

The main impact of using Device Tree is to change from everything on, relying on module blacklisting to manage contention, to everything off unless requested by the DTB. In order to continue to use external interfaces and the peripherals that attach to them, you will need to add some new settings to your config.txt. See Part 3 for more information, but in the meantime here are a few examples:

디바이스 트리를 사용하는 주요 효과는 경합을 관리하기 위한 모듈 블렉리스팅에 의존 하는 모든 것을 실행하는 것으로부터 DTB에 의해 요청하지 않는 경우, 해제하는 것 까지 변경하는 것이다. 외부 인터페이스와 그들에 연결되어 있는 주변장치를 사용하는 것을 계속하기 위해서는 새로운 설정을 config.txt.에 추가해야 한다. 추가적인 정보를 위해서는 Part 3 를 참고하라, 그러나 여기서는 약간의 예를 제시한다.

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
 
# Uncomment one of these lines to enable an audio interface
#dtoverlay=hifiberry-amp
#dtoverlay=hifiberry-dac
#dtoverlay=hifiberry-dacplus
#dtoverlay=hifiberry-digi
#dtoverlay=iqaudio-dac
#dtoverlay=iqaudio-dacplus
 
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
 
# Uncomment this to override the defaults for the lirc-rpi module
#dtparam=gpio_out_pin=16
#dtparam=gpio_in_pin=17
#dtparam=gpio_in_pull=down

PART 1: DEVICE TREES

A Device Tree (DT) is a description of the hardware in a system. It should include the name of the base CPU, its memory configuration, and any peripherals (internal and external). A DT should not be used to describe the software, although by listing the hardware modules it does usually cause driver modules to be loaded. It helps to remember that DTs are supposed to be OS-neutral, so anything which is Linux-specific probably shouldn't be there.

디바이스 트리(DT)는 시스템의 하드웨어에 대한 설명이다. 베이스 CPU의 이름, 메모리 환경설정, 그리고 주변장치(내부와 외부)을 포함한다. DT는 하드웨어 모듈 목록에 의해 드라이버 모듈을 로딩되도록 하지만 소프트웨어를 설명하는 것으로 사용되어져서는 안된다. 그것은 DT들이 OS중립적이라는 것을 기억하는 데 도움이되며, 그래서 어떤 것은 리눅스 규격에는 없다.

A Device Tree represents the hardware configuration as a hierarchy of nodes. Each node may contain properties and sub nodes. Properties are named arrays of bytes, which may contain strings, numbers (big-endian), arbitrary sequences of bytes, and any combination thereof. By analogy with a filesystem, nodes are directories and properties are files. The locations of nodes and properties within the tree can be described using a path, with slashes as separators and a single slash (/) to indicate the root.

디바이스 트리는 노드의 계층으로서 하드웨어 구성을 나타낸다. 각 노드는 속성들과 서브 노드들을 담고 있다. 속성들은 문자열, 숫자들(빅인디언), 임의의 바이트 시퀀스,등 특정 조합으로 되어 있다. 파일 시스템과 유사하여 노드들은 디렉토리이고 속성들은 파일들이다.  트리내의 노드들의 위치와 속성은 분리 기호이고 루트를 표시하기 위한 싱글 슬래시 (/)  페스를 이용해서 설명된다.

 

1.1: BASIC DTS SYNTAX (기본 DTS 구문)

[ This section borrows heavily from the elinux wiki ]

Device Trees are usually written in a textual form known as Device Tree Source (DTS) and stored in files with a .dts suffix. DTS syntax is C-like, with braces for grouping and semicolons at the end of each line. Note that DTS requires semicolons after closing braces - think of C structs rather than functions. The compiled binary format is referred to as Flattened Device Tree (FDT) or Device Tree Blob (DTB), and is stored in .dtb files.

디바이스 트리는 보통 Device Tree Source (DTS)로 알려진 텍스트 형태로 쓰여지고, .dts 확장자를 갖는 파일로 저장된다. DTS 구문은 그룹핑을 위한 괄호와 각 라인의 끝에 세미콜론을 갖는 C언어 형태이다. DTS는 괄호를 닫은 후에 세미콜론이 요구된다(C의 함수보다는 구조체로 생각하면 된다.) 컴파일된 바이너리 형식은 Flattened Device Tree (FDT) 또는 Device Tree Blob (DTB)를 참조하면된다. 그리고 .dtb  파일로 저장된다.

The following is a simple tree in the .dts format:

 

 

 

 

 

 

/dts-v1/;
/include/ "common.dtsi";
 
/ {
    node1 {
        a-string-property = "A string";
        a-string-list-property = "first string", "second string";
        a-byte-data-property = [0x01 0x23 0x34 0x56];
        cousin: child-node1 {
            first-child-property;
            second-child-property = <1>;
            a-string-property = "Hello, world";
        };
        child-node2 {
        };
    };
    node2 {
        an-empty-property;
        a-cell-property = <1 2 3 4>; /* each number (cell) is a uint32 */
        child-node1 {
            my-cousin = <&cousin>;
        };
    };
};
 
/node2 {
    another-property-for-node2;
};

This tree contains:

·         a required header -- /dts-v1/.

·         The inclusion of another DTS file, conventionally named *.dtsi and analogous to a .h header file in C - see An aside about /include/ below.

·         a single root node: /

·         a couple of child nodes: node1 and node2

·         some children for node1: child-node1 and child-node2

·         a label (cousin) and a reference to that label (&cousin) - see Labels and References below.

·         several properties scattered through the tree

·         a repeated node (/node2) - see An aside about /include/ below.

Properties are simple key-value pairs where the value can either be empty or contain an arbitrary byte stream. While data types are not encoded in the data structure, there are a few fundamental data representations that can be expressed in a Device Tree source file.

속성들은 값이 비어 있거나 임의의 바이트 스트림을 포함하는 간단한 키값쌍이다 . 데이터 유형은 테이터 구조로 부호화 되지 않지만 디바이스 트리 파일내에 표현할 수 있는 몇 가지 기본 데이터 표현있다.

 

Text strings (NUL-terminated) are indicated with double quotes:           텍스트 문자열은(NUL-종료된) 따옴표로 표시된다.

string-property = "a string";

'Cells' are 32-bit unsigned integers delimited by angle brackets:                셀은 32-bit unsigned integers를 꺽쇠괄호로 구분된다.

cell-property = <0xbeef 123 0xabcd1234>;

Arbitrary byte data is delimited with square brackets, and entered in hex:         임의의 바이트 데이터는 대괄호로 구분되고, 16진수로 입력된다.

binary-property = [01 23 45 67 89 ab cd ef];

Data of differing representations can be concatenated together using a comma: 서로 다른 데이터의 표현은 콤마를 이용해서 함께 연결될 수 있다.

mixed-property = "a string", [01 23 45 67], <0x12345678>;

Commas are also used to create lists of strings: 콤마는 문자열 목록을 만들기 위해 사용될 수 있다.

string-list = "red fish", "blue fish";

1.2: AN ASIDE ABOUT /INCLUDE/

The /include/ directive results in simple textual inclusion, much like C's#include directive, but a feature of the Device Tree compiler leads to different usage patterns. Given that nodes are named, potentially with absolute paths, it is possible for the same node to appear twice in a DTS file (and its inclusions). When this happens, the nodes and properties are combined, interleaving and overwriting properties as required - later values override earlier ones.

간단한 텍스트 포함하는 /include/ 지시문 결과는 C언어의 #include 지시문과 같다. 그러나 디바이스 트리 컴파일러의 기능은 다른 사용 패턴으로 연결된다. 노드가 잠재적으로 절대 경로와 이름을 지정하는 점을 감안, 동일한 노드가 DTS파일에 두 번 표시 할 수 있다.(그리고 그것의 inclusions) 이것이 나타났을 때, 노드와 속성은 결합되고 요구되는 속성들을 끼워넣고 덮어쓰기 한다. – 최신 값들이 기존 것을 덮어 씌운다.

In the example above, the second appearance of /node2 causes a new property to be added to the original:

위의 예제에서,  /node2 의 두번째 출현은 오리지널에 추가될 새로운 속성이 된다.

/node2 {
    an-empty-property;
    a-cell-property = <1 2 3 4>; /* each number (cell) is a uint32 */
    another-property-for-node2;
    child-node1 {
        my-cousin = <&cousin>;
    };
};

It is thus possible for one .dtsi to overwrite, or provide defaults for, multiple places in a tree.

이것은 .dtsi 를 덮어씌우는 것이 가능하거나 트리의 여러 위치에 기본값을 제공하는 것이 가능하다.

1.3: LABELS AND REFERENCES

It is often necessary for one part of the tree to refer to another, and there are four ways to do this:

트리의 한부분을 서로 참조하는 것이 가끔 필요하고, 4가지 방법이 있다.

1.    Path strings ( 경로 문자열 )

Paths should be self-explanatory, by analogy with a filesystem -/soc/i2s@7e203000 is the full path to the I2S device in BCM2835 and BCM2836. Note that although it is easy to construct a path to a property (for example, /soc/i2s@7e203000/status), the standard APIs don't do that; you first find a node, then choose properties of that node.

경로는 파일시스템 유추에 의해 따로 설명이 필요 없어야 한다. -/soc/i2s@7e203000 BCM2835BCM2836I2S의 전체경로이다. 비록 속성에 대한 경로를 구축하기는 쉽지만(예를 들어 /soc/i2s@7e203000/status) 표준 API는 그렇게 하지 않는다; 먼저 노드를 찾고, 다음에 그 노드의 속성을 선택한다.

2.    Phandles(??)

A phandle is a unique 32-bit integer assigned to a node in its phandleproperty. For historical reasons, you may also see a redundant, matchinglinux,phandle. phandles are numbered sequentially, starting from 1; 0 is not a valid phandle. They are usually allocated by the DT compiler when it encounters a reference to a node in an integer context, usually in the form of a label (see below). References to nodes using phandles are simply encoded as the corresponding integer (cell) values; there is no markup to indicate that they should be interpreted as phandles, as that is application defined.

Phandle phandle 속성 노드에 할당된 고유의 32-bit 정수이다. 역사적 이유로, 중복해서 볼 수 있으며 linux,phandle에 연결된다.?? Phandle는 순차적으로 1부터 넘버링되며, ;0으로 시작은 유효하지 않는다. DT 컴파일러가 정수 문맥의 노드를 참조할 때, DT 콘트롤러에 의해 일반적으로 할당되며 보통 라벨의 형식이 된다. Phandles를 이용하여 노드를 참조하는 것은 정수값으로 간단히 부호화된다. 즉 어플리케이션 정의 이기 때문에 phandles로 해석되어야 하는 것을 나타 내기 위해 어떤 표시하는 것이 없다.

3.    Labels

Just as a label in C gives a name to a place in the code, a DT label assigns a name to a node in the hierarchy. The compiler takes references to labels and converts them into paths when used in string context (&node) and phandles in integer context (<&node>); the original labels do not appear in the compiled output. Note that labels contain no structure; they are just tokens in a flat, global namespace.

C에서 레이블이 단지 코드에 위치의 이름을 주는 것 처럼, DT 레이블은 계층내 노드에 이름을 할당한다. 컴파일러는 레이블을 참조 받고, 정수 문맥(<&node>)Phandle과 문자열 문맥(&node) 이 사용될 때 그들을 경로로 변환한다.: 원래 레이블은 컴파일 된 출력에 표시되지 않는다.

(참고) 레이블들은 구조체를 담고있지 않으며 그들은 단지 flat(실수형 data?), 글로벌 네임스페이스(전역명칭)로 변환한다.

4.    Aliases

Aliases are similar to labels, except that they do appear in the FDT output as a form of index. They are stored as properties of the /aliases node, with each property mapping an alias name to a path string. Although the aliases node appears in the source, the path strings usually appear as references to labels (&node), rather then being written out in full. DT APIs that resolve a path string to a node typically look at the first character of the path, treating paths that do not start with a slash as aliases that must first be converted to a path using the /aliases table.

인덱스의 형태와 같은 FDT 출력으로 나타는 것을 제외하고는 별칭은 레이블과 비슷하다. 별칭 이름과 경로 문자열의 각 속성 맵핑을 갖는 /aliases 노드의 속성으로 저장된다. 비록 별칭 노드가 소스에서 나타나지만 경로 문자열은 전체 기록보다는 보통 레이블 (&node) 참조한다. 일반적으로 경로의 첫 문자를 보는 노드에서 문자열을 해석하는 DT API/aliases 테이블을 이용하는 첫번째로 경로를 변환되어야 하는 별칭은 슬레시부터 시작하지 않고 경로를 처리한다.

 

 

1.4: DEVICE TREE SEMANTICS (디바이스 트리 의미)

How to construct a Device Tree, and how best to use it to capture the configuration of some hardware, is a large and complex subject. There are many resources available, some of which are listed below, but several points deserve mentioning in this document:

디바이스 트리를 어떻게 설정하고, 어떤 하드웨어의 구성을 캡쳐하는데 그것을  최고로 잘 이용하는 것은 규모가 크고 복잡한 주제이다. 많은 가능한 리소스가 있고 아래 열거된 것중에 몇가지 포인트는 문서내에 언급되는 될것이다.

compatible properties are the link between the hardware description and the driver software. When an OS encounters a node with a compatible property, it looks it up in its database of device drivers to find the best match. In Linux, this usually results in the driver module being automatically loaded, provided it has been appropriately labelled and not blacklisted.

Compatible(호환) 속성들은 하드웨어 설명과 드라이버 소프트웨어 사이를 연결한다. 호환 속성을 갖는 노들을 OS가 만나면, 최상의 매치를 찾기 위해 장치 드라이버의 데이터 베이스에서 찾아 본다. 리눅스에서, 이것은 자동으로 로드되는 디라이버 모듈의 일반적인 결과이며, 블렉리스트되지 않고 적절히 레이블 되는 것을 제공한다.

The status property indicates whether a device is enabled or disabled. If the status is ok, okay or absent, then the device is enabled. Otherwise,status should be disabled, so the device will be disabled. It can be useful to place devices in a .dtsi file with the status set to disabled. A derived configuration can then include that .dtsi and set the status for the devices which are needed to okay.

 status 속성은 디바이스의 사용 여부를 나타낸다. 만약  status ok, okay  또는 absent라면 장치는 사용된다. 그렇지않다면, ,status disabled, 되어져야 한다. 장치를 해제하기 위해서는, disabled.로 셋팅된 상태를 갖는 .dtsi 파일에 디바이스(장치)를 배치하는 것이 유용할 수 있다. 유도(파생)된 구성은 .dtsi okay로 장치 상태를 셋팅하는 것을 포함할 수 있다.

Here are some articles about writing Device Trees: (여기 DT 기록에 대한 몇 개의 기사물이 있다.)

PART 2: DEVICE TREE OVERLAYS (디바이스 트리 덮어 씌우기)

A modern SoC (System-on-Chip) is a very complicated device; a complete Device Tree could be hundreds of lines long. Taking that one step further and placing the SoC on a board with other components only makes matters worse. To keep that manageable, particularly if there are related devices that share components, it makes sense to put the common elements in .dtsi files, to be included from possibly multiple .dts files.

최근의 SOC는 매우 복잡한 장치이다. 복잡한 디바이스 트리는 수백 라인이 길이이다. 한단계 더 나아가 다른 구성 요소를 갖는 보드의 SoC를 배치하는 것은 상황을 악화시킨다. 구성 요소를 공유하는 장치가 연계되어 있다면, 일반적으로 .dtsi 파일에 공통 요소를 넣어둘 필요가 있으며, 여러 .dts 파일로부터 포함되도록 할 필요가 있다.

But when a system like Raspberry Pi supports optional plug-in accessories, such as HATs, the problem grows further. Ultimately, each possible configuration requires a Device Tree to describe it, but once you factor in different base hardware (models A, B, A+, and B+) and gadgets only requiring the use of a few GPIO pins that can coexist, the number of combinations starts to multiply rapidly.

그러나 라즈베리파이와 같은 시스템이 HATs와 같은 선택적 플러그인 액세서리를 지원할때는 문제는 더 증가한다. 근본적으로 각각 가능한 구성은 그것을 설명하기 위한 디바이스 트리를 요구한다. 그러나 서로 다른 기본 하드웨어( A,B,A+,B+)와 공존할 수 있는 소수의 GPIO를 사용하는 장치를 고려하면 조합의 수는 급속히 증가한다.

What is needed is a way to describe these optional components using a partial Device Tree, and then to be able to build a complete tree by taking a base DT and adding a number of optional elements. Well, you can, and these optional elements are called "overlays".

부분적인 디바이스 트리를 이용하여 이러한 임의의 구성 요소들을 설명하기 위한 방법이 필요하고, 그리고 나서 임의의 구성 요소와 베이스 DT를 갖는 전체 트리를 구축 할 수 있도록 하기 위함이다. , 이러한 선택적 요소들은 오버레이라고 할 수 있다.

2.1: FRAGMENTS (조각?)

A DT overlay comprises a number of fragments, each of which targets one node and its subnodes. Although the concept sounds simple enough, the syntax seems rather strange at first:

DT 오버레이는 어떤 노드와 하위노드를 대상으로 하는 각각의, 많은 단편들을 포함한다. 개념은 간단하게 들릴지 모르겠지만, 처음에는 구문이 이상해 보인다.

// Enable the i2s interface
/dts-v1/;
/plugin/;
 
/ {
    compatible = "brcm,bcm2708";
 
    fragment@0 {
        target = <&i2s>;
        __overlay__ {
            status = "okay";
        };
    };
};

The compatible string identifies this as being for BCM2708, which is the base architecture of the BCM2835 part. For the BCM2836 part you could use a compatible string of "brcm,bcm2709", but unless you are targeting features of the ARM CPUs then the two architectures ought to be equivalent, so sticking to "brcm,bcm2708" is reasonable. Then comes the first (and in this case only) fragment. Fragments are numbered sequentially from zero. Failure to adhere to this may cause some or all of your fragments to be missed.

 compatible 문자열은 BCM2835 파트의 기본 아키텍쳐인 BCM2708을 정의한다. BCM2836의 경우 “BRCM, bcm2709”의 호환되는 문자열을 사용할 수 있지만, 두 아키텍처가 같아야 하는 ARM CPU의 기능을 타겟으로 하지 않는다면, “brcm, bcm2708”이 합리적이다 다음으로 오는 것이 fragment이다. Fragment0부터 순차적으로 번호가 붙여진다. 이것을 준수 하지않으면 당신의 fragment의 전부를 놓칠 수 있는 원인이 된다.

 

Each fragment consists of two parts: a target property, identifying the node to apply the overlay to; and the __overlay__ itself, the body of which is added to the target node. The example above can be interpreted as if it were written like this:

fragment는 두 개의 부분으로 구성된다. : 오버레이에 적용하기 위한 노드를 식별하는 target 속성은   __overlay__ 자체로, 대상 노드에 추가되는 바디에 노드를 식별한다. 위의 예제에서 기록된 것 처럼 해석될 수 있다.

/dts-v1/;
 
/ {
    compatible = "brcm,bcm2708";
};
 
&i2s {
    status = "okay";
};

The effect of merging that overlay with a standard Raspberry Pi base Device Tree (bcm2708-rpi-b-plus.dtb, for example), provided the overlay is loaded afterwards, would be to enable the I2S interface by changing its status to okay. But if you try to compile this overlay, using:

표준 라즈베리파이 기본 장치 트리( 예를 들어 bcm2708-rpi-b-plus.dtb)와 오버레이 병합 효과는, 오버레이가 나중에 로드되는 것이 제공되며,  statusokay 로 변경하여 I2C 인터페이스를 활성화 하는 것이다. 그러나 만약 당신이 이 오버레이를 아래와 같이 컴파일 한다면

dtc -I dts -O dtb -o 2nd.dtbo 2nd-overlay.dts

you will get an error: 에러가 발생할 것이다.

Label or path i2s not found  (레이블 또는 경로 i2s 찾을  없다.)

This shouldn't be too unexpected, since there is no reference to the base .dtb or.dts file to allow the compiler to find the i2s label.

Trying again, this time using the original example and adding the -@ option to allow unresolved references:

이것은 역시 예상치 못했던 것으로, 컴파일러는 i2s 레이블를 찾을 수 있도록 베이스  .dtb 또는 .dts 파일에 대한 참조가 없기 때문입니다. 이번에는 위의 예제에 해결되지 않은 참조들을 허가하기 위한 -@ 옵션을 추가해 보자

dtc -@ -I dts -O dtb -o 1st.dtbo 1st-overlay.dts

If dtc returns an error about the third line then it doesn't have the extensions required for overlay work. Run sudo apt-get install device-tree-compilerand try again - this time, compilation should complete successfully. Note that a suitable compiler is also available in the kernel tree as scripts/dtc/dtc, built when the dtbs make target is used:

만약  dtc 가 셋째줄에 대한 오류를 리턴 한다면 오버레이 작업을 위한 요구되는 확장자를 가지고 있지 않다는 것이다. sudo apt-get install device-tree-compiler를 설치하고 다시 시도해라. 이번에는 컴파일을 성공적으로 완료해야 한다.

(참고) 적합한 컴파일러는 dtbs make target이 이용될 때 만들어진 scripts/dtc/dtc의 커널 트리에서 역시 가능하다.

make ARCH=arm dtbs

It is interesting to dump the contents of the DTB file to see what the compiler has generated: 컴파일러가 생성한 것을 보기 위해 DTB 파일의 내용을 덤프해 보면 재밌다.

$ fdtdump 1st.dtbo
 
/dts-v1/;
// magic:           0xd00dfeed
// totalsize:       0x106 (262)
// off_dt_struct:   0x38
// off_dt_strings:  0xe8
// off_mem_rsvmap:  0x28
// version:         17
// last_comp_version:    16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0x1e
// size_dt_struct:  0xb0
 
/ {
    compatible = "brcm,bcm2708";
    fragment@0 {
        target = <0xdeadbeef>;
        __overlay__ {
            status = "okay";
        };
    };
    __fixups__ {
        i2s = "/fragment@0:target:0";
    };
};

After the verbose description of the file structure, there is our fragment. But look carefully - where we wrote &i2s it now says 0xdeadbeef, a clue that something strange has happened. After the fragment is a new node, __fixups__. This contains a list of properties mapping the names of unresolved symbols to lists of paths to cells within the fragments that need patching with the phandle of the target node, once that target has been located. In this case, the path is to the0xdeadbeef value of target, but fragments can contain other unresolved references which would require additional fixes.

파일 구조의 상세한 설명 후에, 우리의 fragment가 있다. 그러나 주의 깊게 봐야 한다. 우리 기록했던 &i2s  0xdeadbeef로 표현되어 있어, 무언가 이상한 일이 발생했다는 단서이다. Fragment는 새로운 노드 , __fixups__ 에 있다. 이것은 타깃 노드의 phandle를 갖는 패칭을 필요로 하는 fragments내의 셀의 경로 에 해석되지 않은 심볼의 이름들의 속성 맵핑의 리스트를 담고 있다. 이러한 경우, target0xdeadbeef 값이 경로이지만, fragments는 추가 수정이 요구되는 또다른 해석되지 않은 레퍼런스를 포함할 수 있다.

If you write more complicated fragments, the compiler may generate two more nodes: __local_fixups__ and __symbols__. The former is required if any node in the fragments has a phandle, because the programme performing the merge will have to ensure that phandle numbers are sequential and unique, but the latter is the key to how unresolved symbols are dealt with.

Back in section 1.3 it says that "the original labels do not appear in the compiled output", but this isn't true when using the -@ switch. Instead, every label results in a property in the __symbols__ node, mapping a label to a path, exactly like thealiases node. In fact, the mechanism is so similar that when resolving symbols, the Raspberry Pi loader will search the "aliases" node in the absence of a__symbols__ node. This is useful because by providing sufficient aliases, we can allow an older dtc to be used to build the base DTB files.

만약, 더 복잡한 fragments를 작성한다면, 컴파일러는 __local_fixups__ __symbols__ 인 두개 이상의 노드를 만들것이다. 만약 fragments의 어떤 노드가 phandle을 가지고 있다면 전자가 요구될 것이다. 병합을 수행하는 프로그램은 순차적이고 유일한 phandle 번호를 반드시 보장해야 하기 때문이며, 후자는 해석되지 않은 심볼을 어떻게 다루어야 하는지 열쇠가 된다 섹션 1.3으로 돌아가서, “컴파일된 결과에 오리지널 레이블은 나타나지 않는다” “그러나  -@ 스위치를 사용했을 때는 사실이 아니다.” 대신,  __symbols__ 노드 특성의 모든 레이블 결과들은, 정확하게 aliases  노드 처럼 경로에 레이블을 맵핑한다. 실제로, 메커니즘은 심볼을 해석할때와 유사하며, 라즈베리파이 로더는 __symbols__ 노드의 부재로 aliases 노드를 검색할 것이다.

UPDATE: The Dynamic Device Tree support in the kernel requires a different format of "local fixups" in the overlay. To avoid problems with old and new styles of overlay coexisting, and to match other users of overlays, the old "name-overlay.dtb" naming scheme has been replaced with "name.dtbo" from 4.4 onwards. Overlays should be referred to by name alone, and the firmware or utility that loads them will append the appropriate suffix. For example:

(업데이트) 커널에서 다이나믹 디바이스 트리 지원은 오버레이에서 "local fixups" 의 다른 형식 을 요구한다. 오버레이의 기존과 신규 스타일이 공존하는 문제를 피하고, 오버레이의 다른 사용자들을 연결하기 위해서 기존  "name-overlay.dtb" 이름 지정 방식은 4.4이후로 계속해서 "name.dtbo"으로 변경되었다. 아래 예를 참조하라.

 

dtoverlay=awesome-overlay      # This is wrong
dtoverlay=awesome              # This is correct

2.2: DEVICE TREE PARAMETERS

To avoid the need for lots of Device Tree overlays, and to reduce the need for users of peripherals to modify DTS files, the Raspberry Pi loader supports a new feature - Device Tree parameters. This permits small changes to the DT using named parameters, similar to the way kernel modules receive parameters from modprobe and the kernel command line. Parameters can be exposed by the base DTBs and by overlays, including HAT overlays.

수많은 디바이스 트리 오버레이들이 필요해지는 것을 피하고, 주변장치의 사용자들을 위해 DTS 파일을 수정 하는 요구를 감소시키기 위해, 라즈베리파이 로더는 새로운 기능 디바이스 트리 파라메터를 지원한다. 이름 붙여진 파라메터를 사용하여 DT에 작은 변화를 허용하며, modprobe 과 커널 명령어 라인으로부터 파라메터들을 받는 커널 모듈 방법과 유사하다. 파라메터들은 베이스 DTBs, HAT 오버레이를 포함한 오버레이에 의해 노출 될 수 있다.

Parameters are defined in the DTS by adding an __overrides__ node to the root. It contains properties whose names are the chosen parameter names, and whose values are a sequence comprising a phandle (reference to a label) for the target node, and a string indicating the target property; string, integer (cell) and boolean properties are supported.

파라메터들은 __overrides__ 노드를 루트에 추가함으로서 DTS에 정의되어 진다. 이것은 선택된 파라메터 이름들 속성을 담고, 타깃노드를 위한 phandle(레이블을 참조하라)을 순차적으로 구성하는 값과, 타깃 속성을 인식하는 문자열인 문자열, 정수()과 부울 속성이 지원된다.

 

2.2.1: STRING PARAMETERS

String parameters are declared like this: 문자열 파라메터들은 아래와 같이 선언된다.

name = <&label>,"property";

where label and property are replaced by suitable values. String parameters can cause their target properties to grow, shrink, or be created.

Note that properties called status are treated specially; non-zero/true/yes/on values are converted to the string "okay", while zero/false/no/off becomes"disabled".

여기서 label  property 는 적당한 값으로 변경된다. 문자열 파라메터는 타깃 특성이 성장,축소 또는 생성될수 있다. status 로 불리는 속성은 특별히 non-zero/true/yes/on 값들로 취급되어지며, 이값들은 문자열 "okay"로 변환될 수 있으며 zero/false/no/off"disabled".로 변환 된다.

 

2.2.2: INTEGER PARAMETERS

Integer parameters are declared like this:

name = <&label>,"property.offset"; // 8-bit
name = <&label>,"property;offset"; // 16-bit
name = <&label>,"property:offset"; // 32-bit
name = <&label>,"property#offset"; // 64-bit

where label, property and offset are replaced by suitable values; the offset is specified in bytes relative to the start of the property (in decimal by default), and the preceding separator dictates the size of the parameter. In a change from earlier implementations, integer parameters may refer to non-existent properties or to offsets beyond the end of an existing property.

여기서, label, property , offset 는 적당한 값에 의해 변경되어 진다. 오프셋은 속성의(기본적으로 십진수임) 시작에 상응하는 바이트들로 정의되며, 선행 분리기호는 매개변수(파라메터)의 크기를 지시한다. 초기 구현으로부터의 변경시, 정수 파라메터는 존재하지 않는 속성을 참조하거나 존재하는 속성의 오프셋의 뒤를 참조할 수 있다.

 

 

 

2.2.3: BOOLEAN PARAMETERS

Device Tree encodes boolean values as zero-length properties; if present then the property is true, otherwise it is false. They are defined like this:

디바이스 트리는 길이가 없는 속성들의 부울값으로 부호화한다.: 만약 현재의 속성이 true 경우, 그렇치않으면 false이다. 그들은 다음과 같이 정의 된다.

boolean_property; // Set 'boolean_property' to true

Note that a property is assigned the value false by not defining it. Boolean parameters are declared like this:

(참고) 속성이 정의되지 않으므로서 false 값으로 할당된다. 부울 파라메터는 다음과 같이 정의 된다.

name = <&label>,"property?";

where label and property are replaced by suitable values. Boolean parameters can cause properties to be created or deleted.

여기서  label  property 는 적절한 값으로 대체된다. 부울 파라메터는 만들거나 삭제하기 위한 속성을 야기할 수 있다.

2.2.4 OVERLAY/FRAGMENT PARAMETERS

The DT parameter mechanism as described has a number of limitations, including the inability to change the name of a node and to write arbitrary values to arbitrary properties when a parameter is used. One way to overcome some of these limitations is to conditionally include or exclude certain fragments.

수많은 제한으로 설명되는 DT 파라메터 원리는, 노드 이름을 변경할 수 없는 것과, 파라메터가 사용될 때, 임의의 속성에 임의의 값들을 기록하는 것을 포함한다. 몇가지 이런 제한을 극복하기 위한 방법은 특정 fragments를 조건부로 포함 또는 제외하는 것이다.

A fragment can be excluded from the final merge process (disabled) by renaming the __overlay__ node to __dormant__. The parameter declaration syntax has been extended to allow the otherwise illegal zero target phandle to indicate that the following string contains operations at fragment or overlay scope. So far, four operations have been implemented:

Fragment__overlay__ 노드를 __dormant__.로 이름을 변경하는 것으로 최종 병합 프로세스(사용안 함) 제외 될 수 있다. 파라메터 선언 구문는 fragment 또는 overlay 범위에서 기능을 담고있는 뒤따르는 문자를 나타내기 위한 규정에 맞지 않는 제로 타깃 phandle을 제외하고는 허용할 수 있도록 확장되었습니다. 지금껏, 4개의 동작이 구현되어 있다.

+<n>    // Enable fragment <n>
-<n>    // Disable fragment <n>
=<n>    // Enable fragment <n> if the assigned parameter value is true, otherwise disable it
!<n>    // Enable fragment <n> if the assigned parameter value is false, otherwise disable it

Examples:

just_one    = <0>,"+1-2"; // Enable 1, disable 2
conditional = <0>,"=3!4"; // Enable 3, disable 4 if value is true,
                          // otherwise disable 3, enable 4.

The i2c-mux overlay uses this technique. i2c-mux 오버레이는 이 기술을 사용한다.

2.2.5 EXAMPLES

Here are some examples of different types of properties, with parameters to modify them: 여기에 수정할수 있는 파라메터를 갖는 속성의 다른 형태의 예제가 몇 개있다.

/ {
    fragment@0 {
        target-path = "/";
        __overlay__ {
 
            test: test_node {
                string = "hello";
                status = "disabled";
                bytes = /bits/ 8 <0x67 0x89>;
                u16s = /bits/ 16 <0xabcd 0xef01>;
                u32s = /bits/ 32 <0xfedcba98 0x76543210>;
                u64s = /bits/ 64 < 0xaaaaa5a55a5a5555 0x0000111122223333>;
                bool1; // Defaults to true
                       // bool2 defaults to false
            };
        };
    };
 
    fragment@1 {
        target-path = "/";
        __overlay__ {
            frag1;
        };
    };
 
    fragment@2 {
        target-path = "/";
        __dormant__ {
            frag2;
        };
    };
 
    __overrides__ {
        string =      <&test>,"string";
        enable =      <&test>,"status";
        byte_0 =      <&test>,"bytes.0";
        byte_1 =      <&test>,"bytes.1";
        u16_0 =       <&test>,"u16s;0";
        u16_1 =       <&test>,"u16s;2";
        u32_0 =       <&test>,"u32s:0";
        u32_1 =       <&test>,"u32s:4";
        u64_0 =       <&test>,"u64s#0";
        u64_1 =       <&test>,"u64s#8";
        bool1 =       <&test>,"bool1?";
        bool2 =       <&test>,"bool2?";
        only1 =       <0>,"+1-2";
        only2 =       <0>,"-1+2";
        toggle1 =     <0>,"=1";
        toggle2 =     <0>,"=2";
        not1 =        <0>,"!1";
        not2 =        <0>,"!2";
    };
};

2.2.6: PARAMETERS WITH MULTIPLE TARGETS

There are some situations where it is convenient to be able to set the same value in multiple locations within the Device Tree. Rather than the ungainly approach of creating multiple parameters, it is possible to add multiple targets to a single parameter by concatenating them, like this:

디바이스 트리내에 여러위치에 같은 값을 입력하는 것이 가능한 편리한 몇가지 상태가 있다. 여러 파라메터를 만드는 어색한 방식보다, 여러 타깃에 그들을 연결하여 하나의 파라메터를 적용하는 것이 가능하다.

    __overrides__ {
        gpiopin = <&w1>,"gpios:4",
                  <&w1_pins>,"brcm,pins:0";
        ...
    };

(example taken from the w1-gpio overlay)

Note that it is even possible to target properties of different types with a single parameter. You could reasonably connect an "enable" parameter to a statusstring, cells containing zero or one, and a proper boolean property.

(참고) 이것은 싱글 파라메터를 갖는 다른 형식의 속성들을 대상으로 하는 것도 가능하다. 0,또는 1을 갖는 셀과 적절한 부울 속성의 status 문자열에 적절하게 "enable" 파라메터를 연결할 수 있다.

2.2.7: FURTHER OVERLAY EXAMPLES (추가적인 오버레이 예제들)

There is a growing collection of overlay source files hosted in the Raspberry Pi/Linux GitHub repository here.

라즈베리파이/리눅스 GitHub 저장소에 오버레이 파일의 수집이 계속되고 있는 호스팅이 here.에 있다.

 

PART 3: USING DEVICE TREES ON RASPBERRY PI

3.1: OVERLAYS AND CONFIG.TXT

On a Raspberry Pi it is the job of the loader (one of the start.elf images) to combine overlays with an appropriate base device tree, and then to pass a fully resolved Device Tree to the kernel. The base Device Trees are located alongside start.elf in the FAT partition (/boot from Linux), named bcm2708-rpi-b.dtb,bcm2708-rpi-b-plus.dtb, bcm2708-rpi-cm.dtb, and bcm2709-rpi-2-b.dtb. Note that Model As and A+s will use the "b" and "b-plus" variants, respectively. This selection is automatic, and allows the same SD card image to be used in a variety of devices.

라즈베리파이에서 로더의 역할은 충분한 베이스 디바이스 트리를 갖는 오버레이들을 조합하는 것이고, 완벽하게 해석된 디바이스 트리를 커널에 연결하기 위함이다. 디바이스 트리는 FAT 파티션(리눅스의 /boot)start.elf 와 같이 위치한다. 이름은 bcm2708-rpi-b.dtb,bcm2708-rpi-b-plus.dtb, bcm2708-rpi-cm.dtb,  bcm2709-rpi-2-b.dtb 이다.

(참고) 모델 A A+, b b+의 각각 변종 모델을 갖는다. 이 선택은 자동으로, 그리고 다양한 디바이스가 사용되는 동일한 SD 카드 이미지를 허용한다.

Note that DT and ATAGs are mutually exclusive. As a result, passing a DT blob to a kernel that doesn't understand it causes a boot failure. To guard against this, the loader checks kernel images for DT-compatibility, which is marked by a trailer added by the mkknlimg utility; this can be found in the scripts directory of a recent kernel source tree. Any kernel without a trailer is assumed to be non-DT-capable.

(참고) DTATAG는 상호 배타적이다. 그 결과로, 이해되지 않는 커널에 DT blob를 연결하는 것은 부트 실패를 야기한다. 이를 방지하기 위해, 로더는 mkknlimg 유틸리티에 의해 예고로 추가되는 것에 의해 표시되는 DT-호환성에 대한 커널 이미지를 확인하다; 이것은 최신 커널 소스 트리의 scripts 디렉토리에서 찾을 수 있다. 트레일러가 없는 특정 커널은 non-DT-capable로 가정한다.

A kernel built from the rpi-4.4.y tree (and later) will not function without a DTB, so from the 4.4 releases onwards, any kernel without a trailer is assumed to be DT-capable. You can override this by adding a trailer without the DTOK flag or by putting device_tree= in config.txt, but don't be surprised if it doesn't work. N.B. A corollary to this is that if the kernel has a trailer indicating DT capability thendevice_tree= will be ignored.

Rpi-4.4y 트리(그리고 후속)으로부터 구축한 커널은 4.4 릴리즈 이후에, DTB 없이 작동하지 않으며 트레일러 없는 특정 커널은 DT-capable로 가정한다. Config.txt device_tree= 에 넣는 것에 의해, 또는 DTOK 플레그 없는 트레일러를 추가하는 것에 의해 이것을 오버라이드 할 수 있다. 하지만, 만약 그것이 동작하지 않더라도 놀라지 마라. (주의)이에 대한 추론은 만약 커널이 DT 능력을 나타내는 트레일러를 가지고 있다면, device_tree= 는 무시될 것이다.

The loader now supports builds using bcm2835_defconfig, which selects the upstreamed BCM2835 support. This configuration will causebcm2835-rpi-b.dtb and bcm2835-rpi-b-plus.dtb to be built. If these files are copied with the kernel, and if the kernel has been tagged by a recent mkknlimg, then the loader will attempt to load one of those DTBs by default.

로더는 상위 BCM2835 지원을 선택하는 bcm2835_defconfig를 이용해서 구축하는 것을 지원한다. 이 구성은 bcm2835-rpi-b.dtb  bcm2835-rpi-b-plus.dtb 가 빌드되게 할 것이다. 만약 이들 파일이 커널에 카피되고, 커널이 최근 mkknlimg에 의해 태그된다면 로더는 기본적으로 이들 DTB중 하나를 로드하는 것을 시도할 것이다.

In order to manage Device Tree and overlays, the loader supports a number of newconfig.txt directives:

디바이스 트리와 오버레이를 관리하기 위해, 로더는 새로운 config.txt 지시들을 지원한다.

dtoverlay=acme-board
dtparam=foo=bar,level=42

This will cause the loader to look for overlays/acme-board.dtbo in the firmware partition, which Raspbian mounts on /boot. It will then search for parameters foo and level, and assign the indicated values to them.

이것은 로더가 Raspbian이 마운트하는  /boot 에 있는 펌웨어 파티션내의 overlays/acme-board.dtbo 를 지켜보는 것을 야기할 것이다. 이것은 파라메터 foo  level 을 검색하고 그것들에 표시된 값을 할당할 것이다.

The loader will also search for an attached HAT with a programmed EEPROM, and load the supporting overlay from there; this happens without any user intervention.

로더는 또한 프로그램된 EEPROM을 갖는 추가된 HAT를 위해 검색할 것이고 거기서 지원하는 오버레이를 로드할 것이다. ; 이것은 사용자의 개입없이 발생한다.

There are several ways to tell that the kernel is using Device Tree: 커널이 디바이스 트리를 사용하고 있다는 것을 이야기하기 위한 몇가지 방법이 있다.

  1. The "Machine model:" kernel message during bootup has a board-specific value such as "Raspberry Pi 2 Model B", rather than "BCM2709".
  2. Some time later, there may also be another kernel message saying "No ATAGs?" -- this is expected.
  3. /proc/device-tree exists, and contains subdirectories and files that exactly mirror the nodes and properties of the DT.

With a Device Tree, the kernel will automatically search for and load modules that support the indicated, enabled devices. As a result, by creating an appropriate DT overlay for a device, you save users of the device from having to edit/etc/modules; all of the configuration goes in config.txt, and in the case of a HAT, even that step is unnecessary. Note, however, that layered modules such asi2c-dev still need to be loaded explicitly.

디바이스 트리가 있다면, 커널은 지정된, 활성화 장치를 지원하는 모듈을 자동으로 찾고 로드할 것이다. 그 결과로, 장치에 대한 적절한 DT 오버레이를 생성하여, /etc/modules 를 수정해야 하는 것으로부터 장치의 사용자들을 저장할 수 있다.; 모든 설정은 불필요한 단계 조차도 config.txt HAT의 안으로 들어 간다.

(참고) 그러나 i2c-dev와 같은 계층 모듈은 아직 분명하게 로드할 필요가 있다.

The flipside is that because platform devices don't get created unless requested by the DTB, it should no longer be necessary to blacklist modules that used to be loaded as a result of platform devices defined in the board support code. In fact, current Raspbian images ship without a blacklist file.

역설적으로 플렛폼 디바이스는 DTB에 의해 요구되지 않는다면 만들어지지 않기 때문에 보드 지원 코드에 정의된 플렛폼 디바이스의 결과로서 로드 되어 사용되는 블랙리스트 모듈이 이 더 이상 필요없을 것이다. 사실, 현재의 라즈베리안 이미지는 블랙리스트 파일 없이 제공된다.

3.2: DT PARAMETERS

As described above, DT parameters are a convenient way to make small changes to a device's configuration. The current base DTBs support parameters for enabling and controlling the onboard audio, I2C, I2S and SPI interfaces without using dedicated overlays. In use, parameters look like this:

위에서 설명된 것 처럼, DT 파라메터는 디바이스의 설정에서 작은 변경을 만드는 편리한 방법이다. 혀재 기본 DTB는 오디오,I2C,I2S 그리고 SPI 인터페이스를 복잡한 오버레이없이 콘드롤하고 설정할 수 있는 파라메터를 지원한다. 사용에 있서, 파라메터는 다음과 같다.

dtparam=audio=on,i2c_arm=on,i2c_arm_baudrate=400000,spi=on

Note that multiple assignments can be placed on the same line, but ensure you don't exceed the 80-character limit.

(참고) 중복할당이 동일한 라인에 놓여질 수 있다. 그러나 80자를 넘서지 않도록 확실 하라.

A future default config.txt may contain a section like this:

향후 기본config.txt 이 다음과 같은 섹션을 포함할 수 있다.

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

If you have an overlay that defines some parameters, they can be specified either on subsequent lines like this:

만약 특정 파라메터들을 정의한 오버레이를 가지고 있다면 그것들은 다음과 같이 정의되어 있을 수 있다.

dtoverlay=lirc-rpi
dtparam=gpio_out_pin=16
dtparam=gpio_in_pin=17
dtparam=gpio_in_pull=down

or appended to the overlay line like this: 또는 오버레이 라인에 다음처럼 추가 될수 있다.

dtoverlay=lirc-rpi:gpio_out_pin=16,gpio_in_pin=17,gpio_in_pull=down

Note here the use of a colon (:) to separate the overlay name from its parameters, which is a supported syntax variant.

여기서 콜론의 사용은 오버레이 이름과 구문 변경이 지원되는 파라메터를 분리하기 위해서 이다.

Overlay parameters are only in scope until the next overlay is loaded. In the event of a parameter with the same name being exported by both the overlay and the base, the parameter in the overlay takes precedence; for clarity, it's recommended that you avoid doing this. To expose the parameter exported by the base DTB instead, end the current overlay scope using:

다음 오버레이가 로드 될때까지 오버레이 파라메터는 범위에 있다. 기본 오버레이와 오버레이 양쪽에 의해 내보내게 되는 같은 이름을 갖는 파라메터의 경우 오버레이안에 파라메터가 분명하게 먼저 갖기 위해서는 이런 일을 피하는 것을 추천한다. 베이스 DTB 대신에 내보내지는 파라메터를 노출하기위해서, 현재의 오버레이 범위를 다음 명령어를 이용해서 끝내라.

dtoverlay=

3.3: BOARD-SPECIFIC LABELS AND PARAMETERS

Raspberry Pi boards have two I2C interfaces. These are nominally split: one for the ARM, and one for VideoCore (the "GPU"). On almost all models, i2c1 belongs to the ARM and i2c0 to VC, where it is used to control the camera and read the HAT EEPROM. However, there are two early revisions of the Model B that have those roles reversed.

라즈베리파이 보드는 2개의 I2C 인터페이스를 갖는다. 이들은 보통 나누어지는데, 하나는 ARM에 대해, 하나는 VideoCore(GPU)을 위해서 이다. 거의 모든 모델에서 i2c1 ARM에 속하고 i2c0 는 카메라 콘트롤과 HAT EEPROM을 읽기위해 사용되는 VC 속한다. 하지만, 두개의 초기 버전인 Medel B는 반대로 되어 있다.

To make it possible to use one set of overlays and parameters with all Pis, the firmware creates some board-specific DT parameters. These are:

모든 라즈베리파이를 갖는 오버레이와 파라메터의 단일 셋을 사용하는 것이 가능하게 만들기 위해서는 펌웨어가 특정 보드-규격 DT 파라메터를 만들어야 한다. 그것들은 다음과 같다.

i2c/i2c_arm
i2c_vc
i2c_baudrate/i2c_arm_baudrate
i2c_vc_baudrate

These are aliases for i2c0, i2c1, i2c0_baudrate, and i2c1_baudrate. It is recommended that you only use i2c_vc and i2c_vc_baudrate if you really need to - for example, if you are programming a HAT EEPROM. Enabling i2c_vccan stop the Pi Camera being detected.

이들 별칭은  i2c0, i2c1, i2c0_baudrate, i2c1_baudrate 이다. 예를 들어 만약 a HAT EEPROM을 프로그래밍한다면 i2c_vc  i2c_vc_baudrate 만을 사용하는 것을 추천한다. i2c_vc을 설정하는 것은 검출된 Pi 카메라를 멈추게 할 수 있다.

For people writing overlays, the same aliasing has been applied to the labels on the I2C DT nodes. Thus, you should write:

오버레이 쓰기 위한 사람을 위해, 동일한 별칭은 I2C DT 노드에 레이블로 적용할 수 있다. 따라서, 다음과 같이 작성해야 한다.

fragment@0 {
    target = <&i2c_arm>;
    __overlay__ {
        status = "okay";
    };
};

Any overlays using the numeric variants will be modified to use the new aliases.

변수를 사용하는 특정 오버레이는 새로운 aliases를 이용하여 수정될 것이다.

3.4: HATS AND DEVICE TREE

A Raspberry Pi HAT is an add-on board for a "Plus"-shaped (A+, B+ or Pi 2 B) Raspberry Pi with an embedded EEPROM. The EEPROM includes any DT overlay required to enable the board, and this overlay can also expose parameters.

라즈베리파이 HAT는 플러서 모양의(A+,B+,Pi2B)  임베디드 EEPROM을 갖는 라즈베리파이를 위한 추가 기능 보드이다. EEPROM은 보드를 작동하기 위해 요구되는 특정 DT 오버레이를 포함하고, 이 오버레이는 역시 파라메터를 노출할 수 있다.

The HAT overlay is automatically loaded by the firmware after the base DTB, so its parameters are accessible until any other overlays are loaded, or until the overlay scope is ended using dtoverlay=. If for some reason you want to suppress the loading of the HAT overlay, put dtoverlay= before any other dtoverlay ordtparam directive.

HAT 오버레이는 베이스 DTB후에 펌웨어에 의해 자동으로 로드 되어 진다. 따라서, 다른 오버레이가 로드되거나 오버레이 범위가 dtoverlay=. 를 이용해서 끝날 때 까지 파라메터는 접근할 수 있다. 만약 어떤 이유로 인해서 HAT 오버레이의 로딩을 억제하기 원한다면, 다른 dtoverlay dtparam 을 지정하기 전에 dtoverlay=을 넣어야 한다.

 

3.5: DYNAMIC DEVICE TREE

As of Linux 4.4, the RPi kernels support the dynamic loading of overlays and parameters. Compatible kernels manage a stack of overlays that are applied on top of the base DTB. Changes are immediately reflected in /proc/device-tree and can cause modules to be loaded and platform devices to be created and destroyed.

리눅스 4.4 RPi 커널은 오버레이 및 파라메터의 동적로드를 지원한다. 호환된는 커널들은 베이스 DTB의 상단에 적용되는 오버레이의 스텍을 관리한다. 변경사항은 즉시 /proc/device-tree와 모듈과 만들어진 플레폼 디바이스에  로드되어지므로 파괴의 원인이 될 수 있다.

The use of the word "stack" above is important - overlays can only be added and removed at the top of the stack; changing something further down the stack requires that anything on top of it must first be removed.

위의 단어 “stack”의 사용은 중요하다. 오버레이들이 스텍의 상단에서 단지 추가되고 제거 될수 있다.; 스택 아래로 뭔가를 더 변경한다면, 스택의 상단의 무엇가는 제거 되는 것이 요구된다.

There are some new commands for managing overlays: 오버레이를 관리하기 위한 몇 가지 새로운 명령이 있다.

3.5.1 THE DTOVERLAY COMMAND

dtoverlay is a command line utility that loads and removes overlays while the system is running, as well as listing the available overlays and displaying their help information:

dtoverlay 는 시스템이 동작하는 동안 오버레이를 제거하거나 로드하기 위한 명령어 라인 유틸리티이다. 뿐만 아니라 가능한 오버레이와 그것들의 도움말 정보를 목록화 한다.

pi@raspberrypi ~ $ dtoverlay -h
Usage:
  dtoverlay <overlay> [<param>=<val>...]
                           Add an overlay (with parameters)
  dtoverlay -r [<overlay>] Remove an overlay (by name, index or the last)
  dtoverlay -R [<overlay>] Remove from an overlay (by name, index or all)
  dtoverlay -l             List active overlays/params
  dtoverlay -a             List all overlays (marking the active)
  dtoverlay -h             Show this usage message
  dtoverlay -h <overlay>   Display help on an overlay
  dtoverlay -h <overlay> <param>..  Or its parameters
    where <overlay> is the name of an overlay or 'dtparam' for dtparams
Options applicable to most variants:
    -d <dir>    Specify an alternate location for the overlays
                (defaults to /boot/overlays or /flash/overlays)
    -n          Dry run - show what would be executed
    -v          Verbose operation

Unlike the config.txt equivalent, all parameters to an overlay must be included in the same command line - the dtparam command is only for parameters of the base DTB.

 config.txt 등가와는 다르게, 오버레이에서 모든 파라메터들은 동일한 명령어 라인을 포함해야 한다. dtparam 명령어는 오직 베이스 DTB의 파라메터를 위한 것이다.

Two points to note: 두가지 유의해야 한다.

1.    Command variants that change kernel state (adding and removing things) require root privilege, so you may need to prefix the command with sudo.

커널 상태(추가,삭제하는 것)를 변경하는 명령 변수는 루트 권한이 요구된다. 따라서 명령에 sudo. 접두사가 필요할 것이다.

  1. Only overlays and parameters applied at run-time can be unloaded - an overlay or parameter applied by the firmware becomes "baked in" such that it won't be listed by dtoverlay and can't be removed.

오직 오버레이와 파라메터가 런타임시 적용하면, 언로드되고 펌웨어에 의해 적용되면  dtoverlay 에 의해 목록화 되지 않고, 제거 되지 않는 그런 “baked-in” 된다.  

3.5.2 THE DTPARAM COMMAND

dtparam creates an overlay that has the same effect as using a dtparam directive in config.txt. In usage it is largely equivalent to dtoverlay with an overlay name of -, but there are a few small differences:

dtparam config.txt. 에 직접적으로 dtparam을 사용하는 것과 같은 동일한 효과를 갖는 오버레이를 만든다. 이러한 사용은 dtoverlay  오버레이 이름을 갖는 거의 동등하지만, 약간의 차이가 있다

1.    dtparam will list the help information for all known parameters of the base DTB. Help on the dtparam command is still available using dtparam -h.

dtparam 은 기본 DTB의 모든 알려진 파라메터들을 위한 도움말 정보를 리스트할것이다. Dtparam 명령어의 도움말은 dtparam -h.을 사용하므로서 가능하다.

  1. When indicating a parameter for removal, only index numbers can be used (not names).

제거하기 위한 파라메터를 나타낼 때, 인덱스 번호(이름이 아님)가 사용된다.

3.5.3 GUIDELINES FOR WRITING RUNTIME-CAPABLE OVERLAYS

This area is poorly documented, but here are some accumulated tips: 이영역은 대략 문서화 되어있지만,  축척된 팁이 있다.

·         The creation or deletion of a device object is triggered by a node being added or removed, or by the status of a node changing from disabled to enabled, or vice versa. Beware - the absence of a "status" property means the node is enabled.

디바이스 객체의 제거나 생성은 제거되거나 추가되는 노드에 의해 트리거 되거나 비활성화로부터 활성화(또는 그반대도 마찬가지) 되어지는 변화하는 노드의 상태에 의해 트리거 된다.

(주의) “status” 속성의 부재는 노드가 활성화되는 것을 의미한다.

·         Don't create a node within a fragment that will overwrite an existing node in the base DTB - the kernel will rename the new node to make it unique. If you want to change the properties of an existing node, create a fragment that targets it.

베이스 DTB내에 존재하는 노드가 덮어 씌여지는 fragment 내의 노드를 생성하지 말아라. – 커널은 그것을 고유하게 만들기 위해 새노드의 이름을 변경할 것이다. 만약 존재하고 있는 노드의 속성을 변경하고 싶다면 그것을 대상으로 하는 fragment을 생성하라.

  • ALSA doesn't prevent its codecs and other components from being unloaded while they are in use. This can lead to kernel exceptions when an overlay is unloaded if a codec is deleted before the card using it. Experimentation found that devices are deleted in the reverse of fragment order in the overlay, so placing the node for the card after the nodes for the components allows an orderly shutdown.

ALSA(Advanced Linux Sound Architecture )는 그들이 사용되는 동안 언로드 되어지는 것으로부터 다른 컴포넌트와 코덱을 막지 않는다. 이것은 카드가 그것을 사용하기 전에 코덱 제거시 오버레이가 언로드 될 때 커널 예외상황을 야기할 수 있다. 오버레이에서 fragment 주문의 역으로 제거되는 디바이스를 실험에서 찾았다. 그래서, 컴포넌트에 대한 노드후에 카드를 위한 노드를 두는 것은 순차적으로 종료하는 것을 허용한다.

3.5.4 CAVEATS (주의 사항)

The loading of overlays at runtime is a recent addition to the kernel, and so far there is no accepted way to do this from userspace. By hiding the details of this mechanism behind commands the aim is to insulate users from changes in the event that a different kernel interface becomes standardised.

동작중 오버레이의 로딩은 커널에 최신 추가이며, 사용자 영역으로부터 이것을 하기위한 허용된 방법이 없다. ??????????

·         Some overlays work better at run-time than others. Parts of the Device Tree are only used at boot time - changing them using an overlay will not have any effect.

어떤 오버레이는 다른 것 보다 런타임에 더 잘 작동한다. 디바이스 트리의 파트들은 단지 부팅타임에 사용되어진다. 오버레이를 사용하는 그들을 변경하는 것은 아무런 영향을 주지 않는다.

·         Applying or removing some overlays may cause unexpected behaviour, so it should be done with caution. This is one of the reasons it requires sudo.

적용 또는 제거하는 특정 오버레이는 예상하지 못한 상태를 야기할 수 있다. 따라서 주의해서 진행해야 한다. 이유중 하나는 그것이 sudo.를 요구한다는 것이다.

·         Unloading the overlay for an ALSA card can stall if something is actively using ALSA - the LXPanel volume slider plugin demonstrates this effect. To enable overlays for sound cards to be removed, the lxpanelctl utility has been given two new options -- alsastop and alsastart -- and these are called from the auxiliary scripts dtoverlay-pre and dtoverlay-post before and after overlays are loaded or unloaded, respectively.

ALSA card에 대한 오버레이의 언로딩은 무언가가 ALSA를 활동적으로 사용한다면 멈추게 할 수 있다. LXPanel 볼륨 슬라이더 플러그인이 이효과를 보여준다. 사운드카드의 오버레이를 제거 할 수 있도록하기 위해 lxpanelctl 유틸리티는 2개의 옵션이 주어진다. alsastop  alsastart – 이들은 오버레이들이 각각 로드 또는 언로드 전후 dtoverlay-pre 그리고 dtoverlay-post의 보조 스크립트로부터  호출되어 진다.

·         Removing an overlay will not cause a loaded module to be unloaded, but it may cause the reference count of some modules to drop to zero. Runningrmmod -a twice will cause unused modules to be unloaded.

오버레이의 제거는 로드된 모듈을 언로드 되도록 야기하지 않는다. 그러나 이것은 특정 모듈의 참조 횟수를 제로까지 떨어뜨리는 것을 야기할 수 있다.  rmmod -a 를 두번 실행하는 것은 사용되지 않는 모듈을 언로드 되도록 한다.

·         Overlays have to be removed in reverse order. The commands will allow you to remove an earlier one, but all the intermediate ones will be removed and re-applied, which may have unintended consequences.

오버레이는 역순으로 제거 되어져야만 한다. 명령어는 선행하는 어떤 것을 제거하기 위해 허용하지만, 의도하지 않은 결과를 초래할 수 있는 모든 중간 것들은 제거되거나 다시 적용될것이다.

  • Adding clocks under the /clocks node at run-time doesn't cause a new clock provider to be registered, so devm_clk_get will fail for a clock created in an overlay.

런타임시 /clock 노드 아래에 클럭들을 추가하는 것은 등록되기 위한 새로운 클럭 공급자를 야기하지 않는다 .그래서 devm_clk_get 은 오버레이내에 생성되어진 클럭에 대해 실패할 것이다.

3.6: SUPPORTED OVERLAYS AND PARAMETERS (지원되는 오버레이와 파라메터)

As it is too time-consuming to document the individual overlays here, please refer to the README file found alongside the overlay .dtbo files in /boot/overlays. It is kept up-to-date with additions and changes.

여기서 개별 오버레이의 문서화는 너무 많은 시간이 소요된다. /boot/overlays 의 오버레이 .dtbo 파일과 나란히 있는 README 파일을 참고 바란다.

(참고할 것) /boot/overlays내의 overlay  파일들은 README 파일을 제외하고 모두 *.dtbo(overlay dtb 파일이라는 뜻인듯) 따라서 컴파일되어 있으므로 열어도 소스가 보이지 않음. 보기 위해서는 아래와 같이 개별파일을 변환해야 함

Sudo dtc -I dtb –O dts –o *.dtb /boot/overlays/*.dtbo

PART 4: TROUBLESHOOTING AND PRO TIPS

4.1: DEBUGGING

The loader will skip over missing overlays and bad parameters, but if there are serious errors, such as a missing or corrupt base DTB or a failed overlay merge, then the loader will fall back to a non-DT boot. If this happens, or if your settings don't behave as you expect, it is worth checking for warnings or errors from the loader:

로더는 오버레이를 누락하거나 나쁜 파라메터를 무시할 것이다. 그러나, 누락하거나 또는 베이스 DTB를 손상하거나, 또는 오버레이 통합에 실패하는 것과 같은 중요한 에러가 있다면, 로더는 non-DT boot로 다시 떨어질 것이다. 이것이 발생한다면, 또는 설정이 예상대로 동작하지 않는다면 로더로부터 에러나 경고에 대해서 확인할 필요가 있다.

sudo vcdbg log msg

Extra debugging can be enabled by adding dtdebug=1 to config.txt.

추가 디버깅은 to config.txt.dtdebug=1 을 추가하여 설정할 수 있다.,

If the kernel fails to come up in DT mode, this is probably because the kernel image does not have a valid trailer. Use knlinfo to check for one, and themkknlimg utility to add one. Both utilities are included in the scripts directory of current Raspberry Pi kernel source trees.

만약 커널이 DT 모드로 들어가는 것이 실패한다면, 이것은 아마도 커널 이미지가 유효한 트레일러를 가지고 있지 않기 때문이다. 그것을 확인하기 위해  knlinfo 사용하고 mkknlimg 유틸리티로 추가하라. 두 가지 유틸리티는 현재의 라즈베리파이 커널 소스 트리의  scripts  디렉토리에 포함되어 있다.

You can create a human-readable representation of the current state of DT like this: 현재 상태의 DT를 사람이 읽을 수 있는 표현 방식으로 만들려면 다음과 같이 하라

dtc -I fs /proc/device-tree

This can be useful to see the effect of merging overlays onto the underlying tree.

이것은 트리 밑으로 오버레이들을 병합하는 효과를 보는데 유용할 수 있다.

If kernel modules don't load as expected, check that they aren't blacklisted in/etc/modprobe.d/raspi-blacklist.conf; blacklisting shouldn't be necessary when using Device Tree. If that shows nothing untoward, you can also check that the module is exporting the correct aliases by searching/lib/modules/<version>/modules.alias for the compatible value. Otherwise, your driver is probably missing either:

만약 커널 모듈이 예상처럼 로드 되지 않는다면, /etc/modprobe.d/raspi-blacklist.conf 에 블랙리스트가 없는지 확인하라.; 블랙리스팅은 디바이스 트리가 사용될 때 필요하지 않다. 별다른 것이 없다면, compatible 값을 위한 /lib/modules/<version>/modules.alias 을 검색하여 확인할 수 있다. 그렇지 않으며, 아마도 드라이버가 다음의 둘중 하나 처럼 없을 것이다.

.of_match_table = xxx_of_match,

or:

MODULE_DEVICE_TABLE(of, xxx_of_match);

Failing that, depmod has failed or the updated modules haven't been installed on the target filesystem.

그것이 실패한다는,  depmod 가 실패이거나 업데이트 모듈이 대상 파일 시스템에 설치 되지 않았을 것이다.

4.2: TESTING OVERLAYS USING DTMERGE AND DTDIFF

Alongside the dtoverlay and dtparam commands is a utility for applying an overlay to a DTB - dtmerge. To use it you first need to obtain your base DTB, which can be obtained in one of two ways:

dtoverlay  dtparam 명령어를 나란히 DTB에 오버레이를 적용하기 위한 유틸리티이다.  - dtmerge. 이것을 사용하기 위해 다음의 두가지 방법중 하나로 먼저 베이스 DTB를 획득할 필요가 있다.

a) generate it from the live DT state in /proc/device-tree: /proc/device-tree 의 라이브 DT 상태로부터 그것을 만들어라.

dtc -I fs -O dtb -o base.dtb /proc/device-tree

This will include any overlays and parameters you have applied so far, either in config.txt or by loading them at runtime, which may or may not be what you want. Alternatively...

이것은 원했거나 원하지 않았거나 Config.txt 이거나 동작중에 그것들을 로딩한 것에 의해 지금까지 적용했던 어떤 오버레이와 파라메터들을 포함할 것이다. 양자택일로….

b) copy it from the source DTBs in /boot. This won't include overlays and parameters, but it also won't include any other modifications by the firmware. To allow testing of all overlays, the dtmerge utility will create some of the the board-specific aliases ("i2c_arm", etc.), but this means that the result of a merge will include more differences from the original DTB than you might expect. The solution to this is to use dtmerge to make the copy:

/boot내의 소스 DTB들로부터 복사하라. 이것은 오버레이와 파라메터들을 포함하지 않을 것이지만, 이것은 또한 펌웨어에 의해 어떤 다른 수정도 포함하지 않을 것이다. 모든 오버레이의 테스트를 허용하기 위해서, dtmetge 유틸리티는 어떤 보드-교유의 별칭(“i2c_arm”, etc)을 생성할 것이지만, 이것은 예상했던것과 원본 DTB로부터 더 차이를 포함하는 병합의 결과를 의미한다. 이것의 해결책은 복사를 만들기 위한 dtmerge를 사용하는 것이다.

dtmerge /boot/bcm2710-rpi-3-b.dtb base.dtb -

(the - indicates an absent overlay name).

-  표시는 부재하는 오버레이 이름을 나타낸다.

You can now try applying an overlay or parameter:

지금 오버레이나 파라메터 적용을 시도할 수 있다.

dtmerge base.dtb merged.dtb - sd_overclock=62
dtdiff base.dtb merged.dtb

which will return:

--- /dev/fd/63  2016-05-16 14:48:26.396024813 +0100
+++ /dev/fd/62  2016-05-16 14:48:26.396024813 +0100
@@ -594,7 +594,7 @@
                };
 
                sdhost@7e202000 {
-                       brcm,overclock-50 = <0x0>;
+                       brcm,overclock-50 = <0x3e>;
                        brcm,pio-limit = <0x1>;
                        bus-width = <0x4>;
                        clocks = <0x8>;

You can also compare different overlays or parameters.

역시, 다른 오버레이나 파라메터를 비교할 수 있다.

dtmerge base.dtb merged1.dtb /boot/overlays/spi1-1cs.dtbo
dtmerge base.dtb merged2.dtb /boot/overlays/spi1-2cs.dtbo
dtdiff merged1.dtb merged2.dtb

to get:

--- /dev/fd/63  2016-05-16 14:18:56.189634286 +0100
+++ /dev/fd/62  2016-05-16 14:18:56.189634286 +0100
@@ -453,7 +453,7 @@
 
                        spi1_cs_pins {
                                brcm,function = <0x1>;
-                               brcm,pins = <0x12>;
+                               brcm,pins = <0x12 0x11>;
                                phandle = <0x3e>;
                        };
 
@@ -725,7 +725,7 @@
                        #size-cells = <0x0>;
                        clocks = <0x13 0x1>;
                        compatible = "brcm,bcm2835-aux-spi";
-                       cs-gpios = <0xc 0x12 0x1>;
+                       cs-gpios = <0xc 0x12 0x1 0xc 0x11 0x1>;
                        interrupts = <0x1 0x1d>;
                        linux,phandle = <0x30>;
                        phandle = <0x30>;
@@ -743,6 +743,16 @@
                                spi-max-frequency = <0x7a120>;
                                status = "okay";
                        };
+
+                       spidev@1 {
+                               #address-cells = <0x1>;
+                               #size-cells = <0x0>;
+                               compatible = "spidev";
+                               phandle = <0x41>;
+                               reg = <0x1>;
+                               spi-max-frequency = <0x7a120>;
+                               status = "okay";
+                       };
                };
 
                spi@7e2150C0 {

4.3: FORCING A SPECIFIC DEVICE TREE

If you have very specific needs that aren't supported by the default DTBs (in particular, people experimenting with the pure-DT approach used by the ARCH_BCM2835 project), or if you just want to experiment with writing your own DTs, you can tell the loader to load an alternate DTB file like this:

만약 기본 DTB에 의해 지원되지 않는 매우 특별한 요구를 가지고 있다면 (특히, 사람들은 ARCH_BCM2835 프로젝트에 사용되는 Pure-DT 방식을 실험), 또는 만약 개인적인 DT를 작성하는 실험을 단지 원한다면, 다음과 같은 교체 DTB 파일을 로드하기 위해 로더에게 요청할 수 있다.

device_tree=my-pi.dtb

4.4: DISABLING DEVICE TREE USAGE

Since the switch to the 4.4 kernel and the use of more upstream drivers, Device Tree usage is required in RPi kernels. The method of disabling DT usage is to add:

4.4 커널로의 전환과 더 상위 드라이버의 사용 때문에 RPi 커널에 디바이스 트리 사용이 요구된다. DT 사용의 해제 방법은 config.txt 에 다음을 추가하면 된다.

device_tree=

to config.txt. However, if the kernel has a mkknlimg trailer indicating DT capability then this directive will be ignored.

그렇치만, 만약 커널이 DT 능력을 나타내는 mkknlimg 트레일러를 가지고 있다면 이지시는 무시된다.

4.5: SHORTCUTS AND SYNTAX VARIANTS (바로 가기 및 변형 구문)

The loader understands a few shortcuts:

로더는 몇 개의 바로가기를 이해한다.

dtparam=i2c_arm=on
dtparam=i2s=on

can be shortened to:

아래와 같은 변형구문도 가능하다.

dtparam=i2c,i2s

(i2c is an alias of i2c_arm, and the =on is assumed). It also still accepts the long-form versions: device_tree_overlay and device_tree_param.

(i2c i2c_arm별칭이고, =on 이 가정된다.). 이것은 역시 device_tree_overlay  device_tree_param.등 긴형식의 버전도 여전히 받아들인다.

The loader used to accept the use of whitespace and colons as separators, but support for these has been discontinued for simplicity and so they can be used within parameter values without quotes.

로더는 분리기호로 콜론과 공백의 사용을 수용하지만, 이들에 대한 지원은 단순화를 위해 중단되었다. 그래서 그들은 따옴표(인용부호) 없이 파라메터 변수값 내에서 사용할 수 있다.

 

(참고)https://www.raspberrypi.org/documentation/configuration/device-tree.md#part3

DOCUMENTATION > CONFIGURATION > DEVICE-TREE

 

 

Posted by 이미지쿡

BCM2836 vs BCM2837 pin layout 비교(PCB 상태)

 

 

이전 자료에서 Raspberry Pi BCM2835 vs BCM2836비교해 보았는데, LPDDR2가 분리되어 있어서 BCM2835 대비 BCM2836의 Pin 수가 많아 진것을 확인할 수 있었습니다.

 

그렇다면, Raspberry Pi3에 적용된 BCM2837과는 어떤 차이가 있을까요?

아래 사진을 보면, "둘사이의 차이는 없다" 입니다.

 

 

 

좀더 확대해서 보면 알 수있는데, 부품 배치가 약간 달라지기는 했지만, Pin 배열은 동일하다는 것을 확인할 수 있었습니다.

 

즉, BCM2836의 pinout과 PKG 정보만있다면 BCM2837은 굳이 정보를 찾아 보지 않아도 된다는 의미입니다.(물론 성능은 BCM2837이 좋습니다..)

 

 

여전히 가장 큰 문제는 BCM2836, BCM2837을 시중에서 구할 수 없다는 것입니다. 물론 구한다 해도 제가 조립해 본 결과 동작하지 않습니다. ㅠ.ㅜ

 

왜 일까요?

원인은 잘모르지만, 현상적으로는 OS가 BCM2836을 인식하지 못하는 것으로 나타납니다.(나중에 시간이 허락하면 정리해 보겠습니다.)

 

그러니, 왠만하면 야매(?)로 구해서 만들어 볼 생각은 하지 않는 것이 정신건강과 경비 절약, 그리고 시간을 아끼는데 도움이 됩니다. ^^

 

 

 

Posted by 이미지쿡

Raspberry Pi2 vs Pi3 SDRAM 비교

 

Raspberry Pi 2와 Pi3에 적용된 SDRAM(LPDDR2)가 동일한 것인지 확인해 봤습니다. 확인 방법은 부품을 때어내고 BCM283X와 연결된것이 동일한가?와 PCB 배치가 동일한가?로 검증했습니다.

 

제시된 SPEC과 동일하게 같은 제품을 사용하고 있습니다.

 

 

 

PCB 부품 배치와 연결도 동일합니다.

 

 

 

JEDEC 표준과 Micron사에서 제공한 SPEC와 비교했을때도 역시 동일합니다만...

 

 

 

Datasheet상의 pin 정의와 실제 PCB상 연결에 일부 차이가 있음을 확인했습니다.

 

(1) VDD1으로 정의된 Pin을 실제로는 사용하지 않았습니다.(N22) VDD1이 여러개이므로 하나쯤 NC 처리해도 문제가 되지는 않을것 같습니다만..정확하게 어떤 이유인지는 모르겠지만 연결하지 않은 특징이 있습니다.

 

(2) JEDEC STD에는 VSS로 처리되어 있으나, 실제 PCB상에서는 사용하지 않는 VSS핀이 4개 있습니다. VSS역시 여러개 있으므로 다 연결하지 않아도 되므로 제외한것이 아닌가 생각됩니다.

 

Posted by 이미지쿡

BCM 2835 vs BCM 2836 pin layout 비교


이전에 정리했던 BCM2835에 대한 정보와 비교해서 BCM 2836 Pin layout에 대해 분석해봤습니다.


Raspberry Pi2 보드에서 BCM 2836 detech후 보드의 pin 배열을 비교해 봤습니다.



기존 BCM2835의 경우 SDRAM이 CPU에 올라가 있는 SoC 형태인데 반해서 Raspberry Pi2의 BCM2836의 경우 SDRAM이 분리되어 있어서 관련 signal 라인이 추가되어야 하므로 pin 수가 많이 늘어 난 것을 알 수 있습니다.


(전면) Raspberry Pi2 -  BCM2836 before detaching

 

(전면) BCM2836 after detaching

 

(후면) 1G LPDDR2 - ELPIDA사 제품(지금은 Micron사임)

 

(후면) 1G SDRAM after detaching ( 1GB DRAM EDB8132B4PB-8D-F )



(SDRAM)

168-Ball PoP Single-Channel FBGA – 2 x 4Gb Die, 12mm x 12mm




 



 


Posted by 이미지쿡

 

원본 문서는 아래  링크 참조 바랍니다.

COMPUTE MODULE ATTACHING & ENABLEING PERIPHERALS GUIDE

개요

 

This guide is designed to help developers using the Compute Module get to grips with how to wire up peripherals to the Compute Module pins, and how to make changes to the software to enable these peripherals to work correctly.

가이드는 컴퓨팅 모듈을 사용하는 개발자가 컴퓨팅 모듈핀에 주변 기기를 연결하는 방법과 제대로 동작하려면 이러한 주변 장치를 사용할 있도록 소프트웨어를 변경하는 방법을 이해할 있도록 설계되었습니다.

 

The Compute Module contains the Raspberry Pi BCM2835 System On Chip (SoC) or "processor", memory and eMMC (eMMC is basically like an SD card but soldered onto the board, eMMC (unlike SD cards) is specifically designed to be used as a disk and has extra features that make it more reliable in this use case). Most of the pins of the SoC (GPIO, 2 CSI camera interfaces, 2 DSI display interfaces, HDMI etc.) are freely available and can be wired up as the user sees fit (or if unused can usually be left unconnected). The Compute Module is a DDR2 SODIMM form factor compatible module, so any DDR2 SODIMM socket should be able to be used (note the pinout is NOT the same as an actual SODIMM memory module).

컴퓨터 모듈은 라즈베리파이 BCM2835 시스템 (SoC) 또는 프로세서 메모리, eMMC 구성되어 있습니다.(eMMC 기본적으로 SD카드와 동일하지만 보드에 납땜이 되어있으며, eMMC SD 카드와는 다르게 특별하게 Disk 사용될 있으며 여기서는 신뢰할 있도록 추가 기능을 갖도록 설계되어있습니다.) SoC 대부분의 핀들은(GPIO,2 CSI 카메라 인터페이스, 2 DSI 디스플레이 인터페이스, HDMI etc) 자유롭게 사용할 있으며, 사용자가 적절하게 연결하여 사용할 있습니다.(사용하지 않을 경우 연결하지 않아도 됩니다.) 컴퓨터 모듈은 DDR2 SODIMM 폼펙터 호환 모듈이므로, DDR2 SODIMM 소켓을 사용해야 합니다.

 

To use the Compute Module a user needs to design a (relatively simple) 'motherboard' that can provide power to the Compute Module (3.3V and 1.8V at minimum) and wires the pins up to the required peripherals for the user's application. Raspberry Pi provide a minimal motherboard for the Compute Module (called the Compute Module IO Board or CMIO Board) which powers the module, brings out the GPIO to pin headers, brings the camera and display interfaces out to FFC connectors, provides HDMI, USB and an 'ACT' LED as well as the ability to program the eMMC of a module via USB from a PC or Raspberry Pi.

This guide first explains the boot process and how Device Tree is used to describe attached hardware (which are essential things to understand when designing with the Compute Module). It then provides a worked example of attaching an I2C and an SPI peripheral to a CMIO Board and creating the Device Tree files necessary to make both peripherals work under Linux (starting from a vanilla Raspbian OS image).

가이드는 처음에 부트 프로세스를 설명하고, 장착되어 있는 하드웨어를 표현하는 디바이스 트리가 어떻게 사용되는지 설명합니다. CMIO 보드에 I2C SPI 주변장치를 부착하는 것과 리눅스에서 두가지 주변장치가 동작될 있도록 디바이스 트리 파일을 만드는 사례를 제공합니다.

 

Note that using Device Tree is the officially supported method of doing things (for both a Compute Module and a Raspberry Pi), you can at the moment turn off device tree in the kernel altogether but we won't be providing support for this.

디바이스 트리를 사용하는 것을 공식적으로 지원합니다.(컴퓨터 모귤과 라즈베리 파이). 당신이 디바이스 트리를 커널에서 해제할 있지만 우리는 그에 대한 지원을 제공하지 않습니다.

 

BCM283X GPIOS

BCM283x has 3 banks of General Purpose Input Output (GPIO) pins (28 pins on Bank0, 18 pins on Bank1 and 8 pins on Bank2; 54 pins in total). These pins can be used as true GPIO (i.e. software can set them as inputs or outputs, read and/or set state and use them as interrupts) but also can be set to 'alternate functions' such as I2C, SPI, I2S, UART, SD card and others.

BCM283X 3 뱅크 구조의 범용입출력(GPIO) 가지고 있습니다.( Bank 0 -28pin, Bank 1-18pin, Bank 2 – 8pin, 으로 54pin) 이들 핀들은 실제 GPIO(, input 또는 output, 설정값을 읽거나 인터럽트로 설정가능합니다.) 사용할 있을 뿐만 아니라, I2C, SPI, I2S, UART, SD 카드등과 같은 대체 기능으로 설정할 있습니다.

 

On a Compute Module both Bank0 and Bank1 are free to use with Bank2 used for eMMC and HDMI hot plug detect and ACT LED / USB boot control.

컴퓨터 모듈에 있는 Bank0 Bank1 둘다 Bank2 이용해서 자유롭게 eMMC HDMI Hot flug 검출과 ACT LED/USB boot control 있다.

 

It is useful on a running system to look at the state of each of the GPIO pins (what function they are set to, and the voltage level at the pin) - so that one can see if the system is set up as expected (this is particularly useful to see if a Device Tree is working as expected or to get a look at the pin states during hardware debug).

시스템 동작중에 GPIO 핀들의 각각의 상태를 보는데 유용합니다.(어떤 기능으로 설정되어 있는지, 그리고 그핀의 전압레벨이 얼마인지) 시스템이 예상되로 설정되어 있는지 있습니다.(이것은 하드웨어 디버깅하는 동안에 상태를 보거나 디바이스 트리가 예상되로 동작하는지 보는데 특히 유용합니다.

 

Raspberry Pi provide the raspi-gpio package which is a tool for hacking / debugging GPIO (NOTE you need to run it as root). To install raspi-gpio:

라즈베리파이는 GPIO 해킹/디버깅(:루트로 실행) 위한 툴인 raspi-gpio 패키지를 제공합니다.

 

sudo apt-get install raspi-gpio

 

If apt-get can't find the raspi-gpio package you need to do an update first:

만약 apt-get으로 raspi-gpio 패키지를 찾을 없다면 먼저 update 해야 합니다.

sudo apt-get update

 

To get help on raspi-gpio run it with the help argument:

Raspi-gpio 대한 도움말을 보려면, help 인수와 함꼐 실행하십시오.

sudo raspi-gpio help

 

For example to see the current function and level of all GPIO pins use:

예를들어 모든 GPIO핀들의 현재의 기능과 레벨을 보기 위해서는 다음의 명령어를 사용할 있습니다.

sudo raspi-gpio get

 

Note raspi-gpio can be used with the funcs argument to get a list of all supported GPIO functions per pin, it will print out a table in CSV format. The idea is to pipe the table to a .csv file and then load this file using e.g. Excel:

) raspi-gpio 핀마다 지원하는 GPIO 기능 모두의 리스트를 얻기 위한 인수인 funcs 같이 사용할 있으며, 이것은 CSV 형식 테이블로 출력됩니다. .csv 파일로 테이블이 보내지고나서 이파일을 엑셀등을 이용해서 로드합니다.

sudo raspi-gpio funcs > gpio-funcs.csv

 

 

BCM283X BOOT PROCESS

BCM283x devices consist of a VideoCore 'GPU' and ARM 'CPU' cores. The GPU is in fact a system consisting of a DSP processor and hardware accelerators for imaging, video encode and decode, 3D graphics and image compositing.

BCM283X 디바이는 VideoCore’GPU’ ARM’CPU’ 코어로 구성되어있습니다. GPU DSP 프로세서와 이미징, 비디오 인코드와 디코드, 3D 그래픽과 이미지 합성하는 하드웨어 가속기로 이루어진 시스템입니다.

 

In BCM283x devices it is the DSP core in the GPU that boots first and is responsible for general setup and housekeeping before booting up the main ARM processor(s).

BCM283x 디바이스에서 GPU DSP 코어는 첫번째로 부트되고 메인 ARM processor 부팅전에  일반적인 설정과 관리를 담당한다.

 

The BCM283x devices as used on Raspberry Pi and Compute Module boards have a 3 stage boot process:

라즈베리파이와 컴퓨터 모듈 보드에 사용되는 BCM283x 디바이스는 3단계 부트 프로세스를 가지고 있다.

 

1. The GPU DSP comes out of reset and executes code from a small internal ROM (the Boot ROM). The sole purpose of this code is to load a 'second stage' boot loader via one of the external interfaces. On a Pi or Compute Module this code first looks for a 2nd stage boot loader on the SD card (eMMC) and expects it to be called bootcode.bin and be on the first partition (which must be FAT32). If no SD card is found or no bootcode.bin is found, the Boot ROM sits and waits in 'USB boot' mode, waiting for a host to give it a second stage boot loader via the USB interface.

1. GPU DSP 작은 내부 ROM(Boot ROM)으로부터 코드를 리셋하고 실행합니다. 코드의 유일한 목적은 특정 외부 인터페이스를 통해 두번째 단계 부트로더를 로딩하는 것입니다. 파이 또는 컴퓨터 모둘에서 이코드는 먼저SD 카드(eMMC)에서 첫번째 파티션(FAT32이어야함) 있을 것으로 기대되는bootcode.bin  2단계 부트로더를 찾습니다. 만약 SD카드가 없거나 bootcode.bin  없으면, USB 인터페이스를 통한 2단계 부트로더를 제공하는 Host 기다리기 위해 ‘USB boot’ 모드로 대기한다.

 

2. The second stage boot loader (bootcode.bin on the sdcard or usbbootcode.bin for usb boot) is responsible for setting up the LPDDR2 SDRAM interface and various other critical system funcions and then loading and executing the main GPU firmware (called start.elf, again on the primary SD card partition).

2. 2단계 부트로더(bootcode.bin on the sdcard or usbbootcode.bin for usb boot) LPDDR2 SDRAM 인터페이스와 다양한 다른 중요 시스템 기능을 설정하고, 메인 GPU 펌웨어를 로딩하고 실행한다. (called start.elf, again on the primary SD card partition)

3. start.elf takes over and is responsible for further system setup and booting up the ARM processor subsystem, and contains the firmware that runs on the various parts of the GPU. It first reads dt-blob.bin to determine initial GPIO pin states and GPU-specific interfaces and clocks, then parses config.txt. It then loads an ARM device tree file (e.g. bcm2708-rpi-cm.dtb for a Compute Module) and any device tree overlays specified in config.txt before starting the ARM subsystem and passing the device tree data to the booting Linux kernel.

 

3. start.elf  ARM 프로세서 서브시스템의 부팅과 추가 시스템 설정할 책임이 있으며 GPU 다양한 부분들을 실행하는 펌웨어를 포함하고 있습니다.

초기 GPIO 상태와 GPU-특정 인터페이스와 클럭를 결정하기 위해 dt-blob.bin 먼저 로드하고나서 config.txt 구분 분석을 한다. ARM 디바이스 트리 파일(e.g. bcm2708-rpi-cm.dtb for a Compute Module) 로드하고, ARM 서브 시스템을 시작하고 디바이스 트리 데이터를 부팅 리눅스 커널에 전달하기 전에 config.txt  지정된 특정 device tree 덮어씌운다.

 

 

 

 

 

 

 

 

 

 

 

 

 

DEVICE TREE

Device Tree is a special way of encoding all the information about the hardware attached to a system (and consequently required drivers).

디바이스 트리는 시스템에 부착된 하드웨어에 관한 모든 정보를 인코딩하는 특별한 방법이다 (필요한 드라이버)

 

On a Pi or Compute Module there are several files in the first FAT partition of the SD/eMMC that are binary 'Device Tree' files. These binary files (usually with extension .dtb) are compiled from human readable text descriptions (usually files with extension .dts) by the Device Tree compiler..

Pi 컴퓨터 모듈에는 SD/eMMC FAT 파티션내에 바이너리’Device Tree’ 파일들이 여러개 있습니다. 이들 바이너리 파일들은(일반적으로 확장자가 .dtb) 디바이스 트리 컴파일러에 의해 인간이 읽을 있는 텍스트 설명서로 컴파일 됩니다.

 

On a standard Raspbian image in the first (FAT) partition you will find two different types of device tree files, one is used by the GPU only and the rest are standard ARM device tree files for each of the BCM283x based Pi products:

  • dt-blob.bin (used by the GPU)
  • bcm2708-rpi-b.dtb (Used for Pi model A and B)
  • bcm2708-rpi-b-plus.dtb (Used for Pi model B+ and A+)
  • bcm2709-rpi-2-b.dts (Used for Pi 2 model B)
  • bcm2708-rpi-cm.dtb (Used for Pi Compute Module)

표준 라즈베리안 이미지의 첫번째(FAT) 파티션내에서 두종류의 디바이스 트리 파일을 발견할 있다. 하나는 GPU에서만 사용되고, 나머지 하나는 BCM283x 기반 PI 제품들 각각에 대한 표준 ARM 디바이스 트리 파일이다.

 

NOTE on Raspbian releases 2015-05-05 and earlier bcm2708-rpi-cm.dtb is missing, do a sudo rpi-update to get it.

(참고) 2015-05-05 릴리즈한 Raspbian 이전에는 bcm2708-rpi-cm.dtb  없습니다. sudo rpi-update  실행해서 설치하십시요.

 

NOTE dt-blob.bin by default does not exist as there is a 'default' version compiled into start.elf, but for most Compute Module projects it will be necessary to provide a dt-blob.bin (which overrides the default in-built one).

 

(참고)start.elf 컴파일한 기본 버전인 dt-blob.bin  기본적으로 존재하지 않지만, 대부분의 컴퓨터 모듈 프로젝트를위해서는 dt-blob.bin  준비할 필요가 있다.(기존에 설치되어 있는 것을 덮어씌워진 )

 

Note that dt-blob.bin is in compiled device tree format, but is only read by the GPU firmware to set up functions exclusive to the GPU - see below.

(참고) dt-blob.bin  디바이스 트리형식으로 캄파일되어 있지만, GPU 전용 기능 설정을 위해 GPU 펌웨어에 의해 읽혀집니다.

 

A guide to creating dt-blob.bin is here. A comprehensive guide to the Linux Device Tree for Raspberry Pi is here.(추가번역 )

Dt-blob.bin 만드는 가이드는 here. 있다. 라즈베라파이에 대한 디바이스 트리에 포괄적인 가이드는 here. 있다.

 

During boot, the user can specify a specific ARM device tree to use via the device_tree parameter in config.txt (e.g. add the line device_tree=mydt.dtb to config.txt  where mydt.dtb is the dtb file to load instead of one of the standard ARM dtb files).

 

부팅하는 동안, 사용자는 config.txt  device_tree  파라메터를 통해 특정 ARM 디바이스 트리를 지정할 있습니다. (예를 들어 config.txt   line device_tree= mydt.dtb 추가하면 표준 ARM dtb 파일 대신에 mydt.dtb  로드 됩니다.)

 

In addition to loading an ARM dtb, start.elf supports loading aditional Device Tree 'overlays' via the dtoverlay parameter in config.txt. (e.g. add as manydtoverlay=myoverlay lines as required overlays to config.txt noting that overlays live in /overlays and are suffixed -overlay.dtb e.g. /overlays/myoverlay-overlay.dtb). Overlays are merged with the base dtb file before the data is passed to the Linux kernel when it starts.

ARM dtb 로딩뿐만 아니라, start.elf  config.txt 내의 ‘overlays’ dtoverlay 파라메터를 통해 추가적인 디바이스 트리의 로딩을 지원한다.( 예를 들어

 Overlays 데이터가 리눅스 커널에 전달되기전에 기준 dtb 파일과 병합된다.

 

Overlays are used to add data to the base dtb that describes non board-specific hardware, which includes GPIO pins used and their function as well as the device(s) attached (so correct drivers can be loaded). The convention is that on a Raspberry Pi all hardware attached to the Bank0 GPIOs (the GPIO header) should be described using an overlay. On a Compute Module all hardware attached to the Bank0 and Bank1 GPIOs should be described in an overlay file.

You don't have to follow these conventions (you can roll all information into one single dtb file, replacing bcm2708-rpi-cm.dtb) but following the conventions means that you can use a 'standard' Raspbian release with its standard base dtb and all the product-specific information is contained in a separate overlay. Occasionally the base dtb might change - usually in a way that will not break overlays - which is why using an overlay is suggested.

 

오버레이는 장착된 디바이스 뿐만 아니라 사용된 GPIO 핀들과 기능을 포함한 비특정 하드웨어의 설명을 기준 dtb 데이터를 추가하기 위해 사용됩니다. (따라서 올바른 드라이버가 로드됩니다.) 규칙은 라즈베리파이의 Bank 0 GPIO(GPIO Header) 장착된 모든 하드웨어는 오버레이를 사용해서 설명되어야 합니다. 컴퓨터 모듈의 Bank0 Bank1 GPIO 설치된 모든 하드웨어는 어버레이 파일 내에 설명되어져야 합니다. 규칙을 따를 필요는 없습니다(bcm2708-rpi-cm.dtb 교체하여 특정한 하나의 dtb 파알안에 모든 정보를 롤백 있습니다.) 하지만  규칙을 따른 다는 것은 표준에 기반한 dtb 갖는 표준 라즈베리안 배포 사용할 있음을 의미하고, 모든 제품 규격 정보는 분리된 오버레이내에 포함되어야 합니다. 가끔 기본 dtb 변경되므로 일반적으로 오버레이가 분리되지 않는 방법으로 -  오버레이를 사용하도록 제안하는지 이유입니다.(?)

 

 

 

 

 

 

 

 

 

 

 

DT-BLOB.BIN

When start.elf runs it first reads something called dt-blob.bin which is a special form of Device Tree blob which tells the GPU how to (initially) set up the GPIO pin states, and also any information about GPIOs/peripherals that are controlled (owned) by the GPU (rather than being used via Linux on the ARM). For example the Raspberry Pi Camera peripheral is managed by the GPU, and the GPU needs exclusive access to an I2C interface to talk to it (I2C0 on most Pi Boards and Compute Module is nominally reserved for exclusive GPU use) as well as a couple of control pins. The information on which GPIO pins the GPU should use for I2C0 and to control the camera functions comes from dt-blob.bin. (NOTE the start.elf firmware has a 'built-in' default dt-blob.bin which is used if no dt-blob.bin is found on the root of the first FAT partition, but most Compute Module projects will want to provide their own custom dt-blob.bin).

 

Note that dt-blob.bin specifies which pin is for HDMI hot plug detect (though this should never change on Compute Module) and can also be used to set up a GPIO to be a GPCLK output and specify and ACT LED that the GPU can use while booting. Other functions may be added in future. For information on dt-blob.bin see here.

 

start.elf  실행될 GPU 초기 GPIO 상태를 어떻게 설정할지를 설명하고, GPU 의해(ARM 리눅스를 통해 사용되기 보다는) 콘트롤되는 GPIOs/주변회로에 대한 특정 정보인 디바이스 트리 집합체의 특별한 형태인dt-blob.bin  제일 먼저 읽는다. 예를 들어 라즈베리파이 카메라 장치는 GPU 의해 관리되고 GPU I2C 인터페이스에 카메라 장치와 연결하기 위해 단독으로 엑세스할 필요가 있다. (대부분의 파이 보드와 컴퓨터 모듈의 I2C0 통상 단독으로 GPU 사용하도록 예약되어 있습니다.) GPU I2C0 사용해서 카메라 기능을 콘트롤해야 하며, GPIO 핀들의 정보는 dt-blob.bin.로부터 옵니다.

((참고) start.elf 펌웨어는. 만약 dt-blob.bin  첫번째 FAT 파티션의 루트에서 찾을 없을 경우 사용되는 내장된 기본 dt-blob.bin. 가지고 있습니다. 하지만 대부분의 컴퓨터 모듈 프로젝트는 사용자 정의의 dt-blob.bin 준비해야 합니다.)

((참고) dt-blob.bin. HDMI hot plug 검출(비록 컴퓨터 모듈에서는 절대 변경할 없습니다만) 위한 핀을 명시합니다. 그리고 또한 GPU 부팅되는 동안에 사용할 있는 ACT LED, GPIO GPCLK 출력을 설정하고 명시하는데 사용될수 있습니다. 다른 기능들은 미래에 추가 될것이며 상세한 정보는 여기를 참고 하세요.

minimal-cm-dt-blob.dts is an example .dts device tree file that sets up the HDMI hot plug detect and ACT LED (these are GPIOs 46 and 47 which we state must be used only for these functions on all Compute Module designs) and sets all other GPIOs to be inputs with default pulls.

minimal-cm-dt-blob.dts.dts  디바이스 트리 파일의 예제로 HDMI hot plug detect ACT LED(모든 컴퓨터 모듈 설계에 적용되는 GPIO 46, 47 사례) 설정하고 다른 GPIO 기본 레벨를 갖도록 설정합니다.

 

To compile the minimal-cm-dt-blob.dts to dt-blob.bin use the Device Tree Compiler dtc:

minimal-cm-dt-blob.dts  dt-blob.bin  컴파일 하기 위해서는 디바이스 트리 컴파일러 dtc: 사용합니다.

dtc -I dts -O dtb -o dt-blob.bin minimal-cm-dt-blob.dts

 

 

ARM LINUX DEVICE TREE

After start.elf has read dt-blob.bin and set up the initial pin states and clocks, it reads config.txt which contains many other options for system setup (see here for a comprehensive guide).

start.elf  dt-blob.bin 읽고 초기 상태와 클럭들을 설정 후에, 시스템 설정을 위한 많은 다른 옵션들 포함하는 config.txt (포괄적인 가이드는here를 참조) 읽습니다.

 

After reading config.txt another device tree file specific to the board the hardware is running on is read; this is bcm2708-rpi-cm.dtb for a Compute Module. This file is a standard ARM Linux device tree file, which details how hardware is attached to the processor (what peripheral devices exist in the SoC and where, which GPIOs are used, what functions those GPIOs have, and what physical devices are connected). This file will set up the GPIOs appropriately (it will overwrite pin state set up in dt-blob.bin if it is different) and will also try and load driver(s) for the specific device(s).

config.txt  읽은 후에, 하드웨어가 실행되고 있는 보드 고유의 다른 디바이스 트리 파일을 읽습니다. 이것은 컴퓨터 모듈을 위한 bcm2708-rpi-cm.dtb 입니다. 이파일은 표준 ARM 리눅스 트리 파일로 어떻게 하드웨어가 프로세서에 설치되는지 방법을 상세하게 나타낸다.(어떤 주변 장치가 SoC 어디에 존재하는지와 어떤 GPIO 사용하는지, 어떤 기능의 GPIO 가지고 있는지, 어떤 주변 장치와 연결되어 있는지등..) 이파일은 GPIO들을 알맞게 설정하고( 만약 차이가 난다면 dt-blob.bin  덮어쓰고 상태를 설정합니다.) 특정 디바이를 위한 드라이버를 로드하고 시도합니다.

Although the bcm2708-rpi-cm.dtb file can be used to load all attached devices, the recommendation for Compute Moudule users is to leave this file alone (i.e. just use the one supplied in the standard Raspbian software image) and add devices using a custom 'overlay' file as previously described. The bcm2708-rpi-cm.dtbfile contains (disabled) entries for the various peripherals (such as I2C, SPI, I2S etc.) and no GPIO pin definitions (apart from the eMMC/SD Card peripheral which has GPIO defs and is enabled, because it is always on the same pins). The idea is the separate overlay file will enable the required interfaces, describe the pins used, and also describe the required drivers. The start.elf firmware will read and merge the bcm2708-rpi-cm.dtb and overlay data before giving the merged device tree to the Linux kernel as it boots up.

 

bcm2708-rpi-cm.dtb 파일이 모든 부착된 디바이스를 로드하기 위해 사용될 있으므로, 컴퓨트 모듈 사용자를 위한 권장사항으로 이파일 하나를 두고 (표준 라즈베리안 소프트웨어 이미지내 제공된 하나만을 사용) 이전 글에 설명한 것처럼 사용자 정의 오버레이파일을 사용해서 디바이스를 추가 하십시오. bcm2708-rpi-cm.dtb 파일은 다양한 주변장치의 비활성화된 항목(I2C,SPI,I2S, 같은)   정의되지 않은 GPIO핀을 포함하고 있습니다.( 항상 같은 핀을 사용하는 eMMC/SD 카드 주변 장치는 GPIO defs으로 설정되므로 제외합니다) 별도의 오버레이 파일이은 필요한 인터페이스를 사용할 있게 사용된 핀들을 설명하며, 필요한 드라이버들을 설명할 것입니다. start.elf  펌웨어는 bcm2708-rpi-cm.dtb 읽거나 통합된 디바이스 트리를 리눅스 커널이 부팅되기 전의 오버레이 데이터와 합칠 것입니다.

 

DEVICE TREE SOURCE AND COMPILATION

The Raspbian image provides compiled dtb files, but where are the source dts files? They live in the Raspberry Pi Linux kernel branch, on GitHub. Look in the arch/arm/boot/dts folder.

라즈베리안 이미지는 컴파일된 dtb 파일들을 제공합니다. dts 소스 파일들은 어디에 있을까요? 그들은 GitHub 라즈베리파이 리눅스 커널 브렌치내에 있으며, arch/arm/boot/dts 폴더를 보세요.

Some default overlay dts files live in arch/arm/boot/dts/overlays(corresponding overlays for standard hardware that can be attached to a Raspberry Pi in the Raspbian image are on the FAT partition in the /overlays directory - note these assume certain pins as they are for use on a Raspberry Pi, so in general use the source of these standard overlays as a guide to creating your own unless you are using the exact same GPIO pins as you would be using if the hardware were plugged into the GPIO header of a Raspberry Pi).

기본 오버레이 dts 파일들은 arch/arm/boot/dts/overlays 있습니다. ( 라즈베리안 이지지에 라즈베리파이에 설치되어져 있는 표준 하드웨어에 해당되는 오버레이들은 FAT 파티션인 /overlays  있습니다.) (참고) 이들은 라즈베리 파이에서 사용하기 위한 특정 핀을 통제합니다. 따라서, 라즈베리파이의 GPIO 헤더 장착된 하드웨어로 사용되는 동일한 GPIO 사용하지 않는한 일반적으로 사용자가 새롭게 만들기 위한 가이드로서 이들 표준 오버레이의 소스를 사용합니다.

 

To compile these dts files to dtb files requires an up-to-date version of the Device Tree compiler dtc. More info can be found here, but the easy way to install an appropriate version on a Pi is to run:

dts 파일들을 dtb 파일들로 컴파일 하기위해서는 업데이트된 버전의 디바이스 트리 컴파일러 dtc. 필요하다. 추가적인 정보는 here에서 찾을 수 있다. 하지만 파이에 적절한 버전을 설치하기 쉬운 방법은 다음을 설치하는 것입니다.

sudo apt-get install device-tree-compiler

 

If you are building your own kernel then the build host also gets a version in scripts/dtc, and you can arrange that your overlays are built automatically by adding them to Makefile in arch/arm/boot/dts/overlays and using the "dtbs" make target.

사용자 정의 커널을 빌드하고 Host 구축한다면 scripts/dtc내에 버전을 가져와서 그것들 arch/arm/boot/dts/overlays 내에서 Makefile “dtbs” 이용하여 타겟을 만들어 사용자 오버레이가 자동으로 빌드될수 있도록 정렬할 있습니다.

 

DEVICE TREE DEBUGGING(디바이스 트리 디버깅)

When the Linux kernel is booted on the ARM core(s) the GPU provides it with a fully assembled device tree (assembled from the base dts and any overlays). This full tree is available via the Linux proc interface in /proc/device-tree, where nodes become directories and properties become files.

리눅스 커널이 ARM 코어들에서 부팅될 , GPU 종합적으로 생산된 디바이스 트리(기본 dts 다른 오버레이들로부터 생산된) 제공합니다. 종합 트리는/proc/device-tree 내에 있는 리눅스 프로세스 인터페이스를 통해 사용 가능합니다.

 

You can use dtc to write this out as a human readable dts file for debugging (you can see the fully assembled device tree which is often very useful):

dtc -I fs -O dts -o proc-dt.dts /proc/device-tree

 

dtc  사용해서 사람이 읽을 있는 디버깅을 위한 dts파일로 출력할 있습니다.(종합 생산된 디바이스 트리를 보는데 유용한 합니다.)

 

As previously explained in the GPIO section it is also very useful to use raspi-gpio to look at the setup of the GPIO pins to see if they are as you expect:

raspi-gpio get

 

GPIO 섹션에서 이미 설명한 처럼, raspi-gpio  사용하여 GPIO 핀의 설정을 보거나 기대값을 확인하는데 매우 유용하게 사용할 있다.

 

If something seems to be going awry useful information can also be found by dumping the GPU log messages:

sudo vcdbg log msg

 

만약 무언가 잘못된 같을 경우에 대한 유용한 정보를 GPU 로그 메시지를 덤핑해서 찾을 수도 있다.

 

You can include more diagnostics in the output by adding dtdebug=1 to config.txt.

config.txt dtdebug=1  줌으로서 출력에 추가적인 진단루틴을 포함할 있다.

 

GETTING HELP

Please use the Device Tree subforum on the Raspberry Pi forums to ask Device Tree related questions.

디바이스 트리 관련된 질문을 하기 위한 라즈베리파이 포럼에 있는 Device Tree subforum을 사용하세요

 

 

 

 

EXAMPLES

For these simple examples I used a CMIO board with peripherals attached via jumper wires.

간단한 예제로서 점프선이 통해 설치된 주변회로를 갖는 CMIO 보드를 사용합니다.

 

For each of the examples we assume a CM+CMIO board with a clean install of the latest Raspbian version on the CM. See instructions here.

각각 예제를 위해 CM 보드에 최신의 라즈베리안 버전이 설치된 깨끗한 CM+CMIO 보드를 사용합니다.

 

The examples here require internet connectivity, so a USB hub plus keyboard plus WiFi dongle (or Ethernet dongle) plugged into the CMIO USB port is recommended.

예제들은 인터넷 연결이 필요하며, USB 허브와 키보드, WiFi 동글(또는 이더넷 동글) 꼽혀있는 CMIO USB 포트를 추천한다.

 

For Raspbian versions 2015-05-05 or earlier do a sudo rpi-update to make sure you have the latest firmware and bcm2708-rpi-cm.dtb.

2015-05-05일자 라즈베리안 버전이나 이전 것은 “sudo rpi-update” 통해 최신 펌웨어와 bcm2708-rpi-cm.dtb. 설치하시오.

 

If you suspect any issues or bugs with Device Tree it is always best to try a sudo rpi-update to make sure you are using the latest firmware (WARNING if you have edited any of the default .dtb files in /boot or /boot/overlays these may be overwritten by rpi-update).

만약 디바이스 트리에 어떤 이슈나 버그가 의심된다면 sudo rpi-update  시도해서 최신 펌웨어를 사용하는 것이 항상 최선이다.(주의, 만약 /boot 또는/boot/overlays  기본 .dtb 파일을 수정했다면 이것들은 rpi-update 이해 덮어 씌어질 것입니다.)

Please post any issues / bugs / questions on the Raspberry Pi Device Tree subforum.

라즈베리파이 디바이스 트리 서브포럼에 있는 이슈/버그/질문들을 게시해 주세요.

 

EXAMPLE 1 - ATTACHING AN I2C RTC

In this simple example we wire an NXP PCF8523 real time clock (RTC) to the CMIO board GPIO pins (3V3, GND, I2C1_SDA on GPIO44 and I2C1_SCL on GPIO45).

예제에서는 NXP PCF8523 real time clock (RTC) CMIO 보드 GPIO 선으로 연결한다.(3V3, GND GPIO44 I2C1_SDA, GPIO45 I2C1_SCL)

Download minimal-cm-dt-blob.dts and copy it to the SD card FAT partition (located in /boot when the CM has booted).

minimal-cm-dt-blob.dtsSD 카드 FAT 파티션에 다운로드하고 카피하시오.(CM이 부팅될 때  /boot  위치한다.)

 

Edit minimal-cm-dt-blob.dts and change the pin states of GPIO44 and 45 to be I2C1 with pull-ups:

sudo nano /boot/minimal-cm-dt-blob.dts

 

minimal-cm-dt-blob.dts  I2C1 풀업되도록 GPIO44 45 핀상태를 수정하고 변경하시오.

Change lines:

pin@p44 { function = "input"; termination = "pull_down"; }; // DEFAULT STATE WAS INPUT NO PULL
pin@p45 { function = "input"; termination = "pull_down"; }; // DEFAULT STATE WAS INPUT NO PULL

 

to:

pin@p44 { function = "i2c1"; termination = "pull_up"; }; // SDA1
pin@p45 { function = "i2c1"; termination = "pull_up"; }; // SCL1

 

NOTE we could use this dt-blob.dts with no changes, as the Linux Device Tree will (re)configure these pins during Linux kernel boot when the specific drivers are loaded, so it is up to you whether you modify dt-blob.dts.  I like to configure dt-blob.dts to what I expect the final GPIOs to be, as they are then set to their final state as soon as possible (during the GPU boot stage) but this is not strictly necessary. You may find that in some cases you do need pins to be configured at GPU boot time so they are in a specific state when Linux drivers are loaded (e.g. maybe a reset line needs to be held in the correct orientation).

(참고) 특정 드라이버가 올라올는 리눅스 커널 부팅 기간에 이들 핀들은 리눅스 디바이스 트리가() 설정하므로 변경없는 dt-blob.dts  사용할 있습니다. 따라서 dt-blob.dts 수정할지 말지 결정해야 합니다. 여기서는 기대되는 최종 GPIO 되도록  dt-blob.dts  설정합니다. 핀들은 최종 상태로 가능한 빨리 설정됩니다.(GPU 부팅 단계 동안에)하지만 이것은 절대적으로 필요한 것은 아닙니다. 어떤 경우는 그들은 리눅스 드라이버들이 로드될 특정 상태에 있는지(예로서 리셋라인 올바른 방향으로 유지될 필요가 있다)   GPU 부팅 시간에 설정되어지기 위한 필요한 핀들을 찾을 있습니다.

 

Compile dt-blob.bin:

sudo dtc -I dts -O dtb -o /boot/dt-blob.bin /boot/minimal-cm-dt-blob.dts

 

Grab example1-overlay.dts and put it in /boot then compile it:

example1-overlay.dts를 받아서 /boot  넣고 그것을 컴파일 하시오.

sudo dtc -@ -I dts -O dtb -o /boot/overlays/example1-overlay.dtb /boot/example1-overlay.dts

 

Note the '-@' in the dtc command line - this is necessary if you are compiling dts files with external references, as overlays tend to be.

(참고) dtc 명령어 라인에 있는 ‘-@’ 오버레이되는 방향으로 dts 파일들을 외부 참조하여 컴파일 하는 경우에 필요합니다.

 

Edit /boot/config.txt and add the line:

dtoverlay=example1

/boot/config.txt  변경될 있도록 라인에 추가하시오

 

Now save and reboot. 저장하고 다시 부팅하시오.

Once rebooted you should see an rtc0 entry in /dev and running:

/dev내에 rtc0 항목을 있어야 하며 동작한다면 다시 리부팅 된다.

sudo hwclock

하드웨어 클럭 타임으로 되돌아 가고, 에러는 없다.

EXAMPLE 2 - ATTACHING AN ENC28J60 SPI ETHERNET CONTROLLER

 

In this example we take the first RTC example and add another peripheral - an ENC28J60 SPI Ethernet Controller. The Ethernet controller is connected to SPI pins CE0, MISO, MOSI and SCLK (GPIO8-11 respectively), as well as GPIO12 for a falling edge interrupt, and of course GND and 3V3.

이번 예제는 첫번째 RTC 예제와 다른 주변 회로인 ENC28J60 이더넷 콘트롤러를 추가한다. 이더넷 콘트롤러는 SPI 핀들인 CE0,MISO,MOSI SCLK(GPIO8-11 각각) 뿐만 아니라, GND, 3V3 폴링 엣지 인터럽트를 위한 GPIO12 연결된다.

 

In this example we won't change dt-blob.bin (though of course you can if you wish) and we should see that Linux Device Tree correctly sets up the pins.

이번 예제에서는 dt-blob.bin  변경되지 않고서(물론 당신이 원할수 있지만) 리눅스 디바이스 트리가 핀들을 올바르게 설정하는 것을 있다.

 

Grab example2-overlay.dts and put it in /boot then compile it:

sudo dtc -@ -I dts -O dtb -o /boot/overlays/example2-overlay.dtb /boot/example2-overlay.dts

example2-overlay.dts를 다운받고 /boot  넣은후 컴파일 하시오.

 

Edit /boot/config.txt and add the line:

dtoverlay=example2

 

Now save and reboot.

Once rebooted you should see, as before, an rtc0 entry in /dev and running:

sudo hwclock

will return with the hardware clock time, and not an error.

You should also have Ethernet connectivity: 이더넷 연결할수 있다.

ping 8.8.8.8

 

should work.

 

finally running:

sudo raspi-gpio get

 

should show that GPIO8-11 have changed to ALT0 (SPI) functions.

GPIO8-11 ALT0(SPI) 기능으로 변경된 것을 있다.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ATTACHING A CAMERA OR CAMERAS

To attach a camera or cameras see the documentation here

 

This document is a work in progress and is intended for advanced users.

(이문서는 진행중인 작업이며, 고급 사용자를 위한 것입니다.)

 

For the camera to work with the compute module, the firmware needs to be July 23rd 2014 or newer (use vcgencmd version to check).

컴퓨터 모듈에서 카메라를 작동하기 위해서는, 2014 7 23일자나 이후 최신 펌웨어가 필요합니다. 확인하기 위해 vcgencmd version  사용하시오.

 

QUICKSTART

  1. On the compute module, run sudo raspi-config and enable the camera.
  2. Next, run sudo wget http://goo.gl/lozvZB -O /boot/dt-blob.bin
  3. Connect adapter board and camera to CAM1 port.

 

    4. Connect GPIO pins together as shown below.

 

5. (Optional) To add an additional camera, repeat step 3 with CAM0 and connect the GPIO pins for the second camera.

6. Finally, reboot for the dt-blob.bin file to be read

 

Software support

Recent raspicam binaries (raspivid and raspistill) have the -cs (--camselect) option to specify which camera should be used

최신 라즈파이캠 바이너리는(raspivid raspistill) 어떤 카메라를 사용할지 정의하기 위한 –cs (--camselect) 옵션을 가지고 있다.

(sudo raspistill –cs 1 –o ex.jpg  같이 사용한다.)

 

From other applications, MMAL can be told which camera to use by setting MMAL_PARAMETER_CAMERA_NUM accordingly.

다른 어플리케이션으로부터, MMAL MMAL_PARAMETER_CAMERA_NUM 설정에 맞춰서 어떤 카메라를 사용할지 표현해 준다.

MMAL_PARAMETER_INT32_T camera_num = {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, CAMERA_NUMBER};
status = mmal_port_parameter_set(camera->control, &camera_num.hdr);

 

ADVANCED

The 15-way 1mm FFC camera connector on the Raspberry Pi model A and B is attached to the CAM1 interface (though only uses 2 of the 4 available lanes).

라즈베리파이 모델 A B에는 15-way 1mm FFC 카메라 콘넥터가 CAM1 인터페이스에 설치되어있다.(비록 4개의 가능한 레인중 2개만 사용하지만..)

 

The Compute Module IO Board has a 22-way 0.5mm FFC for each camera port, with CAM0 being a 2-lane interface and CAM1 being the full 4-lane interface.

컴퓨터 모듈 IO 보드는 카메라 포트를 위한 22-way 0.5mm FFC 가지고 있으며, CAM0 2-lane 인터페이스와 CMA1 4-lane 인터페이스로 되어 있다.

 

To attach a standard Raspberry Pi Camera to the Compute module IO Board a small adaptor board is available that adapts the 22W FFC to the Pi 15W FFC.

표준 라즈베리파이 카메라를 컴퓨터 모듈에 IO 보드에 설치하기 위해서는 22W FFC Pi 15W FFC 적용할수 있는 작은 어뎁터 보드로 가능하다.

 

To make the Raspberry Pi Camera work with a standard Raspian OS the GPIOs and I2C interface must be wired to the CAM1 connector. This is done by bridging the correct GPIOs from the J6 GPIO connector to the CD1_SDA/SCL and CAM1_IO0/1 pins on the J5 connector using jumper wires. Additionally, a dt-blob.bin file needs to be provided to override default pin states (the dt-blob.bin file is a file that tells the GPU what pins to use when controlling the camera, for more information on this see the relevant section in the guide to attaching peripherals to a Compute Moule here).

 

표준 라즈베리안 OS에서 라즈베리파이 카메라를 동작시키기 위해서는 GPIO I2C 인터페이스가 CAM1 콘넥터에 연결되어 있어야 합니다. 이것은 점퍼선을 이용하여 J6 GPIO 콘넥터에 있는 CD1_SDA/SCL CAM1_IO0/1 핀을 J5 콘넥터에 연결하여 수행됩니다. 추가적으로, dt-blod.bin 파일은 기본 상태를 우선 제공할 필요가 있습니다.(dt-blob.bin 파일은 GPU 카메라를 콘트롤할때 사용하는 핀을 말해주는 파일로서 많은 정보는 관련된 섹션을 참조하시오 here앞에서 설명한 부분임.)

The pin numbers below are provided only as an example. LED and SHUTDOWN pins can be shared by both cameras, if required. The SDA and SCL pins must be either GPIO0 and GPIO1 or GPIO28 and 29 and must be individual to each camera.

아래의 핀번호들은 단지 예로서 제공됩니다. LED SHUTDOWN 핀들은 양쪽 카메라에 의해서 공유될수 있습니다. 필요한 것은 SDA SCL핀은 GPIO0 GPIO1 또는 GPIO28 29 둘중 하나로 연결되어야 하며 카메라에 개별적이어야 합니다.

 

STEPS TO ATTACH A RASPBERRY PI CAMERA (TO CAM1)

  1. Attach the 0.5mm 22W FFC flexi (included with the adaptor board) to the CAM1 connector (flex contacts face down).
  2. Attach the camera adaptor board to the other end of the 0.5mm flex (flex contacts face down).
  3. Attach a Raspberry Pi Camera to the other, larger 15W 1mm FFC on the camera adaptor board (contacts on the Raspberry Pi Camera flex must face up).
  4. Attach CD1_SDA (J6 pin 37) to GPIO0 (J5 pin 1).
  5. Attach CD1_SCL (J6 pin 39) to GPIO1 (J5 pin 3).
  6. Attach CAM1_IO1 (J6 pin 41) to GPIO2 (J5 pin 5).
  7. Attach CAM1_IO0 (J6 pin 43) to GPIO3 (J5 pin 7).

The numbers in brackets are conventional, physical pin numbers, numbered from left to right, top to bottom. The numbers on the silkscreen correspond to the Broadcom SoC GPIO numbers.

괄호안에 있는 번호는 일반적으로 물리적 핀 번호이고 번호는 좌에서 우로, 위에서 아래로 붙여진다. 실크스크린 위의 번호들은 Broadcom SoC GPIO 번호에 상응하는 것이다.

.CONFIGURING DEFAULT PIN STATES

The GPIOs used by the camera, default to input mode on the compute module. In order to override the default pin states and define the pins used by the camera, we need to create a dt-blob.bin file from a source dts file with the relevant information for the GPU, and place this on the root of the first FAT partition.

카메라에 사용되는 GPIO 컴퓨터 모듈에서 기본적으로 입력모드이다. 기본 상태를 무시하고 카메라에 사용되는 핀들을 정의하기 위해서는 GPU 위한 관련된 정보를 갖는 소스 dts 파일로부터 dt-blob.bin 파일을 만들어야 하고, 이것을 루트의 FAT 파티션에 놓아야 한다.

(노란색 바탕에 대한 기술은 추가 정리해야 한다)

 

Sample device tree source files are provided at the bottom of this document.

The pin_config section in the pins_cm { } (compute module) section of the source dts needs the camera's LED and power enable pins set to outputs:

소스 dts (컴퓨터 모듈) 섹션내의 Pin_config 섹션 pins_cm { }  카메라의 LED 파워 인에이블 핀을 출력으로 설정한다.

 

pin@p2  { function = "output"; termination = "no_pulling"; };
pin@p3  { function = "output"; termination = "no_pulling"; };

 

To tell the firmware which pins to use and how many cameras to look for, add the following to the pin_defines section:

어떤 핀을 사용하고 얼마나 많은 카메라를 사용하지를 펌웨어에게 알려주기 위해서 pin_defines 섹션에 다음을 추가하시오.

pin_define@CAMERA_0_LED { type = "internal"; number = <2>; };
pin_define@CAMERA_0_SHUTDOWN { type = "internal"; number = <3>; };
pin_define@CAMERA_0_UNICAM_PORT { type = "internal"; number = <1>; };
pin_define@CAMERA_0_I2C_PORT { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SDA_PIN { type = "internal"; number = <0>; };
pin_define@CAMERA_0_SCL_PIN { type = "internal"; number = <1>; };
 

 

 

HOW TO ATTACH TWO CAMERAS

 

Attach the second camera to the (CAM0) connector as before.

Connect up the I2C and GPIO lines.

  1. Attach CD0_SDA (J6 pin 45) to GPIO28 (J6 pin 1).
  2. Attach CD0_SCL (J6 pin 47) to GPIO29 (J6 pin 3).
  3. Attach CAM0_IO1 (J6 pin 49) to GPIO30 (J6 pin 5).
  4. Attach CAM0_IO0 (J6 pin 51) to GPIO31 (J6 pin 7).

5.    The compute module's pin_config secion needs the second camera's LED and power enable pins configured:

6.  pin@p30 { function = "output"; termination = "no_pulling"; };
7.  pin@p31 { function = "output"; termination = "no_pulling"; };

8.    In the compute module's pin_defines section of the dts file, change theNUM_CAMERAS parameter to 2 and add the following:

9.  pin_define@CAMERA_1_LED { type = "internal"; number = <30>; };
10.pin_define@CAMERA_1_SHUTDOWN { type = "internal"; number = <31>; };
11.pin_define@CAMERA_1_UNICAM_PORT { type = "internal"; number = <0>; };
12.pin_define@CAMERA_1_I2C_PORT { type = "internal"; number = <0>; };
13.pin_define@CAMERA_1_SDA_PIN { type = "internal"; number = <28>; };
14.pin_define@CAMERA_1_SCL_PIN { type = "internal"; number = <29>; };

SAMPLE DEVICE TREE SOURCE FILES

Enable a CAM1 only,

Enable both cameras

As of 2015-04-17 some users are reporting issues with GPIO pin 2 and 3 for camera control. Pin 4 and 5 is reported to work. The issue is being investigated.

 

CHANGING THE DEFAULT PIN CONFIGURATION (23페이지 상단의 CONFIGURING DEFAULT PIN STATES에 관련된 내용임)

This feature is intended for advanced users. ( 기능은 고급 사용자를 위한 것입니다.)

As of July 15th 2014, the Raspberry Pi firmware supports custom default pin configurations through a user-provided device tree blob file. In order to ensure that your firmware is recent enough, please run vcgencmd version.

2014 715일자로 라즈베리 파이 펌웨어는 사용자가 제공하는 디바이스 트리 blob 파일을 통해 사용자 정의 기본 구성을 지원합니다. 펨웨어가 최근 것인지 확인하기 위해서 vcgencmd version. 실행해 주십시오.

 

PROVIDING A CUSTOM DEVICE TREE BLOB

In order to compile a device tree source (dts) file into a device tree blob (dtb) file, the device tree compiler must be installed by running sudo apt-get install device-tree-compiler. The dtc command can then be used as follows:

디바이스 트리 소스(dts) 파일을 디바이스 트리 blob(dtb) 파일로 컴파일 하기 위해서, 디바이스 트리 컴파일러는 sudo apt-get install device-tree-compiler. 실행함으로서 설치 되어져야 합니다. 다음의 dtc 명령이 사용되어 있습니다.

sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob.dts

 

NOTE: In the case of NOOBS installs, the dtb file should be placed on the recovery partition instead.

참고:NOOBS 설치된 경우, dtb 파일은 리커버리 파티션에 대신 배치해야 합니다.

 

Similarly, a dtb file can be converted back to a dts file, if required.

마찬가지로 필요한 경우, dtb파일은 dts 다시 변환될 있습니다.

dtc -I dtb -O dts -o dt-blob.dts /boot/dt-blob.bin                                                                                                                                                                                                                                                                                                                  

 

 

SECTIONS OF THE DT-BLOB

The dt-blob.bin is used to configure the binary blob (Videocore) at boot time. It is not something that the linux kernel uses (at the moment) although a kernel section will be added at a later stage when we move the Raspberry Pi kernel to use a dt-blob for configuration. The dt-blob is capable of configuring each of the different versions of the Raspberry Pi including the Compute Module to set up the alternate settings correctly. The following sections are valid in the dt-blob.

Dt-blob.bin 부팅시간에 바이너리 blob(Videocore) 환경 설정에 사용됩니다. 환경 설정용  dt-blob 사용하기 위해서 라즈베리파이 커널로 이동할 비록 커널 섹션이 이후 단계에 추가 될지라도 리눅스 커널이 사용하는 것은 아니다(잠깐 동안). Dt-blob 컴퓨터 모듈을 포함한 라즈베리파이의 다른 버전의 각각에 대해 대안 설정을 올바르게 설치하기 위해 환경 설정을 있다.다음 섹션은 dt-blob 유효합니다.

 

1.videocore

This section contains the whole videocore blob information, all subsequent sections must be enclosed within this section(이 섹션은 전체 비디오코어 blob 정보를 포함하며, 이후의 모든 섹션은 이 섹션내에 묶어야 합니다.)

2.pins_*

There are up to eight separate pins_* sections, namely: (최대 8개의 별도의 pins_* 섹션이 있으며, 이름은: )

    pins_rev1 Rev1 pin setup. There are some difference because of the moved I2C pins

    pins_rev2 Rev2 pin setup. This includes the additional codec pins on P5

    pins_bplus1 Model B+ rev 1.1, including the full 40pin connector

    pins_bplus2 Model B+ rev 1.2, swapping the low-power and lan-run pins

    pins_aplus Model A+, lacking Ethernet

    pins_2b1 Pi 2 Model B rev 1.0, controls the SMPS via I2C0

    pins_2b2 Pi 2 Model B rev 1.1, controls the SMPS via software I2C on 42&43

    pins_cm The Compute Module, note the default for this is the default for the chip so can be a useful source of information about default pullups / downs on the chip.

Each pins_* section can contain pin_config and pin_definessections.

각각의 pins_*  섹션은 pin_config  pin_defines 섹션을 포함할 있다.

3. pin_config

The pin_config section is used to configure the individual pins, each item in this section must be a named pin section, such as pin@p32 meaning GPIO32. There is a special section pin@default which has the default settings for anything not specifically named in the pin_config section.

pin_config 섹션은 개별 핀들의 환경 설정을 위해 사용되어지며, 섹션의 아이템들은 반드시 GPIO32 의미하는 pin@p32  같은 형식으로 이름이 붙여져야 한다. 특별한 섹션인 pin@default pin_config 섹션내에 특별하게 이름이 붙여지지 않는 기본 설정을 갖는다.

 

4. pin@pinname

This section can contain any combination of the following items

(1)polarity

o      active_high

o      active_low

(2)termination

o      pull_up

o      pull_down

o      no_pulling

(3)startup_state

o      active

o      inactive

(4)function

o      input

o      output

o      sdcard

o      i2c0

o      i2c1

o      spi

o      spi1

o      spi2

o      smi

o      dpi

o      pcm

o      pwm

o      uart0

o      uart1

o      gp_clk

o      emmc

o      arm_jtag

(5) drive_strength_ma The drive strength is used to set a strength for the pins, please note you can only set the bank to a single drive strength. <8> <16> are valid values

 

 

5. pin_defines

This section is used to set specific videocore functionality to particular pins, this enables the user to move the camera power enable pin to somewhere different or the hdmi hotplug postion (i.e. things that linux have no control over). Please refer to the example dts file below

섹션은 특정 핀에 특정 비디오코어 기능을 설정하는 사용됩니다. 이것은 카메라 파워 설정 핀이나 hdmi hotplug 위치 어딘가 다른곳으로 이동하는 것을 가능하게 합니다.(, 리눅스에서는 콘트롤하지 않는 일임) 아래의 예제 dts 파일을 참조해 주세요.

 

CLOCK CONFIGURATION

It is possible to change the configuration of the clocks through this interface, although very difficult to predict the results! The configuration of the clocking system is very very complex, there are five separate PLLs each one has its own fixed (or variable in the case of PLLC) VCO frequency. Each VCO then has a number of different channels which can be set up with a different division of the VCO frequency. Then each of the clock destinations can then be configured to come from one of the clock channels (although there is a restricted mapping of source to destination so not all channels can be routed to all clock destinations).

인터페이스를 통해서 비록 결과를 예측하는 것이 매우 어렵지만 클럭 확경 설정을 변경하는 것이 가능합니다. 시스템 클럭킹의 환경설정은 매우 매우 복잡하며, 다섯개의 구분된 PLL들이 있으며 각각은 VOC 주파수로 고정됩니다.(또는 PLLC 경우에서는 변수) 각각 VCO VOC 주파수의 다른 부문으로 설정될 있는 다른 채널의 수를 갖습니다. 클럭 각각의 목적지는 클럭 채널중 하나로부터 나오도록 환경 설정될수 있습니다.(비록 목적지에 소스의 제한된 맵핑이 있지만, 모든 채널은 모든 클럭 목적지에 라우팅될 없습니다.)  - 무슨 말인지 이해 못하겠음.??

 

 For this reason I'll just add here a couple of example configurations that you can use to alter very specific clocks. Beyond this it is something we'll add to when requests for clock configurations are made.

이러한 이유 때문에, 매우 특별한 클럭을 변경하는데 사용될 있는 환경설정 예제 가지를 여기에 추가할 것입니다. 외에도 클럭 환경설정을 위해서 만드는 것이 요청될 추가할 것입니다.

clock_routing {
   vco@PLLA  {    freq = <1966080000>; };
   chan@APER {    div  = <4>; };
   clock@GPCLK0 { pll = "PLLA"; chan = "APER"; };
};
 
clock_setup {
   clock@PWM { freq = <2400000>; };
   clock@GPCLK0 { freq = <12288000>; };
   clock@GPCLK1 { freq = <25000000>; };
};

 

The above will set the PLLA to a source VCO running at 1.96608GHz (the limits for this VCO are 600MHz - 2.4GHz), the APER channel to /4 and configures GPCLK0 to be sourced from PLLA through APER. This is used specifically to give an audio codec the 12288000Hz it needs to do the 48000 range of frequencies.

위에서 1.96608GHz( VCO 대한 한계는 600MHz-2.4GHz) 동작하는 소스 VCO PLLA 설정하고, PLLA 소스로하여 APER 채널을 4 나누고 이를 GPLCLK0 환경설정한다. 이것은 48000 주파수 범위를 하기 위해 필요로 하는 오디오 코덱 12288000Hz 인가하기 위해 특별하게 사용됩니다.

 

SAMPLE DEVICE TREE SOURCE FILE

NOTE: As this is a new feature, there is no reference dts file which is guaranteed to be supported by future firmware revisions.

(참고) 이것은 새로운 기능이기 때문에 미래 펌웨어 리비전에 의해 지원되는 보장된 참조용 dts 아닙니다.

The dts file used for the dtb compiled into the May 30th 2015 firmware can be downloaded from here.

dts 파일은 2015 530일자 펌웨어를 컴파일한 dtb 사용되어진다.

 

Posted by 이미지쿡

( Hardware 정보 )


Raspberry Pi compute Module Development kit


라즈베리파이의 동작 원리를 이해 하려면 우선 Compute Module를 사용해 보는 것을 권장합니다. 이유는 우선 H/W와 S/W에 대한 설명이 잘 되어 있기 때문입니다. 특히 회로도, BOM(부품 리스트) 거버파일, 주변회로를 연결하는데 필요한 가이드등이 제공 되므로 GPIO를 설정하거나 활용하는데 큰 도움이 됩니다.


H/W는  (1) Comput Module과(하늘색) (2) I/O board(노란색)로 구성됩니다.


(상세 설명) Raspberry Pi compute Module Development kit


(1) Compute Module 보드는 SoDIMM Type에 조립되어 있으며 6Layer PCB로 구성 되어 있습니다.

 

SODIMM Type으로 구성된 이유는 바로 탈부착이 용이 하도록 하기 위함이나 실제로는 (이건 개인적인 생각입니다만) 1G DRAM과 BCM2835가 SOC type로 제작되어 있고, 이것을 일반인에게 팔지 않고, 모듈 type을 제작하여 팔기 위한것 같습니다. 가격이 25$ 이며(2017.1월 기준) 새로나온 CM3(위의 기준은 CM1)는 30$(배송비,세금불포함) 입니다.

(참고 자료_ CM1 vs CM3 vs CM3 Lite 비교 )

 


(2) I/O Board 전체에 대한 Design Data가 open 되어 있으므로 활용가치가 높다고 할 수 있습니다.

* Schematics Source 위치

* 거버 및 BOM List Source 위치

 

 

아쉽게도 BOM List는 I/O 보드만 있고 Compute Module은 없습니다. 회로도를 참고해야 합니다.

주요 부품들의 위치는 아래와 같습니다.

 

 

 

 

 

 

무엇보다 아쉬운 것은 시중에서 BCM2835와 4G eMMC를 구할 수 없으며, 회로, BOM,거버 정보가 있다하더라도(물론 회로도만 있습니다.) 실제로 제작할 수 없는 문제가 있습니다.

 

 

Posted by 이미지쿡

Raspberry Pi 모델별 비교 및

 BCM2835 정보

 

라즈베리파이를 활용하는 사람들을 둘로 나눠 보라고 하면, 사서 쓰는 사람과 오픈된   Schematic을 응용하여 새롭게 제작하려는 사람으로 나눌수 있을 것입니다.

 

여기서 정리하고 싶은 부분은 후자를 위한 것으로 신규로 보드를 만들고 싶다면

라즈베리파이에 들어가는 SoC(Broadcom BCM2835, 2836, 2837)에 대해서 이해하는 것은 필수 입니다. (아래 테이블 참조)

 

 

 

Raspberry Pi 2 (BCM2836), Pi3(BCM2837)을 제외한 모든 제품(5개)에 들어 가는 SoC(CPU,GPU,DRAM)는 BCM2835입니다.

 

BCM2835은 BCM2836,2837에 비해 속도나 성능이 떨어지지만 DRAM이 함께 들어가 있어서 작게 만드는데 매우 유리합니다.  (PoP stack)

 

무료로 제공하는 OS를 활용하므로 특별하게 수정할 부분도 없으며, H/W만 잘 만든면 어떠한 활용도 가능합니다.

 

결국, BCM2835 Pinout만 안다면 여러가지 형태로 변형이 가능합니다. 문제는 package에 대한 spec이 있어야 하는데 이부분이 빠져있다는 것입니다.(datasheet참조) (Ball/pin pitch 정보 - PCB 제작시 반드시 필요)

 

다행히도 DXF 파일 오픈해 놓았습니다. 이것을 측정해 보면 Ball size와 각종 규격을 확인할 수 있습니다.

 

 

 

 

 

 

Posted by 이미지쿡
이전버튼 1 2 이전버튼

블로그 이미지
Raspberry pi 카메라로 영화 매트릭스 처럼 촬영하기
이미지쿡

공지사항

Yesterday
Today
Total