embeded/raspberry pi2015. 9. 4. 18:44

pigpio 라는 다른 라이브러리가 존재한다.

[링크 : http://abyz.co.uk/rpi/pigpio/examples.html]


라즈베리 B 인거 같은데..

출력은 22Mhz 까지(단순하게 on/off만) 가능

[링크 : http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/]


아무튼..

TSL235R 라는 녀석이 결과물이 주파수로 나와서

그걸 이용하는 예제

#!/usr/bin/python

import RPi.GPIO as GPIO


GPIO.setmode(GPIO.BCM)

GPIO.setup(25, GPIO.IN)


impuls_count = 0

# Do next lines for i.e. 1000ms:

GPIO.wait_for_edge(25, GPIO.FALLING)

impuls_count = impuls_count + 1


[링크 : http://stackoverflow.com/..../how-to-get-the-frequency-of-a-square-wave-in-a-python-script] 





Posted by 구차니

손댈게 많구나...

tag cloud는 이제 쓰지도 않으니 버려두더라도....


syntax highlighter는 다시 적용해야 하나...

[링크 : http://blueray21.tistory.com/30]


그나저나 거의 5년 만에 블로그 단장이네


'개소리 왈왈 > 블로그' 카테고리의 다른 글

방문자 급감 ㅠㅠ  (0) 2015.09.17
싸이월드 새단장?? 서비스 종료?  (0) 2015.09.14
네이버가.. 50% 돌파?  (2) 2015.07.31
출장 3일의 여파?  (2) 2015.07.16
출장여파 ㅋㅋㅋ  (0) 2015.07.12
Posted by 구차니
Linux2015. 9. 3. 16:01

2009년 부터 개발되어 오기 시작한 녀석..

[링크 : https://archive.fosdem.org/2012/schedule/event/693/127_iio-a-new-subsystem.pdf]

 

sysfs나 캐릭터 디바이스로 하드웨어와 통신을 하기 위한 인터페이스(?)라고 하면 되나..

아무튼 온도 센서 등과 같은 gpio를 이용하는 비표준 통신 장비들과(그래서 I2C 이런것과 달리 Industrial이라고 한 듯)

통신을 할 수 있도록 해주는 것으로 보이는 sub-system 이다.

 

 

[링크 : http://wiki.analog.com/software/linux/docs/iio/iio]

 

+

2022.06.20

[링크 : https://www.kernel.org/doc/html/v4.12/driver-api/iio/index.html]

'Linux' 카테고리의 다른 글

iotop  (0) 2016.01.19
리눅스에서 메모리 뱅크 확인하기  (0) 2015.10.30
insmod / modprobe 차이  (0) 2015.08.25
리눅스 device tree  (0) 2015.04.29
커널 컴파일 옵션 neon 과 cpu feature  (0) 2015.04.28
Posted by 구차니
embeded/raspberry pi2015. 9. 3. 09:45

dht 관련 dtoverlay가 존재하는게 생각이 나서 삽질..

Name:   dht11

Info:   Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors

        Also sometimes found with the part number(s) AM230x.

Load:   dtoverlay=dht11,<param>=<val>

Params: gpiopin                  GPIO connected to the sensor's DATA output.

                                 (default 4)


[링크 : https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README] 


오홍 존재는 하네?(라즈비안)

$ sudo find / -name dht11.ko

/lib/modules/4.1.6+/kernel/drivers/iio/humidity/dht11.ko

/lib/modules/4.1.6-v7+/kernel/drivers/iio/humidity/dht11.ko


$ sudo modprobe dht11

$ lsmod | grep dht11

dht11                   3531  0

industrialio           35498  1 dht11


$ modinfo dht11

filename:       /lib/modules/4.1.6-v7+/kernel/drivers/iio/humidity/dht11.ko

license:        GPL v2

description:    DHT11 humidity/temperature sensor driver

author:         Harald Geyer <harald@ccbib.org>

srcversion:     136C0D2A25E76F8042B460C

alias:          of:N*T*Cdht11*

depends:        industrialio

intree:         Y

vermagic:       4.1.6-v7+ SMP preempt mod_unload modversions ARMv7 


/boot/overlays 에 파일이 존재하지 않아도 커널에 모듈로 내장되어 있는지 리부팅후 lsmod로 확인이 가능하다.

$ sudo vi /boot/config.txt

dtoverlay=dht11


/sys/devices/platform $ ls -al

합계 0

drwxr-xr-x 17 root root    0  9월  3 09:40 .

drwxr-xr-x  9 root root    0  9월  3 09:40 ..

drwxr-xr-x  2 root root    0  9월  3 09:44 alarmtimer

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD0.0

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD1.1

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD2.2

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD3.3

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD4.4

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD5.5

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD6.6

drwxr-xr-x  2 root root    0  9월  3 09:44 bcm2835_AUD7.7

drwxr-xr-x  8 root root    0  9월  3 09:44 clocks

drwxr-xr-x  3 root root    0  9월  3 09:42 dht11@0

drwxr-xr-x  2 root root    0  9월  3 09:40 regulatory.0

drwxr-xr-x  2 root root    0  9월  3 09:44 serial8250

drwxr-xr-x 17 root root    0  9월  3 09:40 soc

drwxr-xr-x  2 root root    0  9월  3 09:44 timer

-rw-r--r--  1 root root 4096  9월  3 09:40 uevent


어짜피 이녀석은.. 위의 녀석의 심볼릭 링크

/sys/bus/iio/devices/iio:device0 $ ls -al

합계 0

drwxr-xr-x 2 root root    0  9월  3 09:42 .

drwxr-xr-x 3 root root    0  9월  3 09:42 ..

-r--r--r-- 1 root root 4096  9월  3 09:42 dev

-rw-r--r-- 1 root root 4096  9월  3 09:42 in_humidityrelative_input

-rw-r--r-- 1 root root 4096  9월  3 09:42 in_temp_input

-r--r--r-- 1 root root 4096  9월  3 09:42 name

lrwxrwxrwx 1 root root    0  9월  3 09:42 of_node -> ../../../../firmware/devicetree/base/dht11@0

lrwxrwxrwx 1 root root    0  9월  3 09:42 subsystem -> ../../../../bus/iio

-rw-r--r-- 1 root root 4096  9월  3 09:42 uevent



집에가서 센서 달고 해봐야지..


lm-sensor에서 dht11을 iio를 통해 값을 불러 올 수 있도록 수정 된 듯?

[링크 : http://lists.lm-sensors.org/pipermail/lm-sensors/2013-July/039283.html]



GPIO4 라고 되어있는데.. 그냥 핀번호 상으로 4번에 하니 먼가 되긴한다..

$ 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 |  OUT | 1 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |

 |     |     |    3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO. 5 | 5   | 24  |

 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |

 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 1 | OUT  | GPIO. 6 | 6   | 25  |

 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT  | CE0     | 10  | 8   |

 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | 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 | IN   | GPIO.29 | 29  | 21  |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+ 


/sys/bus/iio/devices/iio:device0 $ sudo cat in_*

65000

24000


/sys/bus/iio/devices/iio:device0 $ sudo cat in*
95000
19000

/sys/bus/iio/devices/iio:device0 $ sudo cat in_*
cat: in_humidityrelative_input: 입력/출력 오류
cat: in_temp_input: 연결 시간 초과

$ dmesg
[   93.266278] iio iio:device0: Only 0 signal edges detected
[   94.390030] dht11: WARNING: decoding ambiguous
[   95.416292] iio iio:device0: Only 0 signal edges detected
[  105.476356] iio iio:device0: Only 0 signal edges detected
[  113.646349] iio iio:device0: Only 0 signal edges detected
[  165.000461] dht11: WARNING: decoding ambiguous
[  199.120659] dht11: WARNING: decoding ambiguous
[  201.230684] dht11: WARNING: decoding ambiguous
[  204.160759] dht11: WARNING: decoding ambiguous
[  205.186935] iio iio:device0: Only 0 signal edges detected

저 값이 무슨 의미인지도 모르겠고.. (그냥 65% 24도로 보면되려나?)

잘 안읽히거나 연결 시간 초과로 읽는데 오래 걸리기도 하니까..

여러번 계속 읽어 봐야 한다. ㄷㄷㄷ



+

2015.09.09

그래도 어떤 사람은 75% 성공률로 읽는다는데.. 난 더 낮은 느낌?

[링크 : https://www.raspberrypi.org/forums/viewtopic.php?p=779355]


쓰레드로 된건 읽기 왜케 힘드냐 -_-

[링크 : http://www.spinics.net/lists/linux-iio/msg19328.html]

Posted by 구차니
embeded/raspberry pi2015. 9. 3. 09:13

생각해보니.. 음속은 기온에 비례하는데

공식으로는 대충


음속 = (331.3 + 0.606 * 섭씨) m/s

0도에서 약 331m인데

실온이면 약 18도 로 잡고(10.908m/s) 342.208m/s

근사치로 340 정도 잡으면 될거 같긴한데


[링크 : https://en.wikipedia.org/wiki/Speed_of_sound]


어짜피 DHT-11 온도/습도 센서가 있으니까..

이걸로 온도 잰걸로 음속을 환산해주면 좀더 정확해지려나? +_+


[링크 : http://eleparts.co.kr/EPXF6C83]

[링크 : http://eleparts.co.kr/EPXF43N9]


Posted by 구차니

MIPI(Mobile Industry Processor Interface) 나 

DVP(Digital Video Port)나 둘다

I2C를 통해서 레지스터를 조작해 장치를 제어하는 건 동일하나

데이터가 시리얼이냐 패러럴이냐의 차이인듯?




[링크 : http://mipi.org/specifications/camera-interface]


For a standard DVP image sensor you will find the following signals:


SCL: I2C compatible clock signal for sensor registers configuration

SDA: I2C compatible data signal for sensor registers configuration

XCLK: clock input to the sensor

PCLK: clock output from the sensor,

HREF: Line valid signal

VSYNC: Frame valid signal

Data[N-1..0]: Data output from the sensor, N is the internal ADC bit width.

[링크 : http://www.arducam.com/hardware/]


[링크 : http://www.seeedstudio.com/wiki/images/3/3c/Ov5647_full.pdf]

[링크 : http://www.voti.nl/docs/OV7670.pdf]

'하드웨어 > 캡쳐보드 카메라' 카테고리의 다른 글

AEL? - AE Lock?  (0) 2016.05.12
eos m - 22mm / 18-55mm 렌즈 화각비교  (2) 2016.05.11
글로벌 셔터/ 롤링셔터  (0) 2015.07.27
열영상 센서 - 렙톤(FLIR Lepton)  (0) 2015.07.24
nikon f-801s 릴리즈 관련  (0) 2012.12.15
Posted by 구차니
embeded/i2c2015. 9. 2. 17:31

주소번지의 한계를 넘기기 위해 

일종의.. 페이징? 이라고 해야 하려나?


Bank Switching Operation

I2C can access 256 addresses directly (i.e. 0x00 through 0xFF).

SMBus can access 128 addresses directly (i.e. 0x00 through 0x7F).

NB3H5150 has an address space which goes up to 0x14F. Therefore, a “bank switching” mechanism is included to allow access to all addresses no matter which bus protocol is used. Effectively, the two bank select bits are appended to the most-significant end of the seven-bit byte offset, creating a nine-bit address. The bank switch control bits(6:7) are located in Register 0x21.

The most significant two bits of that register are used for bank selection; the least significant six bits are used for the READBYTECOUNT Function.


[링크 : http://www.onsemi.com/pub_link/Collateral/NB3H5150_I2C_MANUAL.PDF]

'embeded > i2c' 카테고리의 다른 글

i2c mode - tm4c  (0) 2018.04.26
i2c BUS에 pull-up, pull-down  (0) 2018.04.26
i2c 정리  (4) 2012.01.10
I2C  (2) 2011.11.28
SMBus 넌 머냐? - System Management Bus  (2) 2009.01.14
Posted by 구차니
embeded/raspberry pi2015. 9. 2. 16:23


CPU의 시리얼 번호를 기반으로 MAC을 생성 하는 듯?

그나저나.. BogoMIPS가 멋대로 바뀌네? ㄷㄷㄷ


타이머로 변경되면서 클럭 변경되면 다르게 나오려나?

$ cat /proc/cpuinfo

processor       : 0

model name      : ARMv7 Processor rev 5 (v7l)

BogoMIPS        : 38.40

Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm

CPU implementer : 0x41

CPU architecture: 7

CPU variant     : 0x0

CPU part        : 0xc07

CPU revision    : 5 


$ cat /proc/cpuinfo

processor       : 3

model name      : ARMv7 Processor rev 5 (v7l)

BogoMIPS        : 57.60

Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm

CPU implementer : 0x41

CPU architecture: 7

CPU variant     : 0x0

CPU part        : 0xc07

CPU revision    : 5


Hardware        : BCM2709

Revision        : a21041

Serial          : 00000000a37ce24e


$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq; cat /proc/cpuinfo

900000

processor       : 0

model name      : ARMv7 Processor rev 5 (v7l)

BogoMIPS        : 57.60

Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm

CPU implementer : 0x41

CPU architecture: 7

CPU variant     : 0x0

CPU part        : 0xc07

CPU revision    : 5


$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq; cat /proc/cpuinfo

600000

processor       : 0

model name      : ARMv7 Processor rev 5 (v7l)

BogoMIPS        : 38.40

Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm

CPU implementer : 0x41

CPU architecture: 7

CPU variant     : 0x0

CPU part        : 0xc07

CPU revision    : 5


---

라즈 B


# cat /proc/cpuinfo

processor       : 0

model name      : ARMv6-compatible processor rev 7 (v6l)

Features        : half thumb fastmult vfp edsp java tls

CPU implementer : 0x41

CPU architecture: 7

CPU variant     : 0x0

CPU part        : 0xb76

CPU revision    : 7


Hardware        : BCM2708

Revision        : 000e

Serial          : 0000000055593a15


# ifconfig

eth0      Link encap:Ethernet  HWaddr B8:27:EB:59:3A:15

---



$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:7c:e2:4e
          inet addr:192.168.10.23  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1685 errors:0 dropped:2 overruns:0 frame:0
          TX packets:358 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:107201 (104.6 KiB)  TX bytes:52547 (51.3 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)


$ cat /sys/class/net/eth0/address

b8:27:eb:7c:e2:4e


[링크 : http://www.robert-drummond.com/2013/05/23/how-to-find-the-mac-address-of-your-raspberry-pi/]

Posted by 구차니
회사일2015. 9. 2. 16:06

네이밍 센스가... 다른건가


[링크 : http://www.ktncusa.com/_media/EZHD-CameraChart_vs1.2.pdf]

[링크 : https://www.youtube.com/watch?v=3SGll7OdHdI]

'회사일' 카테고리의 다른 글

lwip + freeRTOS  (0) 2015.12.09
raw video streaming  (0) 2015.09.16
SDI 12G ... 6G  (0) 2015.05.18
HD-AHD / HD-TVI / HD-CVI / EX-SDI  (0) 2015.04.16
ltib - linux target image builder  (0) 2014.11.24
Posted by 구차니
분류가 모호한 글2015. 9. 1. 16:50

까먹기 전에 일단 링크나..


[링크 : http://excoa.com/work/기본형-스탠딩데스크]

[링크 : http://www.coredesk.kr/coredesk/index.html]

'분류가 모호한 글' 카테고리의 다른 글

NVD - National Vulnerability Database  (0) 2016.02.01
dense 3d reconstruction  (0) 2015.09.22
acoustic phased array speaker  (0) 2015.08.20
각종 오디오 코덱 가격  (0) 2015.01.26
img 와 iso  (0) 2014.08.29
Posted by 구차니