Week 7 –
Embedded Programming
Read
a microcontroller data sheet.
Program your board to do something with as many different programming
languages and programming environments as possible.
Goal:
Make a digital spirit level (carpenter’s level) with an accelerometer and LEDs.
Result:
Days of debugging my board.
Useful
Resources:
Spent
the first half of the week working my way through the C Book, the AT Tiny44
Data Sheet, and installing/learning Arduino. On
Saturday I went into the IDC lab with the intention of trying blink.
I
had no luck with the Fab ISP so I tried the AVR ISP2. Still no luck. Blinking red lights (which I was told
meant the board wasn’t getting power.
I remade the board with no luck, then had it pointed out to me that my
reset wasn’t getting power. I added
a jumper wire without success. I redesigned the circuit and remade the board
– still blinking red lights. I checked every connection to ensure
continuity and an absence of shorts.
With
help I identified a flaw in the circuit, remade the board, and plugged it in.
Green
light
I
then opened arduino (having loaded the ATTiny 44A files) and went to burn bootoader. I received the following message:
I
tried using Makefile to load Echo, and received a similar
error:
make: *** [program-avrisp2] Error 1
Simon-Colleys-MacBook-Air:echo simonscolley$ make -f hello.ftdi.44.echo.c.make
program-avrisp2
avr-objcopy -O ihex hello.ftdi.44.echo.out hello.ftdi.44.echo.c.hex;\
avr-size
--mcu=attiny44 --format=avr
hello.ftdi.44.echo.out
AVR Memory Usage
----------------
Device: attiny44
Program: 840 bytes (20.5% Full)
(.text + .data + .bootloader)
Data: 33 bytes (12.9% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c avrisp2 -U flash:w:hello.ftdi.44.echo.c.hex
avrdude:
stk500v2_command(): command failed
avrdude:
stk500v2_program_enable(): bad AVRISPmkII connection
status: Unknown status 0x00
avrdude: initialization
failed, rc=-1
Double check connections and try
again, or use -F to override
this
check.
avrdude done. Thank
you.
Tried
other people’s machines – same result, so I went back to look at the
board, and came across the following:
My
trace overlapped the terminal on the microcontroller, but wasn’t connected.
Which
brings me to my significant learning of the week. In Eagle, it is possible for wires to
overlap terminals (on jumpers or microporcessors) and
not be recognized as a contact.
This can be solved by emhasizing the connection manually
Which showed me the following in Schematic (after removing the wires that had previously appeared to be doing something):
My reset pin was getting straight VCC without passing through a resistor ( I should have noticed that), and the same pin needed to be connected to the appropriate pin on the 2x3 jumper.
Here is the modified board.
Frustrating exercise for no result as yet, but I have learned a lot more about electronics and Eagle and am looking forward to programming the new board.