Embedded Programming [Week 9]



Group members


Group assignment


Experiment different architectures in addition to ATtiny44A



Work description


A bit of introduction first

The set of instructions a CPU can understand and execute is called ISA (Instruction Set Architecture). An implementation of an ISA for a CPU can be classified according to its complexity. The two main types are CISC (Complex Instruction Set Computing) and RISC (Reduced Instruction Set Computing).
CISC was developed in the 60's, as a way of standardizing how the computers were programmed, and thus make code compatible for different computers. CISC offers a set of complex and specialized instructions; they have longer execution time (more CPI or Cycles Per Instruction) but group several low level operations. This results in smaller and simpler programs with not many accesses to memory.
RISC was developed in the 70's, and proposes a totally different approach. RISC offers a set of simple and general instructions; this allows to have shorter execution time (fewer CPI) but may need to execute several instructions for a complex task. This may result in longer and more complex programs with more accesses to memory. But may lead to less power consumption
Main differences can be summed up as:

CISC RISC
Multi-clock complex instructions Single-clock simple instructions
Less lines of code (and thus less RAM) More lines of code (more RAM)
Higher CPI Lower CPI
More power consumption Less power consumption


Raspberry Pi uses an ARM processor. ARM stands for Advanced (originally Acorn) RISC Machine.
The STM32 is a family of microcontroller ICs based on the 32-bit RISC ARM.
ATtiny 44 is an AVR RISC architecture
Intel family and Motorola 68000 family are CISC


Experimenting

Rasberry Pi 3

Rasberry Pi was the easiest one to do the groupwork with. We followed the instructions in a raspinews website It only required to find suitable components for and a breadboard for testing, because the Rasberry Pi had already python-rpi.gpio and python3-rpi.gpio installed. The components were 1 kOhm resistor and white led. The code we used was also in the instructions, but we had to modify the indented error. There was spaces in all the lines of code and it didn't work right out. It worked perfectly and the Rasberry Pi turned the led on for one second and then it was off for one second. This was looped until the program was ended.

STM32F401RE

Nucleo-F401RE was easy to work with as well. There was good documentation for its programming with Arduino IDE. In the Arduino IDE, you just needed to add Additional Boards Managers URLs: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json. Now there is at the bottom of the list STM32 Cores in the Tools -> Board menu -> Boards Manager. Click install button to install it. Now you can select Nucleo-64 board and board part number: Nucleo F401RE. Now you just have to create Nucleo_map folder in Arduino libraries and put remapping of the pins in there, both header and cpp. The code was added to Arduino IDE, compiled and programmed to board and it worked. It was blinking internal led on board and our external led on breadboard.

Available feature on the board obtained from Microchip site Atmel XMEGA-E5 Xplained Hardware User Guide General Information

Our local instructor Juha-Pekka Mäkelä guided us to get started in using Atmel Studio, which we used in experimenting Atmel XMEGA-E5 Xplained.

We could not manage with Atmel xmega e5. We tried. But we could not even build a project for it in ATmelStudio.

Code


Here is the code used in the groupwork: