이번달에 그래도 몇개 안세워서 그런가..

앨범도 신청하고

라즈베리 빌드도 어찌어찌 하긴했고..

openGL이야 좀 미뤄두기로 했으니..


예정에 없던 지름으로 라즈베리 가지고 논다고 시간을 좀 소비..



다음달에는... openGL 하나만 잡아 볼까... ㅠㅠ

게임도 좀 하고 싶은데 ㅠㅠ

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

시간 빠르다..  (0) 2015.10.10
돈 나올 구멍은 없고...  (0) 2015.10.02
애본다 바빠 ㅠㅠ  (0) 2015.08.22
경복궁 / 창덕궁 야간개장 예매 준비!  (0) 2015.08.05
국민은행 + KB 손해보험 -_-  (3) 2015.08.04
Posted by 구차니
embeded/raspberry pi2015. 8. 27. 08:24

자유낙하 실험... 은 아니고

가방에 넣어 두었는데

가방이 떨어지면서 먼가 불쾌한 철퍽 하는 소리..

꺼내보니 액정까진 아니고 액정 보호유리가 깨지고..

켜보니... ㅠㅠ


터치 축 틀어짐 -_-!!!!

캘리브레이션 한다고 될진 모르겠지만 끄아아아아 ㅠㅠ



사요나라

바이바이

잘가

ㅠㅠ





그러니 다시 사야하나? ㅠㅠ

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

Posted by 구차니
embeded/ARM2015. 8. 26. 09:28

cortex-m3만 사용했는데 문득 M0 라던가 다른 모델군이 있는게 생각이 나서 검색..

일단은.. cortex-m3 는 그래도 나름! 풀 스펙에 가까운 표준형 cortex-m 시리즈라고 보면

M0는 숫자가 적은 만큼 마이너 버전이다.

그리고 M0/M1은 M3와 다르게 ARMv6 계열.. ㄷㄷㄷ

또한 Thumb 호환성도 조금 더 낮고(그래서 저전력/gate 수가 적다고)

결정적으로.. Hardware divider가 제외되어있다. 그나마 Hardware multiplier가 있는게 다행인가..


조금.. 의아한건..

M3/4/7이 Harvard 아키텍쳐인데 반해

M0/1은 폰 노이만으로의 회귀...


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

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


[링크 : https://en.wikipedia.org/wiki/ARM_Cortex-M]


그런데 보다 보니 Saturated math라는게 보여서 링크를 따라가니.. 오홍.. 좋아 보이는데?!?!?!

간단하게 설명하면 더 큰 변수로 캐스팅, 계산 값 범위 비교, 클 경우 최대값 넣기

이 세가지를 한방에 끝내주는 연산이다. overflow로 인한 예측하지 못한 값에 의한 오류도 막아주고(물론 오차는 존재하지만)

if문에 의한 branch를 줄여주는 부분에서 상당한 장점이 있을 것으로 보인다.

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

[링크 : http://www.arm.com/products/processors/cortex-m/]

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

arm11 simd instruction  (0) 2015.10.01
cortex-A5/A7  (0) 2015.09.21
ARM926EJ / ARMv5TE  (0) 2015.07.28
Jazelle 관련 검색  (0) 2015.04.28
ltib 패키지 요구사항  (0) 2015.04.13
Posted by 구차니

지금 구매한 ADXL345는 Digital Accelerometer 이다.

가속도 센서인데.. 가속도랑 기울기랑 자이로랑 은근 좀 헷갈린다 -_-

[링크 : http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf]




가속도 센서(accelerometer)

- 이름대로 중력 가속도에 의한 3축의 값을 측정

각속도 센서(gyro)

- 각의 변화량을 측정

기울기 센서(tlit)

- 물리적인 변화를 통해 각도를 측정(느림)



자이로 센서는 적분에서의 오차

기울기 센서는 느린 응답특성

가속도 센서는 회전 중심축과 센서의 중심이 맞아야한다는 문제

[링크 : http://www.ntrexgo.com/archives/3930]


[링크 : http://mechaworld.tistory.com/11]

자이로 센서 구조

[링크 : http://www.epnc.co.kr/atl/view.asp?a_id=11932]

[링크 : http://techlog.gurucat.net/104]


---

아오 이 기억력... -_-

2010/06/24 - [하드웨어] - 가속도 센서 / 자이로 센서 / 기울기 센서의 차이점


+

보정 필터

[링크 : http://pinkwink.kr/254]

'이론 관련 > 하드웨어 관련' 카테고리의 다른 글

adc - single ended / differential  (0) 2015.11.17
adc - 시그마델타 / SAR  (0) 2015.11.16
NTC 온도센서?  (0) 2015.08.07
SDIO / Secure Digital Input Output  (0) 2014.12.26
ADC 원리  (3) 2010.08.09
Posted by 구차니

거리 정보와 디스패리티(Disparity)의 관계

매칭 시간을 줄여주는 에피폴라 제한조건 (epipolar constraint)



결론은.. 에피폴라 행렬을 만들어내기 위해서

openCV에서 스테레오 카메라 관련해서 체크보드 출력해서 calibration을 하는거다. 라는거?

[링크 : http://www.ntrexgo.com/archives/2280]



[링크 : http://darkpgmr.tistory.com/83]

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

'이론 관련 > 사진 광학 관련' 카테고리의 다른 글

삼각측량 소스코드...  (0) 2015.10.19
카메라의 원리  (0) 2015.09.09
샤프니스 계산  (0) 2015.05.28
rolling shutter effect / jello effect ..  (0) 2015.05.22
SAD(Sum of Absolute Differences) 알고리즘  (0) 2015.05.06
Posted by 구차니
Linux2015. 8. 25. 11:34

굳이 차이점이라면...

insmod는 파일을 이용해서 올리고

modprobe는 모듈 이름을 이용해서 올리고 정도?



pi@raspberrypi ~ $ which modprobe

/sbin/modprobe

pi@raspberrypi ~ $ which insmod

/sbin/insmod

pi@raspberrypi ~ $ ls -al /sbin/modprobe

lrwxrwxrwx 1 root root 9  4월 29  2013 /sbin/modprobe -> /bin/kmod

pi@raspberrypi ~ $ ls -al /sbin/insmod

lrwxrwxrwx 1 root root 9  4월 29  2013 /sbin/insmod -> /bin/kmod



insmod

insmod [ filename ] [ module options... ]

insmod is a trivial program to insert a module into the kernel: if the filename is a hyphen, the module is taken from standard input. Most users will want to use modprobe(8) instead, which is more clever.

[링크 : http://linux.die.net/man/8/insmod]


modprobe

modprobe [ -v ] [ -V ] [ -C config-file ] [ -n ] [ -i ] [ -q ] [ -b ] [ -o modulename ] [ modulename ] [ module parameters... ]

modprobe intelligently adds or removes a module from the Linux kernel: note that for convenience, there is no difference between _ and - in module names. modprobe looks in the module directory /lib/modules/'uname -r' for all the modules and other files, except for the optional /etc/modprobe.conf configuration file and /etc/modprobe.d directory (see modprobe.conf(5)). modprobe will also use module options specified on the kernel command line in the form of <module>.<option>.

[링크 : http://linux.die.net/man/8/modprobe]


[링크 : http://www.readysystem.co.kr/ready/bbs/board.php?bo_table=tech_linux&wr_id=36&page=5]

'Linux' 카테고리의 다른 글

리눅스에서 메모리 뱅크 확인하기  (0) 2015.10.30
IIO - Industrial I/O  (2) 2015.09.03
리눅스 device tree  (0) 2015.04.29
커널 컴파일 옵션 neon 과 cpu feature  (0) 2015.04.28
쓰레드 / 프로세스  (0) 2015.04.27
Posted by 구차니
embeded/raspberry pi2015. 8. 24. 15:47

아두이노랑은 이렇게 하라는데

일단.. I2C로 할거니까.. 저렇게 위에 4개 선을 연결하면 어찌어찌 라즈베리에서도 사용가능 할 듯



장치 ID는 0xE5 고정

ADXL345

REGISTER DEFINITIONS

Register 0x00—DEVID (Read Only)

The DEVID register holds a fixed device ID code of 0xE5 (345 octal). 



데이터는 X/Y/Z축 LSB / MSB 순으로 들어 있다.


Register 0x32 to Register 0x37—DATAX0, DATAX1, DATAY0, DATAY1, DATAZ0, DATAZ1 (Read Only)

 These six bytes (Register 0x32 to Register 0x37) are eight bits each and hold the output data for each axis. Register 0x32 and Register 0x33 hold the output data for the x-axis, Register 0x34 and Register 0x35 hold the output data for the y-axis, and Register 0x36 and Register 0x37 hold the output data for the z-axis. The output data is twos complement, with DATAx0 as the least significant byte and DATAx1 as the most significant byte, where x represent X, Y, or Z. The DATA_FORMAT register (Address 0x31) controls the format of the data. It is recommended that a multiple-byte read of all registers be performed to prevent a change in data between reads of sequential registers



I 2 C

 With CS tied high to VDD I/O, the ADXL345 is in I2 C mode, requiring a simple 2-wire connection, as shown in Figure 40. The ADXL345 conforms to the UM10204 I 2 C-Bus Specification and User Manual, Rev. 03—19 June 2007, available from NXP Semiconductors. It supports standard (100 kHz) and fast (400 kHz) data transfer modes if the bus parameters given in Table 11 and Table 12 are met. Single- or multiple-byte reads/writes are supported, as shown in Figure 41. With the ALT ADDRESS pin high, the 7-bit I 2 C address for the device is 0x1D, followed by the R/W bit. This translates to 0x3A for a write and 0x3B for a read. An alternate I2 C address of 0x53 (followed by the R/W bit) can be chosen by grounding the ALT ADDRESS pin (Pin 12). This translates to 0xA6 for a write and 0xA7 for a read. There are no internal pull-up or pull-down resistors for any unused pins; therefore, there is no known state or default state for the CS or ALT ADDRESS pin if left floating or unconnected. It is required that the CS pin be connected to VDD I/O and that the ALT ADDRESS pin be connected to either VDD I/O or GND when using I2 C


[링크 : http://eleparts.co.kr/data/design/product_file/SENSOR/G_SENSOR/data/ADXL345.pdf]


---





---

pi@raspberrypi /boot/overlays $ dmesg | grep i2c

[    3.862054] bcm2708_i2c_init_pinmode(1,2)

[    3.863939] bcm2708_i2c_init_pinmode(1,3)

[    3.866020] bcm2708_i2c 3f804000.i2c: BSC1 Controller at 0x3f804000 (irq 79) (baudrate 100000)


pi@raspberrypi /boot/overlays $ lsmod | grep i2c

i2c_bcm2708             4990  0


pi@raspberrypi /boot/overlays $ insmod i2c-dev

Error: could not load module i2c-dev: No such file or directory


pi@raspberrypi /boot/overlays $ sudo vi /etc/modules

i2c-dev

i2c-bcm2708


pi@raspberrypi ~ $ lsmod | grep i2c

i2c_dev                 6027  0

i2c_bcm2708             4990  0


pi@raspberrypi ~ $ i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

pi@raspberrypi ~ $ i2cdetect -y 0

Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory


pi@raspberrypi ~ $ i2cdetect -l

i2c-1   i2c             3f804000.i2c                            I2C adapter


pi@raspberrypi ~ $ i2cdetect -F 1

Functionalities implemented by /dev/i2c-1:

I2C                              yes

SMBus Quick Command              yes

SMBus Send Byte                  yes

SMBus Receive Byte               yes

SMBus Write Byte                 yes

SMBus Read Byte                  yes

SMBus Write Word                 yes

SMBus Read Word                  yes

SMBus Process Call               yes

SMBus Block Write                yes

SMBus Block Read                 no

SMBus Block Process Call         no

SMBus PEC                        yes

I2C Block Write                  yes

I2C Block Read                   yes


pi@raspberrypi ~ $ lsmod | grep -i i2c

i2c_dev                 6027  0

i2c_bcm2708             4990  0



insmod가 아니라 modprobe ...


pi@raspberrypi ~ $ sudo modprobe i2c_dev

pi@raspberrypi ~ $ lsmod | grep i2c

i2c_dev                 6027  0

i2c_bcm2708             4990  0


[링크 : http://raspberrypi.stackexchange.com/.../how-to-make-raspbian-load-the-i2c-dev-module-on-boot-up]



---





#include <stdio.h>
#include <stdlib.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <iostream>

int main(int argc, char **argv)
{
   printf("**** ADXL435 example program ****\n");
   
   int fd;                                          // File descrition
   char *fileName = "/dev/i2c-1";                        // Name of the port we will be using
   int  address = 0x53;                              // Address of the SRF02 shifted right one bit
   char buf[6];                              // Buffer for data being read/ written on the i2c bus
   short x,y,z;

   if ((fd = open(fileName, O_RDWR)) < 0) {               // Open port for reading and writing
      printf("Failed to open i2c port\n");
      exit(1);
   }
   
   if (ioctl(fd, I2C_SLAVE, address) < 0) {               // Set the port options and set the address of the device we wish to speak to
      printf("Unable to get bus access to talk to slave\n");
      exit(1);
   }

   buf[0] = 0x2d;                                       // Commands for performing a ranging
   buf[1] = 0x18;
   
   if ((write(fd, buf, 2)) != 2) {                        // Write commands to the i2c port
      printf("Error writing to i2c slave\n");
      exit(1);
   }

   buf[0] = 0x31;                                       // Commands for performing a ranging
   buf[1] = 0x09;
   
   if ((write(fd, buf, 2)) != 2) {                        // Write commands to the i2c port
      printf("Error writing to i2c slave\n");
      exit(1);
   }

                                       // This sleep waits for the ping to come back
while(true){   

   buf[0] = 0x32;                                       // This is the register we wish to read from
   if ((write(fd, buf, 1)) != 1) {                        // Send the register to read from
      printf("Error writing to i2c slave\n");
      exit(1);
   }
   

usleep(1000);
  memset(&buf,0,sizeof(buf));

   if (read(fd, buf, 6) != 6) {                        // Read back data into buf[]
      printf("Unable to read from slave\n");
      exit(1);
   }
   else { x=y=z=0;
//               memset(&buf,0,sizeof(buf));

      x = ((short)buf[1]<<8) | (short) buf[0]; 
       y = ((short)buf[3]<<8) | (short) buf[2];
       z = ((short)buf[5]<<8) | (short) buf[4];
       std::cout<<"x:"<<x<<"\ty:"<<y<<"\tz:"<<z<<std::endl;
   }
}
   return 0;

} 



Posted by 구차니
embeded/raspberry pi2015. 8. 24. 15:30


raspi-config 면 기본 설정을 될테고..

나머지는 간단한(?) 테스트용 유틸리티 설치?


$ sudo apt-get install i2c-tools libi2c-dev python-smbus

$ sudo i2cdetect -y 1

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

[링크 : https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c]


예제코드 / 스켈레톤 코드

char *fileName = "/dev/i2c-0";

fd = open(fileName, O_RDWR);

ioctl(fd, I2C_SLAVE, address);

write(fd, buf, 1);

read(fd, buf, 2); 

[링크 : http://www.robot-electronics.co.uk/files/rpi_sd21.c]

    [링크 : http://www.robot-electronics.co.uk/htm/raspberry_pi_examples.htm]


pi@raspberrypi ~ $ i2cdetect

Error: No i2c-bus specified!

Usage: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]

       i2cdetect -F I2CBUS

       i2cdetect -l

  I2CBUS is an integer or an I2C bus name

  If provided, FIRST and LAST limit the probing range. 


활성화 시키지 않으면 이런 에러가 발생한다.

pi@raspberrypi ~ $ i2cdetect -y 1

Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory 


근데..

전에 처럼 또.. 연결 안하고 안켜면 활성화도 안되는 기분?

pi@raspberrypi ~ $ sudo i2cdetect -y 1

Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory


pi@raspberrypi ~ $ dmesg | grep i2c

[    3.872815] bcm2708_i2c_init_pinmode(1,2)

[    3.874707] bcm2708_i2c_init_pinmode(1,3)

[    3.877782] bcm2708_i2c 3f804000.i2c: BSC1 Controller at 0x3f804000 (irq 79) (baudrate 100000) 



Posted by 구차니
embeded/raspberry pi2015. 8. 23. 22:16

머.. fbtft 였나..

fb를 쓰는거니 당연히 되는 걸로 생각이 되긴 해야 하지만..

사이즈나 속도 면에서 무슨 제약이 걸려서 안되는게 아닐까 싶기도?

아무튼 되는거 보면 왜 놀라운걸까 ㅋㅋ




Posted by 구차니
embeded/raspberry pi2015. 8. 23. 16:01

음.. 다시 봤더니 뭔가 수정된 기분?

아무튼.. 나중에 다시 한번 바닥 부터 만들어 봐야지...

rootfs에 dtb 관련해서 추가되는게 은근 좀 있는 듯...


$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

$ mkdir mnt/fat32

$ mkdir mnt/ext4

$ sudo mount /dev/sdb1 mnt/fat32

$ sudo mount /dev/sdb2 mnt/ext4

$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install

$ sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img

$ sudo scripts/mkknlimg arch/arm/boot/zImage mnt/fat32/$KERNEL.img

$ sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/

$ sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/

$ sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/

$ sudo umount mnt/fat32

$ sudo umount mnt/ext4


[링크 : https://www.raspberrypi.org/documentation/linux/kernel/building.md]


스크립트를 통해서 zImage 파일이 어떻게든 변경되나 보다..

$ sudo ./scripts/mkknlimg arch/arm/boot/zImage ~/KERNEL.img

Version: Linux version 4.1.6-v7+ (minimonk@devmini) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #1 SMP PREEMPT Tue Aug 18 23:54:39 KST 2015

DT: y

283x: n


$ ls -al ~/KERNEL.img

-rw-r--r-- 1 root root 4031680  8월 23 16:19 /home/minimonk/KERNEL.img


$ file ~/KERNEL.img

/home/minimonk/KERNEL.img: Linux kernel ARM boot executable zImage (little-endian)


$ diff arch/arm/boot/zImage ~/KERNEL.img

Binary files arch/arm/boot/zImage and /home/minimonk/KERNEL.img differ  



2015/04/16 - [개소리 왈왈/라즈베리 파이(rpi)] - 라즈베리 파이 2 커널모듈 빌드

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 i2c 사용하기  (0) 2015.08.24
라즈베리 파이 SPI LCD도.. openGL은 되네?  (0) 2015.08.23
라즈베리 카메라 관련  (0) 2015.08.21
motion는 쓸만한게 아니었나..  (0) 2015.08.21
MMAL motion 로그  (0) 2015.08.20
Posted by 구차니