이런거 가지고 놀기 좋아한다고 뜬금없이 다른 보드와 함께 선물받은 Genuino 101 보드.
좀 시대 지난 보드지만 그래도 다른 보드와 다른점도 있고(Intel® Curie™/x86 (Quark) and a 32-bit ARC architecture core, both clocked at 32MHz.), 나름 BLE도 내장하고 있다.
테스트로 한번 blink 코드를 올려보려 하는데 자꾸 에러가 난다.
# arduino101load -dfu=/Users/heisice/Library/Arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -bin=/var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin -port=/dev/cu.usbmodem14201 -v -ble_fw_str="ATP1BLE00R-1631C4439" -ble_fw_pos=169984 -rtos_fw_str="" -rtos_fw_pos=0 -core=2.0.0
arduino101load 2.0.1 - compiled with go1.7.5
Starting download script...
Serial Port: /dev/cu.usbmodem14201
BIN FILE /var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin
Waiting for device...
Waiting for device...
Device found!
exit status 74
구글링을 열심히 해보다가 뚜렷한 답이 없어서 쳐박아뒀었는데, 다시 꺼내봤다가 답을 찾았다.
결국 또 구글링이긴 한데 바이너리 업로드에 쓰이는 저 arduino101load라는 프로그램이 예전 버전은 되는데 기존 버전은 안된다는 것 같다.
결국 구글링한 페이지에 링크된 버전을 다운받아, 기존 프로그램이 있는곳에 복사해 넣어줬더니 정상 동작한다.
# arduino101load -dfu=/Users/heisice/Library/Arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -bin=/var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin -port=/dev/cu.usbmodem14201 -v -ble_fw_str="ATP1BLE00R-1631C4439" -ble_fw_pos=169984 -rtos_fw_str="" -rtos_fw_pos=0 -core=2.0.0
arduino101load 2.0.2 - compiled with go1.7.5
Starting download script...
Serial Port: /dev/cu.usbmodem14201
BIN FILE /var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin
Waiting for device...
Device found!
Verifying BLE version: ATP1BLE00R-1631C4439
BLE version: verified
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
dfu-util: Invalid DFU suffix signature
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 8087:0aba
Run-time device DFU version 0011
Claiming USB DFU Interface...
Setting Alternate Setting #7 ...
Determining device status: state = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0011
Device returned transfer size 2048
Copying data from PC to DFU device
종종 SFTP를 이용해 서버에 파일을 업로드 하는데 갑자기 클라이언트에서 Connection timeout으로 접속이 되지 않는 문제가 발생.
서버에 로그를 확인해보니, 연결되자 마자 클라이언트에서 연결을 끊는다.
$ tail -f /var/log/secure
Accepted password for heisice from x.x.x.x port x ssh2 pam_unix(sshd:session): session opened for user heisice by (uid=0) Received disconnect from x.x.x.x port x:11: disconnected by user Disconnected from x.x.x.x port x pam_unix(sshd:session): session closed for user heisice
그래서 클라이언트에서 command line sftp클라이언트에 -v 옵션을 주어 실행해보니,
이 화면에서 콩 다운로드 부분에서 PC및 스마트폰용 프로그램을 다운받으시면 편리하게 들으실 수 있습니다. 팟캐스팅으로 지난 방송을 다시 들으실 수 있고 실시간 듣기를 누르시면 채널별로 브라우저를 통해 바로 들으실 수 있습니다. (자주 들으시면 프로그램을 설치하시는 것을 추천합니다.)
리눅스상에서 웹 호출 문제를 디버깅 하고 싶을 때 mysql 서버 로그를 봐도 부족하고 그럴 때는 패킷을 캡쳐해서 분석할 수 있다.
If you want to debug web call problems on Linux, you may not be able to view the mysql server logs, and you can capture and analyze the packets in such cases.
리눅스상에서 웹 호출 문제를 디버깅 하고 싶을 때 웹서버 로그를 봐도 부족하고 그럴 때는 패킷을 캡쳐해서 분석할 수 있다.
If you want to debug web call problems on Linux, you may not be able to view the web server logs, and you can capture and analyze the packets in such cases.
tpcdump는 기본으로 설치가 안되어 있으니 설치를 해야 한다.
tcpdump can not be installed by default.
그리고 루트 계정으로 실행해야 한다.
and, should run it as root.
tcpdump -A -s 10240 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " | sed -r "s/^........(GET |HTTP\/|POST |HEAD )/\n\1/g"
기본적으로 CentOS는 패키지관리자(yum)으로 프로그램을 설치하면 오래된 버전의 프로그램들이 설치되고, When CentOS installs the program as a package manager (yum), older versions of the programs are installed.
최신 프로그램은 없는 경우가 있습니다. 그런 경우 EPEL, IUS, Remi 등의 저장소를 추가해주면 신버전의 프로그램을 설치할 수 있습니다. And there is no latest program. In that case, you can install new versions of programs by adding repositories such as EPEL, IUS, and Remi.
하지만 별도로 설치하는 저장소의 패키지는 기존 시스템과 맞지 않을 수 있습니다. 제 경우엔 그런 문제는 없었지만. However, the package of the repository that you install separately may not match the existing system. I did not have that problem in my case.
EPEL 저장소 설치 (Install the EPEL repository)
일반적으로 아래 명령을 실행하면 EPEL저장소를 사용하게 됩니다.
Generally, the following command will use the EPEL repository.
sudo yum install epel-release
하지만 설치가 안되는 경우 아래 명령을 참고하세요. But if you can not install it please refer to the following command.
Lua라는 스크립트 언어로 펌웨어를 만들어 돌릴 수 있는 모듈이예요. 하지만 이번에는 아니예요.
Create a firmware module that can run'm in a scripting language called Lua. But this time I'm not using the Lua.
준비물은 여기까지예요. 너무 심플하죠??
Materials are up here. too simple ??
2. 선 연결 (Connecting Wires)
LED모듈과 모듈은 아래 사진처럼 각각 케이블로 연결되어야 해요.
LED modules and each module can be connected to cable like the picture below.
저는 있는 선을 써서 저렇게 모양이 좋지 않지만, 여러분은 짧은 케이블을 사서 쓰셨으면 해요.
Not good view. I hope you are using a short cable.
그리고, 첫번째 모듈의 J5라고 쓰여진 부분을 납땜으로 연결해 줘야 해요.
And, you have to connect the written part of the first module, called J5 soldered.
NodeMCU와 연결을 위해서 이걸 참고했어요. 프로그래밍으로 제어 가능한 GPIO포트들을 이용해 전광판을 제어 할 거예요.
I see it as connected to the NodeMCU. Using the available programmable GPIO ports will be controlled by controlling the led matrix.
일단 제 소스코드에는 이렇게 정의했어요.
I was defined like this.
이 정의를 참고해서 납땜질 했던 첫번째 모듈과 NodeMCU를 연결해요.
Refer to this definition, I connect the module and NodeMCU.
전광판 모듈 (LED Module)
NodeMCU
VCC
3.3V
GND
GND
DATA
GPIO4 (~D2)
WR
GPIO5 (~D1)
CS0
GPIO0 (~D3)
CS1
GPIO2 (~D4)
CS2
GPIO14 (~D5)
모두 연결됐어요!
Connected all!
3. 펌웨어 개발 (Firmware programming)
자.. 우리는 펌웨어 개발을 해야 해요.
Now ... we have to do firmware development.
개발 도구는 Arduino를 쓸거예요. 원래 이 개발툴은 Arduino라는 보드를 위해서 만들어진건데 최근에 보니 이것저것 많이 지원하더라구요.
Development tools are going to use the Arduino. Originally developed tools are gonna made for the Arduino board, the board looked at a lot of support recently.
NodeMCU 모듈 포함해서.
Including NodeMCU module.
아두이노 개발툴이 없으시면 여기에서 무료로 다운받으실 수 있어요.
If you do not have an Arduino development tool I can download for free here.
https://www.arduino.cc/
NodeMCU를 Arduino에서 개발하려면 아두이노 설정에서 추가 보드매니저 URL을 입력해야 해요.
To develop NodeMCU in Arduino you need to enter the URL in the Additional Board Manager in Arduino setup.