<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>espeink &#8211; JunkHack Feed</title>
	<link>/</link>
	<description>アリエクでポチった JUNKHACK</description>
	<lastBuildDate>Fri, 01 Jan 2016 17:56:05 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>/wp-content/uploads/2020/09/logo.png</url>
	<title>espeink &#8211; JunkHack</title>
	<link>/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>1us Lチカ</title>
		<link>/2016/01/02/post-1973.html</link>
		
		<dc:creator><![CDATA[JunkHack]]></dc:creator>
		<pubDate>Fri, 01 Jan 2016 17:56:05 +0000</pubDate>
				<category><![CDATA[Aliexpress]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[espeink]]></category>
		<category><![CDATA[OrangePi]]></category>
		<category><![CDATA[OrangePiPC]]></category>
		<guid isPermaLink="false">/?p=1973</guid>
							<description><![CDATA[2016年 謹賀新年、あけましておめでとうございます。おせち料理も31日と1日で食べつくしてしまいました。 さて、今年最初のブログですね。0.000001秒のLチカをロジックアナライザーでモニタリングして光らせてみました [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>2016年 謹賀新年、あけましておめでとうございます。おせち料理も31日と1日で食べつくしてしまいました。</p>
<p>さて、今年最初のブログですね。0.000001秒のLチカをロジックアナライザーでモニタリングして光らせてみました。</p>
<p>あと、オレンジパイで、8本のGPIO を使って安価なロジックアナライザーで採取できるかも確認してみました。</p>
<p>&#160;</p>
<p>サンプルプログラムを採取したデータが以下です。8本分は取れていますが、速すぎるところは取りこぼしているようです。</p>
<p><img loading="lazy" decoding="async" title="1" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="1" src="/wp-content/uploads/2016/01/1.png" width="640" height="319" /> </p>
<p>矢印は500ns で光っている部分で採取に失敗し、取りこぼす事がありました。このあたりが2Mhz の限界なんですね。今のファームウェアとソフトウェアだとこれが限界のようです。</p>
<p><img loading="lazy" decoding="async" title="2" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="2" src="/wp-content/uploads/2016/01/2.png" width="640" height="320" /> </p>
<p>複数のLED は、blink ファンクションにて光らせていますが、呼び出しと初期化の処理で250us 程度使っているようです。</p>
<p><img loading="lazy" decoding="async" title="3" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="3" src="/wp-content/uploads/2016/01/3.png" width="640" height="320" /> </p>
<p>usleep 関数を使っても思ったより、処理に時間がかかるようです。1us を指定して光らせているんですが、実際は69us 光っています。nanosleep を使っても66us は使われてしまうようで、1us を光らせる為にwhile で調整してみました。</p>
<p><img loading="lazy" decoding="async" title="4" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="4" src="/wp-content/uploads/2016/01/4.png" width="640" height="319" /> </p>
<p>サンプルのプログラムは以下です。</p>
<pre class="brush: cpp; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">/*
 *  +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+
 *  | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 *  +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 *  |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 *  |   2 |  -1 |    SDA.0 |      |   |  3 || 4  |   |      | 5V       |     |     |
 *  |   3 |  -1 |    SCL.0 |      |   |  5 || 6  |   |      | 0v       |     |     |
 *  |   4 |   6 | IO6 PA06 |  OUT | 0 |  7 || 8  |   |      | TxD3     |     |     |
 *  |     |     |       0v |      |   |  9 || 10 |   |      | RxD3     |     |     |
 *  |  17 |  -1 |     RxD2 |      |   | 11 || 12 | 0 | OUT  | IO1 PD14 | 1   | 18  |
 *  |  27 |  -1 |     TxD2 |      |   | 13 || 14 |   |      | 0v       |     |     |
 *  |  22 |  -1 |     CTS2 |      |   | 15 || 16 | 0 | OUT  | IO4 PC04 | 4   | 23  |
 *  |     |     |     3.3v |      |   | 17 || 18 | 0 | OUT  | IO5 PC07 | 5   | 24  |
 *  |  10 |  -1 |     MOSI |      |   | 19 || 20 |   |      | 0v       |     |     |
 *  |   9 |  -1 |     MISO |      |   | 21 || 22 |   |      | RTS2     |     |     |
 *  |  11 |  -1 |     SCLK |      |   | 23 || 24 |   |      | SPI-CE0  |     |     |
 *  |     |     |       0v |      |   | 25 || 26 |   |      | CE1      |     |     |
 *  |   0 |  -1 |    SDA.1 |      |   | 27 || 28 |   |      | SCL.1    |     |     |
 *  |   5 |   7 |  IO7 PA7 |  OUT | 0 | 29 || 30 |   |      | 0v       |     |     |
 *  |   6 |   8 |  IO8 PA8 |  OUT | 0 | 31 || 32 | 0 | OUT  | IO9 PG08 | 9   | 12  |
 *  |  13 |  10 | IO10 PA9 |  OUT | 0 | 33 || 34 |   |      | 0v       |     |     |
 *  |  19 |  12 | IO12PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | IO13PG09 | 13  | 16  |
 *  |  26 |  14 | IO14PA20 | ALT3 | 0 | 37 || 38 | 0 | OUT  | IO15PG06 | 15  | 20  |
 *  |     |     |       0v |      |   | 39 || 40 | 0 | OUT  | IO16PG07 | 16  | 21  |
 *  +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 *  | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 *  +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+
 *         ^^^^ Pin NO                                                   ^^^^ Pin NO
 * 1us LED blink.
 * building ex) gcc -lwiringPi -lpthread -I/usr/local/include -L/usr/local/lib -levent -o 2016blinkall 2016blinkall.c
 * 
 *
*/
#include &lt;sys/time.h&gt;
#include &lt;time.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;
#include &lt;wiringPi.h&gt;

#define MSEC 1
#define USEC 33
#define NANOSEC 1000

int blink2(int led, int delay);

int main (void)
{
  int led;
  int i = 0;

  while (i &lt; 3)
  {
    blink2(16, 1000);
      blink2(15, 1000); //Next blink 250 us
      blink2(13, 1000);
      blink2(9, 1000);
      blink2(5, 1000);
      blink2(4, 1000);
      blink2(1, 1000);
      blink2(6, 1000);

    i++;
  }

  delay (MSEC);
  return 0;
}

int blink2(int led, int delay){
    // unsigned int usecs;
    // usecs = delay;
    // sec = delay;
    led = led;
    int i = 0;

    // nano sec
    struct timespec nano;
    nano.tv_sec = 0;
    nano.tv_nsec = delay;

    wiringPiSetup () ;
    pinMode (led, OUTPUT) ;

    digitalWrite (led, HIGH) ;
    nanosleep(&amp;nano, NULL); // 66us
    // usleep (usecs) ; // 66us
    // delay (delay);
    digitalWrite (led,  LOW) ;
    usleep (1);

    digitalWrite (led, HIGH) ;

    // 1us
    while (i &lt; 100)
    {
        i++;
    }
    digitalWrite (led,  LOW) ;
    usleep (1); // 66us

    digitalWrite (led, HIGH) ;
    // 500 ns
    digitalWrite (led,  LOW) ;
}</pre>
<p>GPIO の8本を同時に処理させるにはどうしたらいいんでしょうかね。マルチスレッド処理ですかね？シフトレジスタに投げて、一括処理とかですかね？</p>
<p>&#160;</p>
<p>前ちょっと触ったイベント処理のlibevent とかを使うとどのくらいの精度になるんでしょうかね。いろいろ疑問がわいてきます。</p>
<p>E-ink を表示するためにはまだまだ超えないといけない山がたくさんあるようです。</p>
<p>なんとか、春までには表示したいんですが。こつこつとやっていきます。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>FX2LP でsigrok のロジックアナライザー</title>
		<link>/2015/12/27/post-1946.html</link>
		
		<dc:creator><![CDATA[JunkHack]]></dc:creator>
		<pubDate>Sun, 27 Dec 2015 12:26:13 +0000</pubDate>
				<category><![CDATA[Aliexpress]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[espeink]]></category>
		<category><![CDATA[OrangePi]]></category>
		<category><![CDATA[OrangePiPC]]></category>
		<category><![CDATA[Parts]]></category>
		<guid isPermaLink="false">/?p=1946</guid>
							<description><![CDATA[年末で、何かとイベントごとがあってなかなかブログを更新できずにいました。 Aliexpress からもどんどんお品が届いて、ロジックアナライザーとして使うボードも到着しました。テストがてら、OrangePi PC の G [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>年末で、何かとイベントごとがあってなかなかブログを更新できずにいました。</p>
<p>Aliexpress からもどんどんお品が届いて、ロジックアナライザーとして使うボードも到着しました。テストがてら、OrangePi PC の GPIO につないだLED のタイミングを計測してみること。</p>
<p>配線は、とりあえず1チャンネルでテスト。全部で8チャンネルいけます。</p>
<p><img loading="lazy" decoding="async" title="logic2" style="float:none;margin-left:auto;display:block;margin-right:auto;border-width:0;" border="0" alt="logic2" src="/wp-content/uploads/2015/12/logic2.jpg" width="640" height="480" /> </p>
<p>ちょっとわかりにくいですが、PB0 ～ PB7 までの端子が sigrok でいう0から7 までに対応しています。とりあえず今回はPB0 の端子につないで1チャンネルの表示をしてみました。</p>
<p><img loading="lazy" decoding="async" title="PulseView1" style="float:none;margin-left:auto;display:block;margin-right:auto;border-width:0;" border="0" alt="PulseView1" src="/wp-content/uploads/2015/12/pulseview1.png" width="640" height="445" /> </p>
</p>
<p>全体のテスト配線は以下のような感じです。</p>
<p>&#160;</p>
<p> <img loading="lazy" decoding="async" title="logic" style="float:none;margin-left:auto;display:block;margin-right:auto;border-width:0;" border="0" alt="logic" src="/wp-content/uploads/2015/12/logic.jpg" width="640" height="480" />   </p>
<p>osx だと sigrok のソフトウェアの中にファームウェアがあります。最新のファームウェアは、以下にビルド済みのものがあります。</p>
<blockquote>
<p>fx2lafw (pre-built firmware files の項を参照)      <br /><a title="http://sigrok.org/wiki/Fx2lafw" href="http://sigrok.org/wiki/Fx2lafw" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right"><a href="http://sigrok.org/wiki/Fx2lafw">http://sigrok.org/wiki/Fx2lafw<span class="wpel-icon wpel-image wpel-icon-1"></span></a></a></p>
</blockquote>
<p>つい先月にリリースされている0.1.3 を使いました。</p>
<blockquote>
<p>sigrok-firmware-fx2lafw-bin-0.1.3.tar.gz</p>
<p><a title="http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/" href="http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right"><a href="http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/">http://sigrok.org/download/binary/sigrok-firmware-fx2lafw/<span class="wpel-icon wpel-image wpel-icon-1"></span></a></a></p>
</blockquote>
<p>ほどよく、配置。*.fw がファームウェアです。</p>
<pre class="brush: cpp; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">HOPE:sigrok-firmware junkhack$ pwd
/Applications/PulseView.app/Contents/share/sigrok-firmware
HOPE:sigrok-firmware junkhack$ ll
total 1088
-rw-r--r--@ 1 junkhack  admin  45268 11  3  2014 asix-sigma-100.fw
-rw-r--r--@ 1 junkhack  admin  45396 11  3  2014 asix-sigma-200.fw
-rw-r--r--@ 1 junkhack  admin  45396 11  3  2014 asix-sigma-50.fw
-rw-r--r--@ 1 junkhack  admin  45360 11  3  2014 asix-sigma-50sync.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-braintechnology-usb-lps.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-cwav-usbeeax.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-cwav-usbeedx.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-cwav-usbeesx.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-cypress-fx2.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-saleae-logic.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-sigrok-fx2-16ch.fw
-rw-r--r--@ 1 junkhack  admin   8120 11 27 09:09 fx2lafw-sigrok-fx2-8ch.fw
-rw-r--r--@ 1 junkhack  admin  81808 11  3  2014 sysclk-lwla1034-extneg.rbf
-rw-r--r--@ 1 junkhack  admin  81808 11  3  2014 sysclk-lwla1034-extpos.rbf
-rw-r--r--@ 1 junkhack  admin  81460 11  3  2014 sysclk-lwla1034-int.rbf
-rw-r--r--@ 1 junkhack  admin  48521 11  3  2014 sysclk-lwla1034-off.rbf
HOPE:sigrok-firmware junkhack$ </pre>
</p>
<p>sigrok の PluseView を開きます。</p>
<p>現在、手元でビルドしていないので、ELIAS さんのビルドしたものです。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>開発ボードがコハクラフトさんより到着</title>
		<link>/2015/12/04/post-1824.html</link>
		
		<dc:creator><![CDATA[JunkHack]]></dc:creator>
		<pubDate>Fri, 04 Dec 2015 10:06:19 +0000</pubDate>
				<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[espeink]]></category>
		<category><![CDATA[PCB]]></category>
		<guid isPermaLink="false">/?p=1824</guid>
							<description><![CDATA[kohacraftさんよりE-ink の開発ボードが到着しました。ありがとうございます。 PINヘッダーがあるので、自由に信号を入れ放題！電源部は、LT1945 から供給。コイルは、Coilcraft さぁ、うまく表示で [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://kohacraft.com/tag/%E9%9B%BB%E5%AD%90%E3%83%9A%E3%83%BC%E3%83%91%E3%83%BC" target="_blank" rel="noopener noreferrer external" data-wpel-link="external" class="wpel-icon-right">kohacraft<span class="wpel-icon wpel-image wpel-icon-1"></span></a>さんよりE-ink の開発ボードが到着しました。ありがとうございます。</p>
<p><a href="/wp-content/uploads/2015/12/a3.jpg" target="_blank" rel="noopener noreferrer" data-wpel-link="internal"><img loading="lazy" decoding="async" title="a" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="a" src="/wp-content/uploads/2015/12/a_thumb1.jpg" width="640" height="480" /></a></p>
<p>PINヘッダーがあるので、自由に信号を入れ放題！電源部は、LT1945 から供給。コイルは、Coilcraft</p>
<p><a href="/wp-content/uploads/2015/12/b1.jpg" target="_blank" rel="noopener noreferrer" data-wpel-link="internal"><img loading="lazy" decoding="async" title="b" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="b" src="/wp-content/uploads/2015/12/b_thumb1.jpg" width="640" height="480" /></a></p>
<p>さぁ、うまく表示できるでしょうか。</p>
<p><a href="/wp-content/uploads/2015/12/scan21.png" target="_blank" rel="noopener noreferrer" data-wpel-link="internal"><img loading="lazy" decoding="async" title="Scan 2" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="Scan 2" src="/wp-content/uploads/2015/12/scan2_thumb.png" width="638" height="563" /></a>実験にあたり、まだ下準備が整っていないのでそこから着手しないとです。</p>
<p>まずは、ESP8266 から信号を入れるため、ESP側の開発ボードの半田付けをして、シフトレジスターを用意する作業があります。 ご飯食べて、気力を回復させてから、本日は何か１つ作業を進めたいです。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>RasPi2 でCの王道？ WiringPi</title>
		<link>/2015/12/04/post-1811.html</link>
					<comments>/2015/12/04/post-1811.html#comments</comments>
		
		<dc:creator><![CDATA[JunkHack]]></dc:creator>
		<pubDate>Thu, 03 Dec 2015 21:28:35 +0000</pubDate>
				<category><![CDATA[espeink]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">/?p=1811</guid>
							<description><![CDATA[とりあえず、RasPi でC を検索したら一番最初にヒットしたので、これで。 オフィシャル http://wiringpi.com/ GITHUB https://github.com/WiringPi Ruby や P [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>とりあえず、RasPi でC を検索したら一番最初にヒットしたので、これで。</p>
<blockquote>
<p>オフィシャル     <br /><a title="http://wiringpi.com/" href="http://wiringpi.com/" target="_blank" rel="noopener noreferrer external" data-wpel-link="external" class="wpel-icon-right">http://wiringpi.com/<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
<p>GITHUB</p>
<p><a title="https://github.com/WiringPi" href="https://github.com/WiringPi" target="_blank" rel="noopener noreferrer external" data-wpel-link="external" class="wpel-icon-right">https://github.com/WiringPi<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
</blockquote>
<p>Ruby や PHP やPython などのラッパーもあるようです。とりあえず、c で。</p>
<p>&#160;</p>
<p>インストールは、INSTALL か、オフィシャルサイトのドキュメントのように。build スクリプトがあります。</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi wiringPi 12/04 05:34:23]# ./build 
wiringPi Build script
=====================


WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] piHiPri.c
[Compile] wiringShift.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] softPwm.c
[Compile] wiringPiI2C.c
[Compile] softTone.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] pcf8574.c
[Compile] sr595.c
[Compile] mcp3002.c
[Compile] pcf8591.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Compile] wpiExtensions.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
[Compile] readall.c
[Compile] pins.c
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

[root@pi wiringPi 12/04 05:38:22]# gpio -v
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest 
  Device tree is enabled.
  * Root or sudo required for GPIO access.
[root@pi wiringPi 12/04 05:38:41]# </pre>
<p>こんな感じになりました。</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi wiringPi 12/04 05:38:45]# gpio -v
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest 
  Device tree is enabled.
  * Root or sudo required for GPIO access.
[root@pi wiringPi 12/04 05:38:46]# </pre>
<p>というバージョンを使っています。Gordon Hendersonさんが作られてたようです。感謝。</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi work 12/04 06:17:08]# gpio -warranty
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Leser General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.

[root@pi work 12/04 06:17:14]# </pre>
<p>とりあえず、使ってみます。</p>
<p><img loading="lazy" decoding="async" title="a" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="a" src="/wp-content/uploads/2015/12/a2.jpg" width="584" height="778" /> </p>
<p>いつもPIN番号を忘れて検索します。貼り付けておくことに。ラズパイのピン。</p>
<p><img loading="lazy" decoding="async" title="Raspberry-Pi-GPIO-compressed" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="Raspberry-Pi-GPIO-compressed" src="/wp-content/uploads/2015/12/raspberrypigpiocompressed.jpg" width="640" height="463" /> </p>
<p>コードは以下。</p>
<pre class="brush: cpp; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">// Include header file
#include &lt;wiringPi.h&gt;

// Define GPIO21 number
#define LED 21

// Main function
int main(void) {
        int i;

        // Initialize WiringPi
        if(wiringPiSetupGpio() == -1) return 1;

        // Set GPIO pin to output mode
        pinMode(LED, OUTPUT);

        // Repeat LED blinking 10 times
        for(i=0; i&lt;100; i++){
                digitalWrite(LED, 0);
                delay(100);
                digitalWrite(LED, 1);
                delay(100);
        }

        // Turn off LED
        digitalWrite(LED, 0);

        return 0;
}</pre>
<p>コンパイル、実行。</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[pi@pi work]$ gcc -o blink blink.c -lwiringPi
[pi@pi work]$ sudo ./blink</pre>
<p>終了すると、プロンプトに戻ります。RasPi のGPIOはたくさんあるので、同時にいくつ使えるんでしょうね。</p>
<p>&#160;</p>
<p>シフトレジスターを経由しなくても、今回、15本のGPIOを使えればよさそうですが、</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi work 12/04 06:26:32]# gpio readall
 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | OUT  | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | ALT0 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | ALT0 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | OUT  | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
[root@pi work 12/04 06:26:33]# </pre>
<p>このテーブルのwPi というのがアサインされている番号ですかね。</p>
<p>マニュアルだと、以下のようです。1 でON（点灯） 0でOFF（消灯）</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi work 12/04 06:32:40]# gpio -g write 21 1 
[root@pi work 12/04 06:33:56]# gpio -g write 21 0</pre>
<p>とりあえず、使えそうですね。あとは、プログラムの問題となります。さぁて、本日金曜日。お仕事終わればまた開発タイムです。</p>
<p>examples ディレクトリに参考コードがたくさんあります。</p>
<pre class="brush: bash; gutter: false; toolbar: false; collapse: true; auto-links: false; smart-tabs: false;">[root@pi examples 12/04 06:41:26]# pwd
/home/pi/wiringPi/examples
[root@pi examples 12/04 06:41:28]# 
[root@pi examples 12/04 06:41:29]# tree
.
├── blink12.c
├── blink12drcs.c
├── blink6drcs.c
├── blink8.c
├── blink.c
├── blink.rtb
├── blink.sh
├── clock.c
├── COPYING.LESSER
├── delayTest.c
├── ds1302.c
├── Gertboard
│&#160;&#160; ├── 7segments.c
│&#160;&#160; ├── buttons.c
│&#160;&#160; ├── gertboard.c
│&#160;&#160; ├── Makefile
│&#160;&#160; ├── record.c
│&#160;&#160; ├── temperature.c
│&#160;&#160; ├── voltmeter.c
│&#160;&#160; └── vumeter.c
├── header.h
├── isr.c
├── isr-osc.c
├── lcd-adafruit.c
├── lcd.c
├── lowPower.c
├── Makefile
├── max31855.c
├── nes.c
├── okLed.c
├── PiFace
│&#160;&#160; ├── blink.c
│&#160;&#160; ├── buttons.c
│&#160;&#160; ├── ladder.c
│&#160;&#160; ├── Makefile
│&#160;&#160; ├── metro.c
│&#160;&#160; ├── motor.c
│&#160;&#160; └── reaction.c
├── PiGlow
│&#160;&#160; ├── Makefile
│&#160;&#160; ├── piGlow0.c
│&#160;&#160; ├── piGlow1.c
│&#160;&#160; └── piglow.c
├── pwm.c
├── q2w
│&#160;&#160; ├── binary.c
│&#160;&#160; ├── blink.c
│&#160;&#160; ├── blink-io.c
│&#160;&#160; ├── blink.sh
│&#160;&#160; ├── bright.c
│&#160;&#160; ├── button.c
│&#160;&#160; ├── Makefile
│&#160;&#160; └── volts.c
├── README.TXT
├── rht03.c
├── serialRead.c
├── serialTest.c
├── servo.c
├── softPwm.c
├── softTone.c
├── speed.c
├── spiSpeed.c
└── wfi.c

4 directories, 59 files
[root@pi examples 12/04 06:41:32]# </pre>
<p>&#160;</p>
<p>コハクラフトさんからも発送されたようで、土日にはなんらか楽しめそうです。</p>
]]></content:encoded>
					
					<wfw:commentRss>/2015/12/04/post-1811.html/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>E-inkディスプレイでテスト準備</title>
		<link>/2015/12/02/post-1793.html</link>
		
		<dc:creator><![CDATA[JunkHack]]></dc:creator>
		<pubDate>Tue, 01 Dec 2015 15:09:58 +0000</pubDate>
				<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[espeink]]></category>
		<category><![CDATA[Parts]]></category>
		<guid isPermaLink="false">/?p=1793</guid>
							<description><![CDATA[さて、年末に向けてE-ink を表示するテストが出来そうなので、その準備をしています。 開発ボードは、ブログで先駆者がいらっしゃって、なんと開発ボードを分けていただくことになりました。ありがとうございます。 kohacr [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>さて、年末に向けてE-ink を表示するテストが出来そうなので、その準備をしています。</p>
<p>開発ボードは、ブログで先駆者がいらっしゃって、なんと開発ボードを分けていただくことになりました。ありがとうございます。</p>
<blockquote>
<p>kohacraftのblog      <br />タグ：電子ペーパー</p>
</blockquote>
<p>E-ink ディスプレイのコネクタはPCB上につけないと無理な配線なので、電源部とコネクタから構成される開発ボードを作られていました。こちらは、まだPCB作ってないのでテストできていない旨をブログでコメントしたところ、好意で開発ボードを分けていただくことになりました。コハクラフトさま、本当にありがとうございます。E-ink のPCB発注は来年かぁと思っていたので、年末に遊べそうです。</p>
<p>&#160;</p>
<p>以下の回路図は、sprite_tm さんのページにある手書きのものをトレースしたものです。配線するときの覚書としてメモしておくことに。</p>
<p><a href="/wp-content/uploads/2015/12/2_schematic_eink.png" target="_blank" rel="noopener noreferrer" data-wpel-link="internal"><img loading="lazy" decoding="async" title="2_Schematic_e-ink" style="border-top:0;border-right:0;border-bottom:0;float:none;margin-left:auto;border-left:0;display:block;margin-right:auto;" border="0" alt="2_Schematic_e-ink" src="/wp-content/uploads/2015/12/2_schematic_eink_thumb.png" width="640" height="356" /></a> ただいま、コハクラフト開発ルームにてハンドメイドで半田付けが行われている最中です。こちらは、シフトレジスタ部とESP側の準備をしています。そして、先に発注してあるロジックアナライザーも今年中に来ると思いますので、どんな手順を踏めば表示されるのかを解き明かしていきたいと思います。</p>
<p>&#160;</p>
<p>英語ソースでは先人がいるのですが、まだ要点がつかめず、ポイントの要になる部分がわかりません。コハクラフトさんのブログでいくつか解き明かされて、ソニーのdigital book reader PRS-600 本体にE-ink を挿げ替えても表示が可能だそうです。Sony のE-ink には、LB060S01-RD02 という型番のE-ink で、今回手持ちで流通している、ED060SC4(LF)を繋げても表示できるということがわかっています。上の回路図では、9pin , 10pin は繋がっていますが、そこはポイントではなさそうということが状況から言えそうです。</p>
<p>要するに、E-ink に入れる信号のタイミングがポイントになることは間違いなさそうです。</p>
<p>今回しょっぱなにテストしようとしているソースは、   <br /><a title="https://github.com/take-i/espeink/blob/master/user/eink.c" href="https://github.com/take-i/espeink/blob/master/user/eink.c" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right">https://github.com/take-i/espeink/blob/master/user/eink.c<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
<p>で、各所にos_timer_armでタイミングをを取っている部分がいくつかあります。その関数を集約したものが、</p>
<p><a title="https://github.com/take-i/espeink/blob/master/user/io.c" href="https://github.com/take-i/espeink/blob/master/user/io.c" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right">https://github.com/take-i/espeink/blob/master/user/io.c<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
<p>にあり、ここにもタイミングとっている部分、os_delay_us がいくつかあります。このあたりをいじって、どのような挙動だと表示され、あるいは、されないのかという根本原理を探ってみたいと思います。</p>
<p>&#160;</p>
<p>果たして、以下の３つのページでは何を言おうとしているのか？</p>
<blockquote>
<p><a href="http://essentialscrap.com/eink/electronics.html" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right">http://essentialscrap.com/eink/electronics.html<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
<p><a href="http://essentialscrap.com/eink/waveforms.html" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right">http://essentialscrap.com/eink/waveforms.html<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
<p><a href="http://spritesmods.com/?art=einkdisplay&amp;page=3" data-wpel-link="external" target="_blank" rel="external noopener noreferrer" class="wpel-icon-right">http://spritesmods.com/?art=einkdisplay&amp;page=3<span class="wpel-icon wpel-image wpel-icon-1"></span></a></p>
</blockquote>
<p>読んでいるだけでは、いまいちピンときません。実機を交え、１つづつ噛み砕いてみたいと思います。そして、次のE-ink ディスプレイにも応用できるノウハウが得られればと思っています。一番やりたいのは、フレキシブルなE-ink への表示です。まだ、モノがこなれていないので、入手方法がわからずですが、数年経てば入手経路も確立されてくるだろうと思っています。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
