2010-03-31

Learn MVC

MVC stands for Model-View-Controller, a kind of architecture used widely to tackle the complexity of software design. Max first get to know MVC by reading the chapter "patterns of patterns" of the book "Head First design patterns". A very nice explanation MVC architecture from the perspective of design pattern. The following is some found good articles about MVC:

Note: Enhanced 3-D-reconstruction algorithm for C-arm systems suitable for interventional procedures

Two major challenges of 3D reconstruction of C-Arm system:
  • low number of projections
  • irregular sampling patterns caused by the mechanical instability
Two groups algorithms were applied to solve these problems:
  • algebraic method
  • analytical method (Feldkamp alg. like)
From 2D fan beam CT, it is known that a partial rotation over 180 degree is sufficient for reconstruction.

Reference:

2010-03-30

Compare two folders using WinMerge


In windows, if you want to compare the contents of two folders, the best choice is WinMerge. See sreenshot.

Screen shot tutorial of FreeRTOS


A good screen shot tutorial for beginer of FreeRTOS.


2010-03-29

RC Acquisition Principle


The RC acquisition method is used to detect the human touch of any capacitive touch by measuring the small variation of the touch electrode capacitance. Electrode capacitance (C) is periodically charged and discharged through a fixed register (R). The capacitance value (C) is calculated by measuring the charge time (t1) the (Vout) voltage requires to reach the threshold (Vth).

In touch sensing applications, the capacitance value (C) is the addition of a fixed capacitance (electrode capacitance, Cx) and the capacitance added by the human finger (touch capacitance, Ct) when it touches or is close to the electrode. Correspondingly, it takes more time (t2) to reach the threshold (Vth) during charge and discharge. The increasing from (t1) to (t2) indicates that a finger has touched the electrode capacitance.

Reference:

2010-03-26

Open Source RTOS

Three open source real time operation system (RTOS):
  • MicroC/OS: Now it is maintained by Micium
  • FreeRTOS: GPL licence. Very similar to MicroC/OS
  • RTLinux: A more complicated system based on Linux

Here is an comparison between FreeRTOS and RTLinux

2010-03-22

Port microC/OS-II to AVR32 UC3

We should understand that a software can be called kernel must fulfill at least these four tasks:
  • Task management, sometime call it scheduler.
  • Time management, handle timer, delay.
  • Intertask communication, how to share the resource between mutiple tasks.
  • Memory Management, e.g. how to allocation of memory.
However, these functionalities are implemented in a general way, so that it can be used in hopefully all kinds of CPU archtectures. Porting is to finish the rest job, namely, to make the kernel more specific to a certain CPU archtectures with a given toolchain.

Let's see a concrete example: Porting micro C/OS-II to AVR32UC3 microcontroller. The codes in the first block (uC/OS-II book) are the general implementation of kernel, implemented in standard C. If you check the code more closely, you may find that some used functions (or macros) are not yet implemented there. For example:
  • OS_TASK_SW()
The macro is used everywhere to switch context, saving the processor registers of task be suspended and restoring the registers of higher-priority task. The exact implemented is done in OS_CPU.H, you may notice that it is in the porting block (section 3). According to the used toolchains,

For GUN toolchains
  • #define OS_TASK_SW() __asm__ __volatile__ ("scall")

For IAR toolchians
  • #define OS_TASK_SW() (OSCtxSw())
If uC/OS is ported to Intel 80x86 architecture, the macro is defined by assambly instructions
  • #define uCOS 0x80
  • #define OS_TASK_SW() asm INT uCOS
In the graphic, BSP(Board Support Package) codes usually encapulate the utility functions for convenient access or configure the hardwares, e.g. timer, led and so on.

Usually, the porting is provided by vendor of chips, because these guys know it best and want their product as compatible as possible to all kernels.

Reference:

2010-03-19

What does SOC usually have?

System-on-a-chip or system on chip (SoC or SOC) refers to integrating all components of a computer or other electronic system into a single integrated circuit (chip). Usually it consists of

  • One microcontroller, microprocessor or DSP core(s). Some SoCs – called multiprocessor System-on-Chip (MPSoC) – include more than one processor core.
  • Memory blocks including a selection of ROM, RAM, EEPROM and flash.
  • Timing sources including oscillators and phase-locked loops.
  • Peripherals including counter-timers, real-time timers and power-on reset generators.
  • External interfaces including industry standards such as USB, FireWire, Ethernet, USART, SPI.
  • Analog interfaces including ADCs and DACs.
  • Voltage regulators and power management circuits.
Reference:
http://en.wikipedia.org/wiki/System-on-a-chip

RAM, ROM, and Flash Memory

A good explaination about RAM, ROM and Flash is given http://eu.dummies.com/how-to/content/ram-rom-and-flash-memory.html . A exmplaination with more detail is given at
http://www.escotal.com/memory.html.

RAM: Stands for random access memory; refers to memory that the microprocessor can read from and write to. When you create something in memory, it’s done in RAM. RAM is memory and vice versa.

ROM: Stands for read-only memory. The microprocessor can read from ROM, but it can’t write to it or modify it. ROM is permanent. Often, ROM chips contain special instructions for the computer — important stuff that never changes. The microprocessor can access information stored on a ROM chip whenever it needs to. The instructions are always there because they’re not erasable.

Flash: A special type of memory that works like both RAM and ROM. You can write information to flash memory, like you can with RAM, but that information isn’t erased when the power is off, like it is with RAM.


Reference:

2010-03-17

AT32AP7 is dead

Max just came back from "Embedded world 2010", with several evaluation board samples from hardware vendors. The biggest gift this year is a piece of development package from Atmel: AVR32EVK1100 board with a AT32UC3A0512 microcontroler, which cost more than 100 euro if you buy it.

He browsed the attached CD and surprisedly found that almost half doc introduced another series AT32AP7***. Maybe it is a parent series of AT32UC3, it is first guess of Max. After googling for some time, he realized that the AT32AT7 is dead and not recommanded for new design.

An important lesson: check the homepage of vender at first, which status is your chip, before you are going to use it.

References:

2010-03-16

AVR vs ARM

AVR and ARM are two kinds of CPU archtectures. A comparison between AVR32 UC3 and AMR7 is shown below:

MIPS and DMIPS

MIPS = Million-Instructions-Per-Second
DMIPS = Dhrystone MIPS

Dhrystone is a benchmark for the performance of CPU or micro-controller. See the citation

"Der Dhrystone-Test ist ein Benchmark für CPU-Leistung und Anwendungsprogramme. Er wurde in den achtziger Jahren entwickelt, später in die Programmiersprache Ada übersetzt und wird heute ausschließlich in der Programmiersprache "C" als industrieller Standard eingesetzt. Der Dhrystone-Code besteht im Wesentlichen aus einfacher integerer Arithmetik, aus String-Operationen, logischen Entscheidungen und Speicherzugriffen, wodurch die meisten universellen Computer-Anwendungen abgedeckt werden.

Bei dem Testergebnis wird die mittlere Zeit ermittelt, die ein Prozessor für viele Iterationen einer einzelnen Schleife benötigt. Die Dhrystone-Leistung wird in DMIPS oder Dhrystone MIPS/MHz angegeben.

Beim Dhrystone-Benchmark wird der getestete Computer mit einer Referenzmaschine verglichen. Als Referenzcomputer wurde die in den achtziger Jahren populäre VAX 11/780 von Digital Equipment herangezogen, der als Referenz 1 MIP zugeordnet wurde. Die VAX 11/780 erreichte 1757 Dhrystone pro Sekunde. Das bedeutet, dass alle Testergebnisse in "Dhrystone pro Sekunde" durch 1757 dividiert werden müssen, um einen Vergleichswert in MIPS zu erhalten. Ein Computer mit 120 MIPS (120 Dhrystone VAX MIPS) bedeutet also, dass dieser Computer 120 mal schneller arbeitet als die VAX 11/780... "

Reference:

http://www.itwissen.info/definition/lexikon/Dhrystone-MIPS-DMIPS.html

Knowledge Items for Embedded System

If you want to do something related hardware and drive development, I have some advise to you :
  1. you should study C well. Though some time we use assembly language, C is main and used mostly.
  2. you at least be familiar with a microcontroller, whatever a AVR MCU, or a ARM MCU. You should know it's basic principle and function, such as interrupt mode, clock management, power management etc.
  3. know some general devices' Operating mode and protocal, such SPI, USB, DMA, SDCard, etc. It's useful to develop application later, in different MCU, these devices' hardware maybe different, but there are similar principle and protocal.
  4. then you can study some things about RTOS, such as ucos, freertos, etc. It's useful to design some multitask and real-time projects.

But if you want to develop embedded application base on embedded OS, you can:
  1. study something about bootloader, it will help you to understand the startup of the system.
  2. choose a embedded OS to start, linux or WinCE, this depends on youself. But no matter which OS, you have to spend a lot of time to study.
  3. you'd better to know how to build a OS, and develop driver base on a OS.

Reference:
http://www.programmersheaven.com/mb/embedded/393622/394143/re-avr-or-arm-microcontroller-for-starting/?S=B20000