embeded/raspberry pi2015. 9. 16. 15:19

헐.. UI가 조금 구리지만.. 잘 꾸미면 웬만한 사용제품 급이겠는데? ㄷㄷ


[링크 : http://elinux.org/RPi-Cam-Web-Interface]

[링크 : https://github.com/silvanmelchior/RPi_Cam_Web_Interface]

    [링크 : http://jamiej7.wix.com/anpr-on-raspberry-pi]

Posted by 구차니
embeded/raspberry pi2015. 9. 16. 10:20

서보 모터 2개 제어하려니.. PWM 채널 2개인게 편해서 검색..

그런데.. 저 핀 수는 어떤 기준이지?


12  PWM channel 0  A+/B+/Pi2 and compute module only

13  PWM channel 1  A+/B+/Pi2 and compute module only

18  PWM channel 0  All models

19  PWM channel 1  A+/B+/Pi2 and compute module only


40  PWM channel 0  Compute module only

41  PWM channel 1  Compute module only

45  PWM channel 1  Compute module only

52  PWM channel 0  Compute module only

53  PWM channel 1  Compute module only


[링크 : http://abyz.co.uk/rpi/pigpio/python.html#hardware_PWM] 


There are two hardware PWM channels on the BCM2385/6.

PWM0, which can be set to use GPIOs 12, 18, 40, and 52. Only 12 (pin 32) and 18 (pin 12) are available on the B+/2B, and PWM1 which can be set to use GPIOs 13, 19, 41, 45 and 53. Only 13 is available on the B+/2B, on pin 35 (but I think PWM1 is used for something - is it the audio output?)


[링크 : https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=105044] 


라즈베리 2B에는 GPIO13과 GPIO18번이 나와있으니.. 이걸 두개 설정해서

HW PWM으로 사용할 수 있을 것 같은데..

[링크 : http://elinux.org/RPi_BCM2835_GPIOs]


[링크 : http://elinux.org/RPi_Low-level_peripherals]




이렇게 맞붙여서 한번 해봐야지..


Posted by 구차니
embeded/raspberry pi2015. 9. 15. 12:43

bcm2835-v4l2 모듈만 불러주면 해결

(테스트 라즈비안 2015.5.5일자 클린상태)

---

uv4l2를 설치해서 되는건진 테스트 필요 (sd 밀고 다시 설정하고.. 아으 ㅋㅋㅋㅋ)

$ sudo apt-get install uv4l uv4l-raspicam uv4l-raspicam-extras uv4l-server uv4l-uvc uv4l-xscreen uv4l-mjpegstream 

---


Camera Enable로 설정 후 재부팅

$ sudo raspi-config


$ sudo modprobe bcm2835-v4l2

$ lsmod | grep v4l

bcm2835_v4l2           37265  0

videobuf2_vmalloc       5397  1 bcm2835_v4l2

videobuf2_core         34020  1 bcm2835_v4l2

v4l2_common             3766  2 bcm2835_v4l2,videobuf2_core

videodev              124141  3 bcm2835_v4l2,v4l2_common,videobuf2_core


$ dmesg

[ 6468.552996] media: Linux media interface: v0.10

[ 6468.574380] Linux video capture interface: v2.00

[ 6468.610013] bcm2835-v4l2: scene mode selected 0, was 0

[ 6468.610559] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720

[ 6468.615652] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.


$ ls -al /dev/video0

crw-rw-rwT+ 1 root video 81, 0  9월 15 12:37 /dev/video0 


[링크 : http://www.ics.com/blog/raspberry-pi-camera-module]


만약 start_x를 추가하지 않아 카메라가 활성화 되지 않으면

Operation not permitted 라는 에러 메시지가 발생된다.

$ lsmod

Module                  Size  Used by

cuse                    5065  0

fuse                   81710  2 cuse

snd_bcm2835            19769  0

snd_pcm                74825  1 snd_bcm2835

snd_seq                53561  0

snd_seq_device          3650  1 snd_seq

snd_timer              18157  2 snd_pcm,snd_seq

snd                    52116  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device

uio_pdrv_genirq         2966  0

uio                     8235  1 uio_pdrv_genirq


$ sudo modprobe bcm2835-v4l2

ERROR: could not insert 'bcm2835_v4l2': Operation not permitted


$ dmesg

[   33.911831] media: Linux media interface: v0.10

[   33.932822] Linux video capture interface: v2.00

[   33.957085] : bcm2835-v4l2: error -1 while loading driver 


Camera

start_x Enable the camera module.

 start_x=1


disable_camera_led Turn off the red camera LED when recording video or taking a still picture

 disable_camera_led=1


gpu_mem minimum GPU memory for camera use

 gpu_mem=128

[링크 : http://elinux.org/RPiconfig#Camera] 


움직임 감지시 이미지로 저장하는 부분

output_normal을 off로 하면 "target_dir" 에 저장을 하지 않음

############################################################

# Image File Output

############################################################


# Output 'normal' pictures when motion is detected (default: on)

# Valid values: on, off, first, best, center

# When set to 'first', only the first picture of an event is saved.

# Picture with most motion of an event is saved when set to 'best'.

# Picture with motion nearest center of picture is saved when set to 'center'.

# Can be used as preview shot for the corresponding movie.

output_normal off


# Output pictures with only the pixels moving object (ghost images) (default: off)

output_motion off


# The quality (in percent) to be used by the jpeg compression (default: 75)

quality 75


# Output ppm images instead of jpeg (default: off)

ppm off


움직임 감지시 동영상 저장 부분. swf가 기본값이며 ffmpeg_cap_new를 off로 해주면 저장되지 않았다.

(기본값이 off라면서 on이 되어 있냐 -_-)

############################################################

# FFMPEG related options

# Film (mpeg) file output, and deinterlacing of the video input

# The options movie_filename and timelapse_filename are also used

# by the ffmpeg feature

############################################################


# Use ffmpeg to encode mpeg movies in realtime (default: off)

ffmpeg_cap_new off


# Use ffmpeg to make movies with only the pixels moving

# object (ghost images) (default: off)

ffmpeg_cap_motion off


# Use ffmpeg to encode a timelapse movie

# Default value 0 = off - else save frame every Nth second

ffmpeg_timelapse 0


# The file rollover mode of the timelapse video

# Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual

ffmpeg_timelapse_mode daily


# Bitrate to be used by the ffmpeg encoder (default: 400000)

# This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled)

ffmpeg_bps 500000


# Enables and defines variable bitrate for the ffmpeg encoder.

# ffmpeg_bps is ignored if variable bitrate is enabled.

# Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps,

# or the range 2 - 31 where 2 means best quality and 31 is worst.

ffmpeg_variable_bitrate 0


# Codec to used by ffmpeg for the video compression.

# Timelapse mpegs are always made in mpeg1 format independent from this option.

# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.

# mpeg1 - gives you files with extension .mpg

# mpeg4 or msmpeg4 - gives you files with extension .avi

# msmpeg4 is recommended for use with Windows Media Player because

# it requires no installation of codec on the Windows client.

# swf - gives you a flash film with extension .swf

# flv - gives you a flash video with extension .flv

# ffv1 - FF video codec 1 for Lossless Encoding ( experimental )

# mov - QuickTime ( testing )

ffmpeg_video_codec swf


# Use ffmpeg to deinterlace video. Necessary if you use an analog camera

# and see horizontal combing on moving objects in video or pictures.

# (default: off)

ffmpeg_deinterlace off 


motion.conf

I ended up commented these out when i was testing but not totally sure if it helped.

It's prolly ok to leave motion.conf pretty much as it was but this works fine for me and that's how it's gonna stay now it's fully working.


;netcam_url value

;target_dir value

;webcam_port 8081

;videodevice /dev/video0

[링크 : http://ubuntuforums.org/showthread.php?t=1897786] 


화면이 안떠서 디버깅을 해보니 예제로 된 /etc/motion/motion.conf 에서

thread의 경로가 잘못 잡힌 것을 발견

$ sudo motion[0] Processing thread 0 - config file /etc/motion/motion.conf

[0] Thread config file /usr/local/etc/thread1.conf not found: No such file or directory

[0] Thread config file /usr/local/etc/thread2.conf not found: No such file or directory

[0] Motion 3.2.12 Started

[0] Motion going to daemon mode 


이렇게 하니.. 8081 8082 포트로 접속이 된다.

$ sudo vi /etc/motion/motion.conf
# thread config files.

thread /etc/motion/thread1.conf

thread /etc/motion/thread2.conf

; thread /usr/local/etc/thread3.conf

; thread /usr/local/etc/thread4.conf 



8080 에서는 작동중인 쓰레드가

8081 에는 cam1


8082에는 cam2



15 프레임 캡쳐 / 15 프레임 스트리밍 해둔건데 cpu가 1개 코어 100%를 먹네.. ㄷㄷㄷ



+

그나저나 아이패드에서는 영상이 가로/세로 바꾸거나 스크롤을 하는 동안에만 잠시 보인다..

머가 문제라서 리프레시가 자동으로 안될까?


+

갤럭시 S2 에서는 다운로드..


+

IE 에서도 다운로드

크롬외에는 쓸모가 없나 -ㅁ-?

아니면.. HTTP 스트리밍이 되는.. vlc?


Posted by 구차니
embeded/raspberry pi2015. 9. 14. 14:21

라즈베리 파이는 메모리를 공유하는데

GPU에 할당되는 메모리에 따라 사용가능한 기능이 제한이 된다.


gpu_mem GPU memory in megabyte. Sets the memory split between the ARM and GPU. ARM gets the remaining memory. Min 16. Default 64

[링크 : http://elinux.org/RPiconfig]

[링크 : https://www.raspberrypi.org/documentation/configuration/config-txt.md]


요약하면.. GPU에 최저 할당 가능한 

16MB는 2D로만 쓸 수 있고(FullHD 해상도 가능)

32MB 부터 3d 가속과 비디오 가속이 가능

128MB 는 raspBMC 라는 녀석의 권장 설정값


기능적으로는 32MB 부터 전부사용은 가능하다.



256MB version


For older RaspberryPi, with 256 MB of RAM, 4 splits are available:


240/16 - The most RAM size ARM can get (240MB) with mimial GPU memory. It's the best for general computing when you don't need 3D graphics or hardware video acceleration. It has enough memory to handle 1920x1200x16bpp framebuffer resolution. While 32bpp is also working, it's not recommended since it leaves very small amount of free memory for GPU.

-

224/32 - This one is deprecated in favor of 240/16 split. It has 3D and hardware video decoding build in but since there is not enough memory to actually use it, there's little point in using it. Unless you have some problems with 240/16 split or want to use 32bpp framebuffer at highest resolution. It is possible it will be deleted in the future.


192/64 - You need at least 64MB of GPU split to use hardware video acceleration or 3D graphics. It may not be enough GPU memory for hardware accelerated video playback at highest resolution or if you need a lot of GPU memory for things like textures.


128/128 - The most RAM GPU can get. Use it when you need a lot of memory for 3D graphic card and hardware accelerated video playback in high resolution. This split is needed for RaspBMC to work properly or to play fullHD video content with omxplayer without problems.


512MB version


New versions of RaspberryPi has 512 MB of RAM. You have 4 additional splits designed for this version:


496/16 and 448/64 - like 240/16 and 192/64 split for 256MB respectively but with 256MB more RAM available for ARM. Since GPU has only 16 MB/64MB or RAM, all the limitations from 240/16/192/64 still apply.

384/128 - Similar to 128/128 split for 256MB - you should get all the graphic chip features but with reasonable amount of ARM memory. This will probably be the most universal split right now.

256/256 - Some bonus graphic card memory if you really need it, like for big textures and similar things. While 256MB of ARM memory is bigger than you could possibly have in older RaspberryPis, I don't think this one will be used on many occasions.


[링크 : http://raspberrypi.stackexchange.com/.../what-is-the-optimum-split-of-main-versus-gpu-memory]

Posted by 구차니
embeded/raspberry pi2015. 9. 14. 10:00

해보려니 의존성 문제랑 여러가지 문제로 구동 불가..

omx 어쩌구가 나오는데.. 아무튼 실행하려고 하면 에러가 나면서 실행이 안된다 -_ㅠ


WARNING: erroneous pipeline: no element "h264parse" 

[링크 : http://www.onepitwopi.com/raspberry-pi/gstreamer-1-2-on-the-raspberry-pi/]

---


ㅎㄷㄷ 정규식으로 검색이라니 머지?

라즈베리 2 에서 해보려니.. gst-launch 로 되네..


서버

$ raspivid -t 0 -h 720 -w 1280 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=라즈베리파이IP port=5000


클라이언트

$ gst-launch-1.0 -v tcpclientsrc host=라즈베리파이IP port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

[링크 : http://www.rasplay.org/?p=5607]


In simple form, a PIPELINE-DESCRIPTION is a list of elements separated by exclamation marks (!). Properties may be appended to elements, in the form property=value.

[링크 : http://manpages.ubuntu.com/manpages/trusty/man1/gst-launch-1.0.1.html]


[링크 : http://www.aftermath.kr/entry/GStreamer-RTSP-with-RPi]


$ sudo apt-get install gstreamer1.0

패키지 목록을 읽는 중입니다... 완료

의존성 트리를 만드는 중입니다

상태 정보를 읽는 중입니다... 완료

주의, 정규식 'gstreamer1.0'에 대해 'libgstreamer1.0-dev'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-base'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-audiosource'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-audiosink'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'libgstreamer1.0-0'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-visualization'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'libgstreamer1.0-0-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-omx-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-ugly'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-base-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-base-doc'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-gnomevfs'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-doc'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-bad'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-base-apps'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-tools'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-omx'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-libav'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-good'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-bad-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-bad-doc'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-videosink'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-videosource'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-pulseaudio'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-ugly-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-good-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-ugly-doc'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-alsa'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-plugins-good-doc'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-libav-dbg'을(를) 선택합니다

주의, 정규식 'gstreamer1.0'에 대해 'gstreamer1.0-x'을(를) 선택합니다

주의, 'gstreamer1.0-visualization' 대신에 'gstreamer1.0-plugins-good' 패키지를 선택합니다

gstreamer1.0-alsa 패키지는 이미 최신 버전입니다.

gstreamer1.0-libav 패키지는 이미 최신 버전입니다.

gstreamer1.0-plugins-bad 패키지는 이미 최신 버전입니다.

gstreamer1.0-plugins-base 패키지는 이미 최신 버전입니다.

gstreamer1.0-plugins-good 패키지는 이미 최신 버전입니다.

gstreamer1.0-x 패키지는 이미 최신 버전입니다.

libgstreamer1.0-0 패키지는 이미 최신 버전입니다.

libgstreamer1.0-0 패키지 수동설치로 지정합니다.

다음 패키지를 더 설치할 것입니다:

  autopoint debhelper gettext gir1.2-gstreamer-1.0 html2text intltool-debian

  libelfg0 libgettextpo0 libglib2.0-bin libglib2.0-dev libglib2.0-doc

  libmail-sendmail-perl libpcre3-dev libpcrecpp0 libsys-hostname-long-perl

  libunistring0 po-debconf

제안하는 패키지:

  dh-make gettext-doc gstreamer1.0-gnomevfs devhelp libmail-box-perl

다음 새 패키지를 설치할 것입니다:

  autopoint debhelper gettext gir1.2-gstreamer-1.0 gstreamer1.0-doc

  gstreamer1.0-libav-dbg gstreamer1.0-omx-dbg gstreamer1.0-plugins-bad-dbg

  gstreamer1.0-plugins-bad-doc gstreamer1.0-plugins-base-apps

  gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc

  gstreamer1.0-plugins-good-dbg gstreamer1.0-plugins-good-doc

  gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg

  gstreamer1.0-plugins-ugly-doc gstreamer1.0-pulseaudio gstreamer1.0-tools

  html2text intltool-debian libelfg0 libgettextpo0 libglib2.0-bin

  libglib2.0-dev libglib2.0-doc libgstreamer1.0-0-dbg libgstreamer1.0-dev

  libmail-sendmail-perl libpcre3-dev libpcrecpp0 libsys-hostname-long-perl

  libunistring0 po-debconf

다음 패키지를 업그레이드할 것입니다:

  gstreamer1.0-omx

1개 업그레이드, 34개 새로 설치, 0개 제거 및 88개 업그레이드 안 함.

41.4 M바이트 아카이브를 받아야 합니다.

이 작업 후 114 M바이트의 디스크 공간을 더 사용하게 됩니다.

계속 하시겠습니까 [Y/n]? 



Posted by 구차니
embeded/raspberry pi2015. 9. 10. 15:06

115k의 경우 미세하게 차이가 나지만...

라즈베리 파이 2라서 이정도 인데..

더 사양이 낮은걸로 가면 어떻게 되려나? 간격이 좁혀지려나? 궁금해지네..

나중에 PC에서도 해봐야겠다.

(빠르게 처리하고 출력이 느려서 발목잡히는거라면..

성능이 느린 녀석일수록 낮은 baud rate에서도 느려지지 않을 가능성이 높아 보이네..)


결론 : 시리얼 콘솔로 출력을 안하는게 미세하게라도 부팅을 빠르게 해준다.

       단, 느리면 미친듯이 느려짐(ex 2400bps)


시리얼 콘솔 OFF

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


[    5.538787] i2c /dev entries driver

[    8.942949] random: dd urandom read with 125 bits of entropy available

[    9.218847] random: nonblocking pool is initialized

[    9.239318] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   10.899741] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   14.062018] cfg80211: Calling CRDA to update world regulatory domain

[   14.508474] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS

[   17.215920] cfg80211: Calling CRDA to update world regulatory domain 


시리얼 콘솔 115k

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


[    6.610517] i2c /dev entries driver

[    8.755376] random: nonblocking pool is initialized

[   10.337207] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   11.845371] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   15.171890] cfg80211: Calling CRDA to update world regulatory domain

[   15.575988] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS

[   18.323100] cfg80211: Calling CRDA to update world regulatory domain


시리얼 콘솔 2.4k

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,2400 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


[   65.375014] i2c /dev entries driver

[   69.878454] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   71.466722] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   74.321086] cfg80211: Calling CRDA to update world regulatory domain

[   75.156305] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS

[   77.474999] cfg80211: Calling CRDA to update world regulatory domain



+

시리얼 초기화에 시간이 이상하리 만치 오래 걸리고

확실히 메시지 출력에 시간소요 되는게 다르다.

115k - 0.004278초

[    0.696002] console [ttyAMA0] enabled

[    0.700280] bcm2835-mbox 3f00b880.mailbox: mailbox enabled


2.4k - 0.175674 초

[   24.166507] console [ttyAMA0] enabled

[   24.342181] bcm2835-mbox 3f00b880.mailbox: mailbox enabled




+

2015.09.15

quiet 주면 로그가 출력이 거의 안되니까

부팅 시간에 영향을 거의 주지 않는다.

유의미한 부팅시간 차이는 없는 듯


no quiet / no console

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


$ dmesg

[    1.873744] smsc95xx v1.0.4

[    1.941273] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:7c:e2:4e

[    2.158823] udevd[175]: starting version 175

[    4.436091] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    4.657410] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    5.213253] fuse init (API version 7.23)

[    8.630851] random: dd urandom read with 121 bits of entropy available

[    9.128626] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[    9.533223] random: nonblocking pool is initialized

[   10.676478] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   11.380752] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS 


quiet / 2400bps

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,2400 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet


$ dmesg

[    1.787155] smsc95xx v1.0.4

[    1.849754] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:7c:e2:4e

[    2.159625] udevd[175]: starting version 175

[    4.475902] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    4.687585] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    5.243639] fuse init (API version 7.23)

[    8.657857] random: dd urandom read with 122 bits of entropy available

[    9.236423] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[    9.285362] random: nonblocking pool is initialized

[   10.784245] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   11.661120] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS 


quiet / 115k

$ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet


$ dmesg

[    1.787064] smsc95xx v1.0.4

[    1.848037] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:7c:e2:4e

[    2.083949] udevd[175]: starting version 175

[    4.375384] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    4.588231] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

[    5.138807] fuse init (API version 7.23)

[    8.506983] random: dd urandom read with 123 bits of entropy available

[    9.087136] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[    9.132055] random: nonblocking pool is initialized

[   10.595072] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

[   11.272396] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2134012k SSFS 



[링크 : http://elinux.org/Disable_Console]

[링크 : https://www.kernel.org/doc/Documentation/kernel-parameters.txt]



+

2015.09.16


라즈베리 B에서 테스트

2400bps로 설정하면 라즈베리 B나 2B나 부팅시간이 거의 동일해진다 ㄷㄷ


# cat /flash/cmdline.txt

boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 quiet


[    6.260069] lirc_rpi: auto-detected active low receiver on GPIO pin 18

[    6.260446] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0

[    6.260465] lirc_rpi: driver registered!

[    9.116106] Console: switching to colour dummy device 80x30

[   10.033464] pcm512x 1-004d: Failed to reset device: -5

[   10.033606] pcm512x: probe of 1-004d failed with error -5

[   10.038823] pcm512x 1-004c: Failed to reset device: -5

[   10.038972] pcm512x: probe of 1-004c failed with error -5

[   11.996185] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   11.996923] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

[   13.503507] input: lircd as /devices/virtual/input/input0

[   13.513621] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

[   13.543861] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


# cat /flash/cmdline.txt

boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 console=ttyAMA0,115200


[    7.583641] lirc_rpi: auto-detected active low receiver on GPIO pin 18

[    7.584050] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0

[    7.584073] lirc_rpi: driver registered!

[    7.590570] systemd[1]: Reached target Local File Systems.

[    7.590980] systemd[1]: Started Rebuild Journal Catalog.

[    7.607263] systemd[1]: Started Load Kernel Modules.

[    7.673956] systemd[1]: Started Journal Service.

[    7.835377] systemd-journald[149]: Received request to flush runtime journal from PID 1

[   11.254985] Console: switching to colour dummy device 80x30

[   12.137394] pcm512x 1-004d: Failed to reset device: -5

[   12.137547] pcm512x: probe of 1-004d failed with error -5

[   12.142543] pcm512x 1-004c: Failed to reset device: -5

[   12.142698] pcm512x: probe of 1-004c failed with error -5

[   14.273315] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   14.276243] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

[   15.827031] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

[   15.861468] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[   15.930351] input: lircd as /devices/virtual/input/input0


# cat /flash/cmdline.txt

boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 console=ttyAMA0,2400


[   59.096555] lirc_rpi: auto-detected active low receiver on GPIO pin 18

[   59.096935] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0

[   59.096958] lirc_rpi: driver registered!

[   59.253490] systemd[1]: Mounted Temporary Directory.

[   59.530181] systemd[1]: Started Remount Root and Kernel File Systems.

[   59.910190] systemd[1]: Started Create list of required static device nodes for the current kernel.

[   60.106840] systemd[1]: Started Setup machine-id.

[   60.323515] systemd[1]: Started Set ondemand threshold.

[   60.500170] systemd[1]: Started Show Version.

[   60.716824] systemd[1]: Started Load Kernel Modules.

[   60.950148] systemd[1]: Started Kodi config dir rebrand.

[   61.146860] systemd[1]: Started Mounting swapfile.

[   61.376843] systemd[1]: Started udev Coldplug all Devices.

[   61.848866] systemd[1]: Starting Swap.

[   62.016818] systemd[1]: Reached target Swap.

[   62.017203] systemd[1]: Mounted FUSE Control File System.

[   62.018077] systemd[1]: Mounted Configuration File System.

[   62.018331] systemd[1]: Starting Apply Kernel Variables...

[   62.213534] systemd[1]: Starting Journal Service...

[   62.377729] systemd[1]: Starting Create Static Device Nodes in /dev...

[   62.620386] systemd[1]: Starting Setup Timezone data...

[   62.804543] systemd[1]: Started Debug /var/log relink.

[   63.003508] systemd[1]: Started Journal Service.

[   64.752792] systemd-journald[160]: Received request to flush runtime journal from PID 1

[   69.797632] pcm512x 1-004d: Failed to reset device: -5

[   69.797788] pcm512x: probe of 1-004d failed with error -5

[   69.802172] pcm512x 1-004c: Failed to reset device: -5

[   69.802323] pcm512x: probe of 1-004c failed with error -5

[   71.876799] Console: switching to colour dummy device 80x30

[   75.422833] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup

[   75.425714] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

[   76.986887] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

[   76.995598] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[   78.083255] input: lircd as /devices/virtual/input/input0



Posted by 구차니
embeded/raspberry pi2015. 9. 10. 13:40

wiring pi gpio 유틸 도움말을 보던 중에

어? 이런 기능이?

혹시.. 2B에도 적용되려나?


usbp   high | low

Change  the USB current limiter to high (1.2 amps) or low (the default, 600mA)

This is only applicable to the model B+


[링크 : https://projects.drogon.net/testing-setting-the-usb-current-limiter-on-the-raspberry-pi-b/]



+ 2015.09.11

어? 2b랑 b+이랑 보드 같은거 아니었어!??!?

pi@raspberrypi ~ $ gpio usbp high

USB power contol is applicable to B+ boards only.

pi@raspberrypi ~ $ gpio usbp low

USB power contol is applicable to B+ boards only. 


차이를 모르겠다 -_-a

아무튼.. 설정은 되는데 테스트는 나중에 USB 하드라도 물려봐야지 머..

pi@raspberrypi ~ $ gpio -g write 38 0

pi@raspberrypi ~ $ gpio -g mode 38 out

pi@raspberrypi ~ $ gpio -g write 38 1


I know the following:


Setting max_usb_current=1 sets the available current over USB to 1.2A (default is 600mA)

This can help if you have a decent power supply (2A, at least) and need to power something like a small external HDD or something that needs 300+ mA.

This feature is only available on the B+ and Pi model 2 (at the time of this writing)

[링크 : http://raspberrypi.stackexchange.com/.../is-setting-max-usb-current-1-to-give-more-power...]



max_usb_current


Together with the raspberry PI B+ a new config.txt setting was introduced.


  max_usb_current=1

when adding this line the USB power manager will change its output current limit (for all 4 USB ports combined) from 600mA to double that, 1200mA.

[링크 : http://elinux.org/RPiconfig#USB_Power]



---

집에와서 해보니..

두개중에 하나만 해줘도 되는거 같고..

$ cat /boot/config.txt 

safe_mode_gpio=4

max_usb_current=1


이렇게 38번 핀을 high 로 해도 USB 하드가 바로 전력소비가 커버되는지 삑삑삑삑

스핀들 모터가 못돌다가 조용해진다.(인식/마운트 성공)

$ gpio -g mode 38 out

$ gpio -g write 38 1 



결론 B+이나 2B나 같으니 2B에서도 된다!

Posted by 구차니
embeded/raspberry pi2015. 9. 7. 16:43

흐음.. 한번 써봐야지


int waitForInterrupt (int pin, int timeOut) ;

gpio edge 0 falling


int wiringPiISR (int pin, int edgeType,  void (*function)(void)) ;

INT_EDGE_FALLING

INT_EDGE_RISING

INT_EDGE_BOTH

INT_EDGE_SETUP


gpio edge <pin> rising/falling/both/none

This enables the given pin for edge interrupt triggering on the rising, falling or both edges. (Or none which disables it)



       edge   This exports a GPIO pin  in  the  /sys/class/gpio  directory,  set  the

              direction  to  input and set the edge interrupt method to none, rising,

              falling or both.  Use like the  export  command  above  and  note  that

              BCM_GPIO pin number is used not not wiringPi pin numbering.


              Like the export commands above, ownership is set to that of the calling

              user, allowing subsequent access from user programs  without  requiring

              root/sudo. 


[링크 : http://wiringpi.com/reference/priority-interrupts-and-threads/]

[링크 : https://projects.drogon.net/raspberry-pi/wiringpi/functions/]

Posted by 구차니
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 구차니
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 구차니