Week 7:    Embedded
        Programming
      
    This week, I studied a microcontroller datasheet
      during our section with our TA, Nadya. 
    
    Then I spent more of my time to learn AVR
      programming in Windows. Helpful resources are: high low tech
      tutorials, fab academy instructions, youtube videos and 2013
      archives (in particular Matt Carney if you are working on
      windows).
      
      First of all, I need to install all the software (including
      drivers) to my PC. These include WinAVR, FabISP firmware, 64-bit
      windows drivers for USBTinyISP and FTDI drivers. However, I tried
      to follow the instructions from  Mighty
        Ohm, but I suspect the USB driver installation workaround
        mentioned in the instructions did not work for my machine as I
        continue to get Error 1 during WinAVR programming. 
      
      Indeed, installing Win AVR and different drivers were quite a
      project for beginners. I referred to multiple Youtube videos to
      see how other people did it in Windows.
      
      I tried to two different ways to program my board: (1) using a
      "makefile" and (2) manually compile code using windows command
      window. Then, I also tried to check if hello.ftdi.44.echo is
      working.
      
      First method: using a "makefile"
      
      1. Download all the files on course page into a folder. 
      2. Open windows command window in this folder.
      3. Type: make -f hello.ftdi.44.echo.c.make program-avrisp2
      4. This will convert the c files into hex files.
      
      
    
    Second method: manually compile code using
        windows command window
      
      1. Compile an assembeler file: avr-gcc -mmcu=attiny44 -o
      hello.ftdi.44.echo.out hello.ftdi.44.echo.c
      2. Compile a hex file from assembler file: avr-objcopy -o ihex
      hello.ftdi.44.echo.out hello.ftdi.44.echo.hex
      3. Program the microcontroller: avrdude -p t44 -c usbtiny -U
      flash:w:ftdi.44.echo.hex
      
      The process went thru and I can see hex file created in the
      folder. However it also returned Error 1 as PC doesn't seem to
      recognize USB.
      
      Check if hello.ftdi.44.echo is working
    
    1. Open a terminal program such as Python
        terminal. You should download this file to your PC.
        2. However, in order to make above work, you need to install Python
            2.7 
        and PySerial.  I also
        installed unofficial Windows binaries for Python Extensions.
        3. Then I typed in python term.py com6 115200. 
        4. However, the system first returned "python is not recognized
        as a syntax." I used Youtube again and realize I need to edit
        the "path" in control panel -> system -> advanced setting.
        I managed to make this work.
        5. Then I got to terminal window for the port. Yet, as I suspect
        my USB driver is not correctly installed, the terminal did not
        return keystrokes as I typed...