Embedded Programming

Week 9 - Embedded Programming NOTES

General info

Here you will find my work description during this nineth week

Things to do

Questions to ask

Useful resources

Assignments

Group assignment

  • experiment with other architectures

Individual assignement

  • Read a microcontroller data sheet.
  • Program your board to do something, with as many different programming languages and programming environments as possible.
  • Optionally, experiment with other architectures

Raw class notes

Weekly reviews :

Claus Nicolaisen talk about Shopbot incident

class :

First thing we have to do is pick an architecture. MP is MicroProcessor, MC is MicroController

MC is a simpler MP

Read a datasheet Diagram We need to understand how a MC works

Memory

Registers Static (fast) RAM and Dynamic RAM EEprom Flash Fuses (put the configuration settings bits into the fuse)

periphericals

timer/counter PWM UART and USB communicates with real world

Word size

we start with 8 bits processors (millions instructions per second) can use 64 bits instructions but it will do in several instructions

megaprocessor.com he made a processor using individual transistors

famillies

We focus on AVR

ARM is processor archi family

PSoC,

AVR are cheap, comes is small packages

octopart.com to get prices Digikey, mouser, farnell are good global distributors

Sparkfun, adafruit have special boards

AVR Familly

ATtiny10 is tiny !

ATmega 328P is used by arduino ATmeaga16U2 has usb support

The letter behind the chip name ? ATtiny45V V version is for low voltage usefull for batteries

search for AVR tutorials

The clock system you can use internal or external clock (resonator, crystal res+capa)

The datasheet give you the speed you can run it.

In-system program

ISP, header, clios, pins, … several ways to program

DFU is a bootloader from Microchip JTAG ICE needs a programmer, same as PDI

Programmer

AVRDude is a tool to write MC rom, EEprom

A sutent made an poen version of PDI programmer skeate/FabPDI

assembly

MP has instructions sets we can write code in assembly language used if you need high timing accuracy

C

intermediate level C is more performant than python

“Learn C the hard way”

start with provided C sample programs and change them

GCC open source compiler, convert C program into hex code. avr-libc is a library (standard types, maths, modules) packages to install ubunto atmel studio 7 for windows (ditribution of gcc tool for windows)

debuggers (atmel studio can comminunicate with programmer) when your MC can communicate use printf (serial communication)

Serial communication

python : pySerial js : node serialport

USB UNiversal Serial Bus, is more complex than serial

FTDI make popular chip to convert USB into serial signals FabFTDI ppatil

programming exemple

We can use Mods “websockets” + “character in out”

have a look on the hello.c program

interrupts ??

each of these as a Make file used to convert the C into hex file

XMega

is the new familly from atmel, hight performance, high speed

IDE

Atmel studio is powerfull Arduino Eclipse

Firefly for grasshopper

Boards

Trinket 7€ olimex pololu

Arduino

Arduino is

  • standard board
  • standard library
  • IDE
  • bootloader
  • header

fabio 1-1 is a simple design you can make is fablab

Arduino is C but using a library (has a big cost in memory and speed)

ARM

Atmel ARM STM32 Neil’s favorite: nordic semi nRF52 had radio, design for realtime preocessing, good for radio messaging Fanstel nRF52 we can use it as a processor student made a hello world pub/hello-world/nrf52

mbed is a while framework to manage IoT devices

interpreters

for high level programming Espruino (JS), Tessel

For assignment

Try to use several ways to code your board, Arduino IDE, GCC avrdude AVR Studio, …




Share this story