Embedded Programming

My environment

Use Arduino IDE

IDE setting

First, I setted Arduino IDE to ba able to use attinies. I refferd this site.

Bealow is setting for my environment.

I selected "ATtiny24/44/48". My board use ATtiny44.

I selected crock "external 20MHZ".

I selected "USBtiny ISP"

writing Bootroader

I wrote bootroader.I recieved message "Boot loader write completed".

writing program

use serial

I used example sketch for Blink Led.

I change number of led to 6. And I wrote it. I recieve complete message, but LED did not blink.

I mistook the pin number.I connected Led No.6 of attiny, it is No.8 of ArduinoIDE. Like below.So I change Led number in my program 6 to 8.

Then it blinked!

Next I wrote program that when I input "a" or "t", it converted to Morse code and the LED glow shiny.

It worked on Arduino but did not work on Hello.echo board.

use button

I write a program that while I push button, then LED turn off.It worked!

Hello echo by terminal

First, I download hello.ftdi.44.echo.cand hello.ftdi.44.echo.c.make. and put these a folder(named hello.echo) on my desktop.

And I connect my helloecho board (ver.2) by my Fab isp and ftdi cable.

Then I input terminal$ cd desktop/hello.echoand$ make -f hello.ftdi.44.echo.c.make .

I saw error messages. I think there is not somthing need to use avr, driver or package or ...

I Downloaded and install CrossPack again.And I downloaded the firmware source code and open my terminal program and cd into the source code directory.Run make.

An error message appeared.

make: avr-gcc: No such file or directory make: *** [main.o] Error 1

I made sure that crosspack-avr was installed or not.It maybe had been installed in Macintosh HD ▸ usr ▸ local ▸ CrossPack-AVR-20131216.(refer).
These files are invisible files, so I type below command, then these files appeared.(refer)

defaults write com.apple.finder AppleShowAllFiles true killall Finder

Crosspack-avr existed but its command (avr-help and avr-project) did not work.
I cheched path.$ echo $PATHThere were not the path.
I setted path.(refer)

I opened .bash_profile and add path. (vim command refer) export PATH=$HOME/usr/local/CrossPack-AVR-20131216/bin$PATH

It did not succeed.Next I type below.

PATH=$PATH:/usr/local/CrossPack-AVR-20131216/bin export PATH

I re-read ".bash_profile" then checked path again.It existed


$ source ~/.bash_profile $ echo $PATH

I rebooted terminal and type avr-help, help page opened.Crosspack-avr worked.

I tried "make" firmware again. This time, it succeed.

Ready.I tried "make" hallo.ftdi44.echo again.

$ make -f hello.ftdi.44.echo.c.make

It succeed.Perhaps when I set the path last time, I only had a temporary way of setting, I think that the pass did not pass this time.


$ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses

$ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny

Writing was maybe succeed. I tried to check hello.ftdi.44.echo work.

$ python term.py /dev/tty.usbserial-FTHBRG3N 115200

An error message appeared.

python: can't open file 'term.py': [Errno 2] No such file or directory

I downloadedterm.py.

I tried again.

$ python term.py /dev/tty.usbserial-FTHBRG3N 115200

Anothe error masage appeared.

SAKI-MURATA:hello.echo murasaki$ python term.py /dev/tty.usbserial-FTFBF4UI 115220
Traceback (most recent call last):
File "term.py", line 15, in
import sys,time,serial
ImportError: No module named serial

I changed the way.I tried to use Arduino IDE's serial monitor.

I opened Arduino Serial monitor. but Error.."Board at /dev/cu.usbmodem1421 is not available".I made sure Serial port,/dev/cu.usb〜 did not exist.

I checked whether the PC recognizes USB.

ls /dev/tty.*

There was no proper port.There were "/dev/tty.Bluetooth-Incoming-Port" and "/dev/tty.RNBT-37C9-RNI-SPP"

My computer recoganized Arduino,I connected Arduino then "/dev/tty.usbmodem1411" was appeared,so usb port worked.ftdi did not worked.

I connected the board to windows PC (with same ftdi cable and Fabisp), and opened ArduinoIDE's Serial monitor. When I type "test",then message appeared, but word I typed was not be recoganized.

After Asia review,My tutor and Mr.Tamiya(Fablab kamakura) gave some adovice.

I installed get-pip.py and type $ sudo python get-pip.py $ sudo pip install pyserial

And I installed fidi driver

I type $ ls -l /dev/tty.*Then " /dev/tty.usbserial-A900fDrP"appeared.

So I type "$ python term.py /dev/tty.usbserial-A900fDrP 115220" then term.py and hello.echo. worked!

Atmel studio

I tried to use Atmel studio on windows.But I could not select isp, it not appeared, so I could not write any program.

files

download all files