2015년 3월 31일 화요일

Debian 기반 리눅스 시스템에서 Adafuit의 Trinket 사용하기

1. 사전 작업 (arduino 설치)

# apt-get arduino

2. 디바이스 필터 설정
아래의 설정 파일을 생성하고 내용을 추가한다.

/etc/udev/rules.d/95-usbtiny.rules

#Adafruit Trinket
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", GROUP="dialout", MODE="0666"

3. avrdude 설정 파일 변경

/etc/avrdude.conf 에서 다음의 항목들을 변경한다.


#------------------------------------------------------------
# ATtiny85
#------------------------------------------------------------

part
     id            = "t85";
     desc          = "ATtiny85";
...
 # chiperasetime = 0;
  chiperasetime = 900000;
 ...

# delay  = 6;
 delay  = 12;
...

#         min_write_delay = 4500;
#         max_write_delay = 4500;
         min_write_delay = 30000;
         max_write_delay = 30000;

4. arduino IDE를 추가 파일 설치하기
다음의 주소로 가서
https://learn.adafruit.com/introducing-trinket/setting-up-with-arduino-ide

Step 1. Add ATtiny85 Support  밑에 있는 다운로드 항목을 내려 받는다.
내려 받은 trinkethardwaresupport.zip을 압축해제한다.
해제된 파일들중 variants 디렉토리밑의 디렉토리들을 (tiny8, tiny14) 통체로
/usr/share/arduino/hardware/arduino/variants밑으로 이동한다.
그리고 /usr/share/arduino/hardware/arduino/boards.txt 파일에 다음 항목들을 추가한다.


gemma.name=Adafruit Gemma 8MHz
gemma.bootloader.low_fuses=0xF1
gemma.bootloader.high_fuses=0xD5
gemma.bootloader.extended_fuses=0xFE
gemma.upload.maximum_size=5310
gemma.build.mcu=attiny85
gemma.build.f_cpu=8000000L
gemma.build.core=arduino:arduino
gemma.build.variant=tiny8

trinket3.name=Adafruit Trinket 8MHz
trinket3.bootloader.low_fuses=0xF1
trinket3.bootloader.high_fuses=0xD5
trinket3.bootloader.extended_fuses=0xFE
trinket3.upload.maximum_size=5310
trinket3.build.mcu=attiny85
trinket3.build.f_cpu=8000000L
trinket3.build.core=arduino:arduino
trinket3.build.variant=tiny8

trinket5.name=Adafruit Trinket 16MHz
trinket5.bootloader.low_fuses=0xF1
trinket5.bootloader.high_fuses=0xD5
trinket5.bootloader.extended_fuses=0xFE
trinket5.upload.maximum_size=5310
trinket5.build.mcu=attiny85
trinket5.build.f_cpu=16000000L
trinket5.build.core=arduino:arduino
trinket5.build.variant=tiny8

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

그리고 arduino IDE에서 개발 보드의 제어 권을 획득하기 위해서 다음 명령을 수행한다.

# adduser <사용자명> dialout


 5. Trinket을 연결하고 인식 여부를 확인해 보자.
주의 사항: 해당 보드는 하드웨어적으로 USB 포트를 지원하지 않기 때문에 전원 인가 후 10초 동안만 펌웨어 다운로드와 보드 인식이 가능하다. 달리 말하자면 보드를 제대로 인식하고 작성된 프로그램을 업로드 하기 위해서 리셋을 사전에 누르고 10초 안에 해당 작업을 해야 한다.
# avrdude -c usbtiny -p attiny8

6. 간단한 프로그래을 테스트 해보자.
마찬가지로 업로드 하기 전에 리셋 버튼을 누르고 업로드는 10초 안에 이루어져야한다.
/*
  Blink
  Turns on an LED on for one second, t/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.

  To upload to your Gemma or Trinket:
  1) Select the proper board from the Tools->Board Menu
  2) Select USBtinyISP from the Tools->Programmer
  3) Plug in the Gemma/Trinket, make sure you see the green LED lit
  4) For windows, install the USBtiny drivers
  5) Press the button on the Gemma/Trinket - verify you see
     the red LED pulse. This means it is ready to receive data
  6) Click the upload button above within 10 seconds
*/

int led = 1; // blink 'digital' pin 1 - AKA the built in red LED

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
    digitalWrite(led, HIGH);
    delay(500);
    digitalWrite(led, LOW);
    delay(500);
}
    hen off for one second, repeatedly.

  This example code is in the public domain.

  To upload to your Gemma or Trinket:
  1) Select the proper board from the Tools->Board Menu
  2) Select USBtinyISP from the Tools->Programmer
  3) Plug in the Gemma/Trinket, make sure you see the green LED lit
  4) For windows, install the USBtiny drivers
  5) Press the button on the Gemma/Trinket - verify you see
     the red LED pulse. This means it is ready to receive data
  6) Click the upload button above within 10 seconds
*/

int led = 1; // blink 'digital' pin 1 - AKA the built in red LED

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
    digitalWrite(led, HIGH);
    delay(500);
    digitalWrite(led, LOW);
    delay(500);
}
  








댓글 3개:

  1. 안녕하세요! 제가 라즈베리파이에 mjpg-streamer를 설치 웹캡 영상 전송하는 것을 구현한고 있는데
    어려움에 부딪혀 문의 드리게 됐습니다. mjpg-streamer를 설치 후 웹에서 포트번호:8080 치면 mjpg-streamer 화면이 나오지만 "this plug-in is not supported"라는 문구가 화면 박스안에 뜹니다. 어떻게 해결하면 될지요? 저는 블로그 내용따라 설치하는 수준의 초보입니다. 조언 주시면 정말 감사하겠습니다. 참고로 제 노트북은 윈도우7 64비트 입니다. 제 이메일은 sijongmu@gmail.com 입니다.

    답글삭제
  2. 안녕하세요! 제가 라즈베리파이에 mjpg-streamer를 설치 웹캡 영상 전송하는 것을 구현한고 있는데
    어려움에 부딪혀 문의 드리게 됐습니다. mjpg-streamer를 설치 후 웹에서 포트번호:8080 치면 mjpg-streamer 화면이 나오지만 "this plug-in is not supported"라는 문구가 화면 박스안에 뜹니다. 어떻게 해결하면 될지요? 저는 블로그 내용따라 설치하는 수준의 초보입니다. 조언 주시면 정말 감사하겠습니다. 참고로 제 노트북은 윈도우7 64비트 입니다. 제 이메일은 sijongmu@gmail.com 입니다.

    답글삭제
    답글
    1. 제가 경험한 사항이 아니어서 뭐라 드릴 답변이 없네요.

      삭제