Micom_Electric/마이컴_원칩 2009. 1. 29. 21:17
한국어로 된 설명
http://cafe.naver.com/arduinostory.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=183


원저자페이지
http://www.arduino.cc/en/Reference/SoftwareSerial

http://www.arduino.cc/en/Guide/Introduction

What is Arduino?

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free.

The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment.

Why Arduino?

There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems:

  • Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50
  • Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows.
  • Simple, clear programming environment - The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino
  • Open source and extensible software- The Arduino software and is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. SImilarly, you can add AVR-C code directly into your Arduino programs if you want to.
  • Open source and extensible hardware - The Arduino is based on Atmel's ATMEGA8 and ATMEGA168 microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money.

How do I use Arduino?

To get started, follow the instructions for your operating system: Windows, Mac OS X or Linux; or the additional instructions for your board: Arduino Mini, Arduino BT, or shield: Xbee. The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.



쇼핑몰에 설명된 내용
http://www.avrtools.co.kr/technote7/board.php?board=download&command=body&no=56
  아듀이노 부트로더의 개조
참조 : http://www.arduino.cc/en/Hacking/OtherHardware
제목 : 아듀이노의 부트로더의 개조 (발진을 20MHz로 변경)

 
목적
아듀이노는 ATMEGA168-20AU 혹은 20PU 칩을 장착한 제품이 16MHz를 사용하고 있으므로.
기판의 발진주파수를 20MHz로 바꾸면, 실행 속도가 25 %정도 빨라질 수 있다.

방법
기판의 발진속도만 올리면, 업로드속도가 25% 빨라지므로, 그대로는 업로드를 할 수 없다,
반드시 기판의 원래 업로드속도 19200 bps로 낮추어야, 소프트웨어에서 업로드가 된다.

또한, 개조된 기판을 아듀이노 데시밀라로 설정하면, 여전히 16MHz의 실행코드가 만들어 지므로,
타이머 등에서 지연시간값과 통신속도등이 다르게 나타나기 때문에, 새로운 기판을 설정에 추가해야 한다.

참고
arduino-0011 > hrdware > bootloaders > atmega168 > 폴더를 보면 Makefile이 있다.
이것은 부트로더 소스의 AVR-GCC 컴파일 조건인데, 데시밀라 부트로더의 모든 정보가 들어 있다.
이 정보에 의하면, 아듀이노 데시밀라의 부트로더는 다음과 같다.
 
프로젝트 : diecimila
사용한 칩 ; ATMEGA168
발진 주파수 : 16 MHz
펌웨어 기반 : STK500 V1 (AVR-ISP V1과 같음 - AVR Studio에서는 접속이 안됨)
통신포트 : USB 가상직렬 포트 (COM1 ~ COM8을 사용한다)
업로드 속도 : 19200 bps
시작주소 : 0x3800

컴파일러 : AVR-GCC

기판을 다른 실행속도로 실행하려면, 아듀이노 소프트웨어(IDE)의 기판설정 파일을 수정해야한다.
새로운 기판에서 새로운 업로드 속도를 만들려고 한다면,  f_cpu 항목의 값을 수정해야,
개조하기 전과 같이 일상적으로, 스케치(응용코드의 소스)를 컴파일하고, 업로드할 수 있다.

delayMicroseconds(), pulseIn(), analogRead()는 다르게 반응하고, millis(), delay()와 직렬통신은 작동할 것이다.
16MHz의 표준 부트로더를 알맞게 수정한, 새로운 부트로더를 컴파일해야 할 필요가 있다.

부트로더 생성
arduino-0011 > hrdware > bootloaders > atmega168 > 폴더의 Makefile을 열고
AVR_FREQ = 16000000LAVR_FREQ = 20000000L 로 변경한다.

AVR-GCC나 WinAVR을 설치하고
arduino-0011 > hrdware > bootloaders > atmega168 >을 타겟으로 설정한다.
 
ATmegaBOOT_168_decimilla.hexATmegaBOOT_168_decimila.hex.bak 으로 이름을 바꾼다.
AVR-GCC에서 make decimilla 를 실행하여 새로운 부트로더를 생성한다.
 
새로운 부트로더 실행파일 ATmegaBOOT_168_diecimilla.hex가 나오면
자신의 이름으로 바꾼다. 본인은 ATmegaBOOT_168_digit.hex 라고 했다.
ATmegaBOOT_168_decimilla.hex.bak을  원래의 이름 ATmegaBOOT_168_decimilla.hex로 되돌린다.

새로운 부트로더 받기
ATmegaBOOT_168_digit.hex 부트로더는 첨부파일로 올려져 있다.
부트로더를 생성하지 않았다면, arduino-0011 > hrdware > bootloaders > atmega168 > 폴더에 복사한다.

새로운 부트로더 굽기
AVR-ISP를 USB 포트에 연결하고, AVR-Studio를 실행한다.
AVR-ISP의 타겟 케이블을 아듀이노 기판의 6핀 ISP 커넥터와 연결한다.
Tool >Prog-AVR >Auto Connect를 누르고, Program 창이 나오면
AVR Device를 ATMEGA168로 선택하고, Erase를 누른다.
Brows에서 자신이 컴파일한 새로운 부트로더를 선택하고 Program 단추를 누른다.

퓨즈설정에서 SPI 외의 다른 항목은 모두 끈다. 특히 Divid 1/8 Clock은 반드시 끈다.
다음 4 항목을 체크하고 Program 단추를 누른다.
Boot Flash section size = 1024 words Boot start address = $1C00; [BOOTSZ=00]; default value
Boot Reset Vector Enabled (default address = $0000); [BOOTRST=0]
Brown-out detection disabled; [BODLEVEL=111]
Ext. Crystal Osc.; Frequency 8.0 - MHz; Startup time PWRDWN/RESET: 16K CK/14 CK + 64ms; [CKSEL=1111 SUT=0]


Lock 비트의 설정은 다음과 같다.
Mode1: No memory lock features enabled
Application Protection Mode1: No lock on SPM and LPM in Application Section
Boot Loader Protection Mode3: LPM and SPM prohibited in Boot Loader Section


새로운 부트로더의 작동확인
새로운 부트로더가 올라간 아듀이노 기판에, 전원을 연결하고 작동시킨다.
MEGA168의 PB5는 아듀이노의 D13 으로 LED가 연결되어 있다. 깜빡이는지 보라.

아듀이노 개발환경의 기판추가
arduino-0011 > hardware > 폴더 안의, boards.txt를 에디터로 열고, 다음 문장을 추가한다.
digit.name=Arduino Digit  새로운 기판의 이름이다.
digit.upload.protocol=stk500
digit.upload.maximum_size=14336   부트로더의 크기를 뺀 실행코드의 최대값이다.
digit.upload.speed=19200   부트로더의 업로드 통신속도이다.

digit.bootloader.low_fuses=0xF7
digit.bootloader.high_fuses=0xdf
digit.bootloader.extended_fuses=0x00
digit.bootloader.path=atmega168    부트로더 hex파일이 들어있는 폴더이다.
digit.bootloader.file=ATmegaBOOT_168_digit.hex  새로 만든 부트로더 이름이다. 
digit.bootloader.unlock_bits=0x3F
digit.bootloader.lock_bits=0x0F

digit.build.mcu=atmega168   부트로더가 구워진 AVR 칩이다.
digit.build.f_cpu=20000000L   부트로더의 발진 주파수이다.
digit.build.core=arduino


응용코드의 시험
새로운 기판은 업로드 하기 전에, 기판의 공진자(resonator) X1을 20 MHz로 바꾸어 주어야 한다.
아듀이노 개발환경 소프트웨어인 arduino-0011.exe를 실행한다.
Tool >Boards > 에 자신이 추가한 기판이 Arudino Digit 라고 나오는지 확인한다.

File->Sketchbook->Examples 에서 적당한 스케치(pde)파일을 열고, 컴파일 한다음 오류가 없으면,
Tools > Seral Port >에 자신의 기판이 연결된 통신포트가 v로 표시되어 있는지 확인한다.

 
 
File > Upload to I/O Board를 눌러서 기판에 실행코드를 업로드 한다.
기판에 자동 리셋 회로를 추가하지 않았다면, 리셋스위치를 재빨리 눌러 주어야 한다.

D13의 LED가 깜빡이고, 잠시후 Done Upload 표시가 나오면 성공이다,
이제 기판에 업로드된 실행코드의 작동이 잘 되는지 확인하라.
원저자 : http://tokoya.justblog.jp/blog/2008/02/arduino-8dde.html

이 프로그램은 무료 소프트웨어로, 신체와 재산 상의 어떤 위험과 손해를 보상하지 않습니다.
이 프로그램은 GNU 무료 소프트웨어 배포규정을 따릅니다.
Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA

 AVRTOOLS™
posted by 털보네i
: