Embedded Programming

After designing and creating our PCB, its time to program it.

Before we can program the main boards, we will need a programmer to connect the board to the computer, this will depend on what microchip you are using:

  • ATTIY412 : UPDI programmer
  • ATTINY45/85 : ISP programmer

As I decided to make the ATTINY85 board, I will need to make the ISP programmer.

ISP programmer

After cutting out and soldering the board this is what I get:

In order to program this ISP board I made I will need another ISP to program it before being able to use it.

1.First I need to download and install several things:

2.For your computer to recognize and locate the files you will need to Edit environment variable:

a) In start search, type "env" and select "Edit the system Environment variables".

b) Under advanced tab, click "Environment Variables..."

c) Under User variables, locate "Path" and click edit.

d) Click new, and copy-paste the directories of the files from your computer.

3.Connect the Fablab's ISP to the computer and connect the ISP to be programmed using wires. The red LED o both boards should light up.

For your computer to recognise the FabISP, you will need zadig. Open Zadig, ensure the ISP is properly connected and install "libub-win32" driver.

After installing:

4.In the fts_firmware_bdm_v1 file, open the Makefile with a text editor (I used notepad). As I'm using attiny85 I will need to make changes as shown:

In the File explorer, I type "cmd" at the front of the file directory and hit enter, a command prompt will appear.

a) Type "make" and press enter. 3 files should appear in fts_firmware.

b) Type the following commands in this order, every command input you should see the LED light flashing:

make flash

make fuses

make rstdisbl

By now your ISP board is done and ready to use! \(^O^)/

Hello Echo board

Once the echo board is done you can prepare it for programming. I used an ATTINY85 board.

The diagram below shows the pin layout of the ATtiny85. From here you can identify the analog pins and port pins.

I first Identified and noted down the pins, button and LED.

To configure the board such that it can be programmed with Arduino, we will need to import a library for it to recognise the board.

Open the Arduino software. Under the Files tab click preferences. Insert the URL "http://drazzy.com/package_drazzy.com_index.json" under additional Boards Manager URLs and press ok.

Next go to the Tools tab. Under Boards go to Boards Manager. Search for ATTiny Core by Spence Konde and install.

Next is connecting your Echo board to the ISP programmer. Note that the pinouts from the ATtiny85 must be connected to each other (i.e Pin 1 from the ISP programmer will be connected to pin 1 from the Echo board).

Once connected, under Tools, change the settings as shown, then pres Burn Bootloader. Your board will be ready for programming.

Test program: blinking LED

To test the board I programmed the LED on the board to blink.

Blink LED program:

//ATtiny85 Hello Board

  #define led 4

  void setup(){
    pinMode (led, OUTPUT); 
  }
  
  void loop(){
    digitalWrite(led,LOW);
    delay(250);
    digitalWrite(led,HIGH);
    delay(250);
  }
  

Once the program uploads the LED would start blinking.