week 8

Embedded Programming

ASSIGNMENTS:

  • Read a micro controller datasheet. (8183s).
  • Program the board with as many different languages possible to do certain task.
  • Optionally,experiment with the other architecture.

home

about me

weekly work

reading the attiny

datasheet

final project

The first assignment in this week was to read a datasheet of a micro-controller and put up the findings from the same. For this exercise we were given a datasheet from CBA, MIT to start with.

 

I am fairly new to electronics, so reading a 286 page document seemed a dreadful work for me. I had the same situation in Week 6 electronics design, where I read the pinout of each micro-controllers. Eventually I found an abridged version of the datasheet and started with that one. That was fairly small (22 pages).

FabLab CEPT

This abridged data sheet is divided in simple 10 sections:

  1. Features
  2. Pin Configurations
  3. Overview
  4. General Informations
  5. Register Summary
  6. Instruction Set Summary
  7. Ordering Information
  8. Packaging Information
  9. Errata
  10. Datasheet Revision History

understanding

datasheet

This datasheet gives information about ATTiny 24A/44A/84A.

 

From the feature page I got to know about the  about its operative voltage, architecture , speed grade and I/O packages.

 

It gave me a fair idea about in what kind of projects I can use ATTiny and what are the limitations and advantages of the chip while thinking of any project.

 

Possibly I can not make the robotic arm with ATTiny as it has only 4PWM pins.

In terms of speed, ATTiny44A serves same speed as ATMega of 20Mhz.

The number of pins regarding power, AREF GND is less than ATMega328p so it might used for small projects or large projects using networking. For the Robot control I prefer the other architecture for this reason.

programming

The first step to program the board was to Burn the bootloader onto the ATMega328p. It is a firmware that allows to install new firmware without the need of another programmer. [Source: https://www.arduino.cc/en/Hacking/Bootloader]

As I have designed my board based on the Satshakit's schematic and put header pin to facilitate programmer pins and FTDI pins, I will burn the bootloader using schematic suggested by Danielle Ingrassia.

For that I will need an Arduino and 6 Jumper wires.

This is Daniele's schematic of connections to burn the bootloader. I have adapted that in my board.

Select the Propoer port. use Arduino as ISP.  Select Arudino/ Genuino Uno as board.

Now, we need to modified ArduinoISP code to the arduino.

As we are using older version of Arduinos we need to uncomment line 81 to use:

Pin 11 :MOSI

Pin 12 : MOSI

Pin 13: SCK

Pin 10: RESET

Now this code makes Arduino act like a in system programmer helps to push code through it to another MCU. So when I try to burn the bootloader, it wont be burnt in the arduino connected to it but to the Krab Board. Arduino will push the firmwire in the blank MCU.

It will take 512byte of flash memory of 32kb available in ATMega 328p

Based on the chip ATMega 328P I could burn bootloaders of Pro Mini, Nano, Lilypad Uno etc. But I needed to burn Uno's bootloader for further leverage.

Next was to program the board accordingly.

First the board I made for Electronics Production were connected using FTDI Cable.

I have used the board using 2 Programming environment.

  • Arduino IDE
  • Grasshopper

FTDI Cable to connect the Board.

Board Connected with FTDI. Now the Arduino IDE was opened and configured.

So, the board is using COM port 8 to communicate.

Now the Modified blink code has been uploaded to the board and It worked. The video will follow to show the process. Now Firmata is uploaded to take the coding with grasshopper.

Once the Firmata is uploaded the board can be programmed with grasshopper and Firefly easily.

Firefly firmata has been written by Andy Payne,

 

Firmata usually is a protocall that allows software interaction with arduino. In the particular Firefly Firmata it does the particular things:

  • Arduino Uno has 14 Digital I/O pins. but in Firefly firmata it make 2,4,7 as input only.
  • Rest all digital pins does output including PWM
  • Analog read as usual.

Defines Servos in PWM pins.

after defining scope of each board the code sets up the serial read and write environment.

when to write a value to the board based on comma separator and serv values judging by the type.

 

Next was to open up grasshopper and play with the grasshopper code to interact with the board in (almost) realtime.

Open Up grasshopper.

Bring the Ports available and Open Port to communicate with COM 8 Port. use a boolean toggle to open / close port.

Now get a Uno Read component as our board has Uno's bootloader burnt into it. It will be detected as an Uno.

Now connect port to uno read to read from particular port and And boolean toggle to write to Krab.

Now configure a blink component in firefly at 250ms interval and Set the Dpin3 to DIGITAL.

It will make the LED Blink.

Now set the Dpin3 to PWM to do a fading of LED. Connect a 0-255 slider to it and move it.  The results are as follows.

The code for this week are here.

 go to WEEK 9 >>

Avishek Das   |   2017   |   FabLab CEPT