ラズパイマガジン2017年10月号の拡張ボードHATを作ろうをやってみた

 

ラズパイマガジンの2017年10月号の「拡張ボードHATを作ろう」の記事をやってみた

本の通りにやると図23の通りデバイスツリーソースをコンパイルしても図24のようにならなかった。spiが認識されていない

このことを出版社に問い合わせた。しかし返事は来たがわからないとのことだった

そのため自分で対策を立てることにした

3週間に渡るトライアンドエラーの結果ついに出来た

バイスツリーソースを以下のようにするとspiが認識されdhtカーネルドライバが動くように出来た

 

/dts-v1/;/dts-v1/;
/ { compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 { target-path = [2f 00];
__overlay__ {
dht11@0 { compatible = "dht11"; pinctrl-names = "default"; pinctrl-0 = <0x1>; gpios = <0xdeadbeef 0x4 0x0>; status = "okay"; phandle = <0x2>; }; }; };
fragment@1 { target = <0xdeadbeef>;
__overlay__ {
dht11_pins { brcm,pins = <0x4>; brcm,function = <0x0>; brcm,pull = <0x0>; phandle = <0x1>; }; }; };
fragment@2 { target = <0xdeadbeef>;
__overlay__ { cs-gpios = <0x0 0x0>; status = "okay"; }; };
fragment@3 { target = <0xdeadbeef>;
__overlay__ { brcm,pins = <0x8 0x7>; brcm,function = <0x4>; }; };
__overrides__ { gpiopin = <0x1 0x6272636d 0x2c70696e 0x733a3000 0x2 0x6770696f 0x733a3400>; };
__symbols__ { dht11 = "/fragment@0/__overlay__/dht11@0"; dht11_pins = "/fragment@1/__overlay__/dht11_pins"; };
__local_fixups__ {
fragment@0 {
__overlay__ {
dht11@0 { pinctrl-0 = <0x0>; }; }; };
__overrides__ { gpiopin = <0x0 0x10>; }; };
__fixups__ { gpio = "/fragment@0/__overlay__/dht11@0:gpios:0", "/fragment@1:target:0"; spi0 = "/fragment@2:target:0"; spi0_cs_pins = "/fragment@3:target:0"; };};

あとは本の通りにコンパイルしeepromに書き込みrebootすれば図24のようになる

 f:id:raspberrypi1:20180106033031j:plain