Week 7 - Embedded Programming

Chintan Vaishnav


Get your board to do something.

Crosspack, FTDI and Term.py

Decided to use Neil's ftdiecho program and see if I can talk to the board first. Had the following hickups.

  • My FAB ISP (from the first week) stopped working. I had to use the AVR or borrow it from someone who had two. I will be fixing my FAB ISP now.
  • make, fuses, and program worked well, although I was unable to see my FTDI in devices (/dev). Later I realized I did not have the FTDI drivers for OS X.
  • Had several difficulties running term.py. First, "import serial" failed in when executing term.py because I did not have serial port support in pythone. Downloaded the same by following instructions here. The actual download was from Python Package Index. Next, the terminal opened but I did not know which /dev to connect to. This problem got solved much later after I installed the OS X drivers on my Mac. In the meanwhile, I was able to echo from my board by using a terminal from Ubuntu, so I knew the Tx, Rx communication and a few things on the board were working.
  • TermpyEcho
    Echo Program

    I then modified the program to echo back the characters in upper case.


    Decided to use the blink program from Arduino next.

    There were several hurdles here too:

  • First, I did not see the ATTiny44 in the board list. This problem was solved by downloading and installing the ATTiny44 supoort for Arduino from here.
  • Next, I did not have Arduino bootloader on my board, which I got around by using "File->Upload Using Programmer" option.
  • >
  • At first, the LED did not blink. I had soldered the LED with a wrong polarity. Once I re-soldered the LED with its cathode to the ground, it blinked.
  • I played with the blink rate of the LED by changing the code. Most of the times, I modified Neil's makefile from arduino.m168 to change it to use Attiny44 as I iterated with my code.

    I now got on to changing the program to add code to use the button. I wanted to turn the LED on when the button is pressed. I first tried to use the pin_test function on Neil's blink code. This did not work. So, I decided to use the definitions of the PINA, PA3, and _BV directly from avr/io.h.
    I have to say, I don't fully understand how these definitions work in io.h, but they work. They let me read pin 3 on the chip to see if the button is pressed, and when it is, I turn the LED on.

    Button Press and LED Blink