Vital Fundamentals of Embedded Systems

VITAL FUNDAMENTALS OF EMBEDDED SYSTEMS

INTRODUCTION:

Embedded systems are the devices in which a tiny microcontroller or microprocessor is placed. The microchip is fed with a C program or assembly language according to its desired function. This device performs a single assigned function.
All components have to utilize the memory optimally.

We can see today that the 21st century is widely advancing in embedded technology.

Need for Embedded technology:
As time advances technology advances the convenience of the user is the most important priority. Embedded systems achieve this by reducing the size of internal components vastly whilst retaining the performance of the system.

SALIENT FEATURES OF EMBEDDED SYSTEMS:

 

  1. They can save a lot of space
  2. Can incorporate a lot of functions into a system
  3. Provides convenience to the users in many ways by providing a simple interface.
  4. Precise control over the system at any time.
  5. Security
  6. Reliability
  7. Energy
  8. Safety
  9. Time-saving

Primary prerequisites:

  1. Embedded C software compiler-such as KEIL (popular)
  2. Software developer tools.
  3. Simulator

APPLICATIONS OF EMBEDDED SYSTEMS:

  • Watches
  • Robotics
    Aerospace
  • Biomedical science
  • Washing machines
  • Traffic systems
  • Calculators
  • Household equipment

EMBEDDED SYSTEMS COMPONENTS:

  1. Hardware
  2. RTOS(Real-time operating system)
  3. Software application.

HARDWARE COMPONENTS:

These include:

  1. Input and output devices.
  2. Primary and Secondary memory.
  3. Networking units.

CLASSIFICATION OF EMBEDDED SYSTEMS:

There are mainly three types of embedded systems based on industry scale production:

  1. Small-scale
  2. Complex scale
  3. Medium scale
INTRODUCTION TO MICROPROCESSORS

It is basically a microchip(small computer) placed onto an architecture of the main system.

Its Central processing unit comprises of

  1. Arithmetic processing unit
  2. Registers
  3. Stack pointer
  4. Interrupt circuit
  5. Timing circuit
  6. Read only memory and random access memory.
  7. Memory decoder
  8. Serial and parallel ports
  9. Oscillator
DIFFERENCE BETWEEN MICROPROCESSOR AND MICROCONTROLLER

 

MICROPROCESSORMICROCONTROLLER
Fast transfer of data between data and microprocessorSimilar transfer between mp and code and data
Less bit handling instruction usually one typeMany bit handling data
Used in general purpose digital computersUsed at the application level
ALU, Registers, timing and control unitsInclude additional components such as Timer, parallel I/O, RAM, EPROM, ADC and DAC in addition to the basic functional blocks of microprocessors
DIFFERENT TYPES OF PROCESSORS:

1.EMBEDDED PROCESSORS

Embedded processors are used for fast switching operations.

Eg:- INTEL

Application specific system processor:

2.APPLICATION SPECIFIC SYSTEM PROCESSOR:

They are used to perform a specific set of instructions in a short amount of time.

3.MULTIPROCESSOR SYSTEMS:

Used when a single processor does not meet the demands. In this processor, all tasks are simultaneously done for optimal performance.

E.g:- Octa, hexa, deca, quad core processors.

DIGITAL PROCESSING SYSTEMS:

Finds large applications such as audio and video processing as well as telecommunication devices.

Used when the fast processing of signals is required.

 

C Program for Students Details Using Structure

Write a C program to create a structure named student and print the name, age, and gender of two students (two structure objects)?

What is Structure?

The structure is a user-defined data type in C. Structure allows you to combine data items of different kinds. It is used to represent a record. Suppose you want to store a record of Student which consists of student name, address, roll number and age.

C Programming Tutorial

 

This program stores the information (name, age and gender) of students using structures.

#include<stdio.h>
int main()

{
struct stud
{
int age;
char name[20];
char gender[10];
};

 

struct stud *a;

struct stud a1;
printf(“Enter the name\n:”);
scanf(“%s”,&a1.name[0]);
printf(“Enter the age:”);
scanf(“%d”,&a1.age);
printf(“Enter the gender:\n”);
scanf(“%s”,&a1.gender[0]);

struct stud a2;
printf(“Enter the name\n:”);
scanf(“%s”,&a2.name[0]);
printf(“Enter the age:”);
scanf(“%d”,&a2.age);
printf(“Enter the gender:\n”);
scanf(“%s”,&a2.gender[0]);

 

a=&a1;
printf(“%s\n”,a->name);
printf(“%d\n”,a->age);
printf(“%s\n”,a->gender);

a=&a2;
printf(“%s\n”,a->name);
printf(“%d\n”,a->age);

printf(“%s\n”,a->gender);

}

Stay Connected with us for more Tutorial on C Programming Language. See here for more C Programming Language

Embedded ARM Tutorial

EMBEDDED ARM (ACORN REDUCED INSTRUCTION SET MACHINE):

Introduction:

  • ARM, previously Advanced RISC Machine, originally Acorn RISC Machine, is a family of reduced instruction set computing (RISC) architectures for computer processors, configured for various environments.

 

  • British company ARM Holdings develops the architecture and licenses it to other companies, who design their own products that implement one of those architectures‍—‌including systems-on-chips (SoC) and systems-on-modules (SoM) that incorporate memory, interfaces, radios, etc.

It also designs cores that implement this instruction set and licenses these designs to a number of companies that incorporate those core designs into their own products.

MAJOR ADVANTAGE:

  • Processors having this architecture fewer number of transistors.
  • These characteristics are desirable for light portable devices and mobile phones.
  • Almost 100 billion ARM processors have been manufactured making it the biggest seller of 2017
  • Cortex core and securecor are the currently available Cortex cores.

HISTORY:

  • The british company Acorn started manufacturing these in the year 1980’s.
  • This architecture employed he relatively simple MOS Technology 6502 processor to address business markets like the one that was soon dominated by the IBM PC, launched in 1981.

APPLICATIONS OF ARM:

  • ARM cores are used in a number of products, particularly PDAs and smartphones.

 

  • Examples:-

 

  1. Microsoft‘s first generation Surface
  2. Surface 2
  3. Apple‘s iPads
  4. Asus‘s Eee Pad Transformer tablet computers
  5. Chromebook laptops.

Others include:

  1. Apple’s iPhone smartphone
  2. iPod portable media player
  3. Canon PowerShot digital cameras
  4. Nintendo Switch hybrid
  5. 3DS handheld game consoles
  6. TomTom turn-by-turn navigation systems.
DEBUGGING OF ARM:

All modern ARM processors include hardware debugging facilities, allowing software debuggers to perform operations such as:-

  1. Halting
  2. Stepping
  3. Breakpoints of code starting from reset.

These facilities are built using JTAG support(Joint test action group)

JTAG is an IEEE standard (1149.1) developed in the 1980s to solve electronic boards manufacturing issues.

Nowadays it finds more use as programming, debug and probing port, though some newer cores optionally support ARM’s own two-wire “SWD” protocol.

In ARM7TDMI cores;-

The “D” represented JTAG debug support

The “I” represented the presence of an “EmbeddedICE” debug module.

For ARM7 and ARM9 core generations, EmbeddedICE over JTAG was a de facto debug standard, though not architecturally guaranteed.

The ARMv7 architecture defines basic debug facilities at an architectural level.

The actual transport mechanism used to access the debug facilities is not architecturally specified, but implementations generally include JTAG support.

There is a separate ARM “CoreSight” debug architecture, which is not architecturally required by ARMv7 processors.

32-bit architecture(ARMv7):

An ARMv7 is used to power the popular Raspberry pi-2 micro-computer.

The 32-bit ARM architecture, such as ARMv7-A, was the most widely used architecture in mobile devices as of 2011.Since 1995, the ARM Architecture Reference Manual has been the primary source of documentation on the ARM processor architecture and instruction set, distinguishing interfaces that all ARM processors are required to support (such as instruction semantics) from implementation details that may vary. The architecture has evolved over time, and version seven of the architecture, ARMv7, defines three architecture “profiles”:

  • A-profile, the “Application” profile, implemented by 32-bit cores in the Cortex-A series and by some non-ARM cores.
  • R-profile, the “Real-time” profile, implemented by cores in the Cortex-R series.
  • M-profile, the “Microcontroller” profile, implemented by most cores in the Cortex-M series.

Although the architecture profiles were first defined for ARMv7, ARM subsequently defined the ARMv6-M architecture (used by the Cortex M0/M0+/M1) as a subset of the ARMv7-M profile with fewer instructions.

CPU modes:
  • Except in the M-profile, the 32-bit ARM architecture specifies several CPU modes, depending on the implemented architecture features.
  • At any moment in time, the CPU can be in only one mode, but it can switch modes due to external events (interrupts) or programmatically:-
  • User mode: The only non-privileged mode.
  • FIQ mode: A privileged mode that is entered whenever the processor accepts a fast interrupt request.
  • IRQ mode: A privileged mode that is entered whenever the processor accepts an interrupt.
  • Supervisor (svc) mode: A privileged mode entered whenever the CPU is reset or when an SVC instruction is executed.
  • Abort mode: A privileged mode that is entered whenever a prefetch abort or data abort exception occurs.
  • Undefined mode: A privileged mode that is entered whenever an undefined instruction exception occurs.
  • System mode (ARMv4 and above): The only privileged mode that is not entered by an exception. It can only be entered by executing an instruction that explicitly writes to the mode bits of the Current Program Status Register (CPSR).
  • Monitor mode (ARMv6 and ARMv7 Security Extensions, ARMv8 EL3): A monitor mode is introduced to support TrustZone extension in ARM cores.
  • Hyp mode (ARMv7 Virtualization Extensions, ARMv8 EL2): A hypervisor mode that supports Popek and Goldberg virtualization requirements for the non-secure operation of the CPU.
  • Thread mode (ARMv6-M, ARMv7-M, ARMv8-M): A mode which can be specified as either privileged or unprivileged, while whether Main Stack Pointer (MSP) or Process Stack Pointer (PSP) is used can also be specified in CONTROL register with privileged access.This mode is designed for user tasks in RTOS environment but it’s typically used in bare-metal for super-loop.
  • Handler mode (ARMv6-M, ARMv7-M, ARMv8-M): A mode dedicated for exception handling (except the RESET which are handled in Thread mode). Handler mode always uses MSP and works in privileged level.
Instruction set:
  • The original (and subsequent) ARM implementation was hardwired without microcode, like the much simpler 8-bit 6502 processor used in prior Acorn microcomputers.
  • The 32-bit ARM architecture (and the 64-bit architecture for the most part) includes the following RISC features:
  • Load/store architecture.
  • No support for unaligned memory accesses in the original version of the architecture. ARMv6 and later, except some microcontroller versions, support unaligned accesses for half-word and single-word load/store instructions with some limitations, such as no guaranteed atomicity.
  • Uniform 16× 32-bit register file (including the program counter, stack pointer and the link register).
  • Fixed instruction width of 32 bits to ease decoding and pipelining, at the cost of decreased code density.
  • Later, the Thumb instruction set added 16-bit instructions and increased code density.
  • Mostly single clock-cycle execution.

To compensate for the simpler design, compared with processors like the Intel 80286 and Motorola 68020, some additional design features were used:

  • Conditional execution of most instructions reduces branch overhead and compensates for the lack of a branch predictor
  • Arithmetic instructions alter condition codes only when desired.
  • 32-bit barrel shifter can be used without performance penalty with most arithmetic instructions and address calculations.
  • Has powerful indexed addressing modes.
  • A ink register supports fast leaf function calls.
  • A simple, but fast, 2-priority-level interrupt subsystem has switched register banks.
Pipelines and other implementation issues:
  • The ARM7 and earlier implementations have a three-stage pipeline; the stages being fetched, decode and execute.
  • Higher-performance designs, such as the ARM9, have deeper pipelines.
  • Cortex-A8 has thirteen stages.
  • Additional implementation changes for higher performance include a faster adder and more extensive branch prediction logic.

The difference between the ARM7DI and ARM7DMI cores, for example, was an improved multiplier; hence the added “M”.

Arithmetic instructions:
  • ARM includes integer arithmetic operations for add, subtract, and multiply; some versions of the architecture also support divide operations.
  • ARM supports 32-bit × 32-bit multiplies with either a 32-bit result or 64-bit result, though Cortex-M0 / M0+ / M1 cores don’t support 64-bit results.
  • Some ARM cores also support 16-bit × 16-bit and 32-bit × 16-bit multiplies.

The divide instructions are only included in the following ARM architectures:

  • ARMv7-M and ARMv7E-M architectures always include divide instructions.
  • ARMv7-R architecture always includes divide instructions in the Thumb instruction set, but optionally in its 32-bit instruction set.
  • ARMv7-A architecture optionally includes the divide instructions.
  • The instructions might not be implemented, or implemented only in the Thumb instruction set, or implemented in both the Thumb and ARM instruction sets, or implemented if the Virtualization Extensions are included.
Thumb instruction:
  • To improve compiled code-density, processors since the ARM7TDMI (released in 1994) have featured the Thumb instruction set, which has their own state.
  • (The “T” in “TDMI” indicates the Thumb feature.) When in this state, the processor executes the Thumb instruction set, a compact 16-bit encoding for a subset of the ARM instruction set.
  • Most of the Thumb instructions are directly mapped to normal ARM instructions.
  • The space-saving comes from making some of the instruction operands implicit and limiting the number of possibilities compared to the ARM instructions executed in the ARM instruction set state.
  • In Thumb, the 16-bit opcodes have less functionality. For example, only branches can be conditional, and many opcodes are restricted to accessing only half of all of the CPU’s general-purpose registers.
  • The shorter opcodes give improved code density overall, even though some operations require extra instructions.
  • In situations where the memory port or bus width is constrained to less than 32 bits, the shorter Thumb opcodes allow increased performance compared with 32-bit ARM code, as less program code may need to be loaded into the processor over the constrained memory bandwidth.
  • Embedded hardware, such as the Game Boy Advance, typically have a small amount of RAM accessible with a full 32-bit data path; the majority is accessed via a 16-bit or narrower secondary data path.
  • In this situation, it usually makes sense to compile Thumb code and hand-optimize a few of the most CPU-intensive sections using full 32-bit ARM instructions, placing these wider instructions into the 32-bit bus accessible memory.
  • The first processor with a Thumb instruction decoder was the ARM7TDMI.
  • All ARM9 and later families, including XScale, have included a Thumb instruction decoder.
  • The Thumb instruction set was originally inspired by SuperH‘s ISA; ARM licensed several patents from Hitachi

REGISTERS PRESENT:

  • Registers R0 through R7 are the same across all CPU modes; they are never banked.
  • Registers R8 through R12 are the same across all CPU modes except FIQ mode.
  • FIQ mode has its own distinct R8 through R12 registers.
  • R13 and R14 are banked across all privileged CPU modes except system mode.
  • That is, each mode that can be entered because of an exception has its own R13 and R14.
  • These registers generally contain the stack pointer and the return address from function calls, respectively.

Aliases:

  • R13 is also referred to as SP, the Stack Pointer.
  • R14 is also referred to as LR, the Link Register.
  • R15 is also referred to as PC, the Program Counter.

The Current Program Status Register (CPSR) has the following 32 bits

  • M (bits 0–4) is the processor mode bits.
  • T (bit 5) is the Thumb state bit.
  • F (bit 6) is the FIQ disable bit.
  • I (bit 7) is the IRQ disable bit.
  • A (bit 8) is the imprecise data abort disable bit.
  • E (bit 9) is the data endianness bit.
  • IT (bits 10–15 and 25–26) is the if-then state bits.
  • GE (bits 16–19) is the greater-than-or-equal-to bits.
  • DNM (bits 20–23) is the do not modify bits.
  • J (bit 24) is the Java state bit.
  • Q (bit 27) is the sticky overflow bit.
  • V (bit 28) is the overflow bit.
  • C (bit 29) is the carry/borrow/extend bit.
  • Z (bit 30) is the zero bit.
  • N (bit 31) is the negative/less than bit.

Explain Embedded Systems Architecture

EMBEDDED ARCHITECTURE :

Introduction :

  • The 8051 microcontrollers work with 8-bit data bus so they can support external data memory up to 64K and external program memory of 64k at best.
  • Altogether, 8051 microcontrollers can assign 128k of memory that is external in nature.
  • If the data and code happen to be contained in different memory blocks, then the architecture is referred to as Harvard architecture.
  • If both the data and code are contained in the same memory block, then the architecture is referred to as Von Neumann architecture.
Von Neumann Architecture:

The Von Neumann architecture was first proposed by a computer scientist John von Neumann. In this architecture, one data path or bus exists for both instruction and data. As a result, the CPU does one operation at a time. It either fetches an instruction from memory or performs read/write operation on data. So an instruction fetch and a data operation cannot occur simultaneously, sharing a common bus.

Von-Neumann architecture supports simple hardware. It allows the use of a single, sequential memory. Today’s processing speeds vastly outpace memory access times, and we employ a very fast but small amount of memory (cache) local to the processor.

Harvard Architecture:

The Harvard architecture offers separate storage and signal buses for instructions and data.

This architecture has data storage entirely contained within the CPU, and there is no access to the instruction storage as data.

Computers have separate memory areas for program instructions and data using internal data buses, allowing simultaneous access to both instructions and data.

Programs needed to be loaded by an operator; the processor could not boot itself.

In a Harvard architecture, there is no need to make the two memories share properties.

Von-Neumann Architecture vs Harvard Architecture:

The following points distinguish the Von Neumann Architecture from the Harvard Architecture.

Von-Neumann ArchitectureHarvard Architecture
Single memory to be shared by both code and data.Separate memories for code and data.
The processor needs to fetch code in a separate clock cycle and data in another clock cycle. So it requires two clock cycles.A single clock cycle is sufficient, as separate buses are used to access code and data.
Higher speed, thus less time-consuming.Slower in speed, thus more time-consuming.
Simple in design.Complex in design.
TYPES OF INSTRUCTION SET COMPUTER:
CISC(Complex instruction set computer):

CISC is a Complex Instruction Set Computer. It is a computer that can address a large number of instructions.

RISC(Reduced instruction set computer)

In the early 1980s, computer designers recommended that computers should use fewer instructions with simple constructs so that they can be executed much faster within the CPU without having to use memory. Such computers are classified as Reduced Instruction Set Computer or RISC.

CISC vs RISC:

The following points differentiate a CISC from a RISC −

 

 

 

 

STM32 LED Blink Using the Timer

EXPERIMENT TO MAKE LED BLINK USING TIMER ON STM32 :

In this experiment, we are going to use the timer interrupt to perform Led blinking operation and to check the time.

To perform several tasks at a time we use the timer interrupt.

Step 1: Configuration of the board

Select that STM32CubeMX In this screen you select the new project. After selecting a new project you get this screen.

Step 2: In this screen, you can select required STM board. Now here I am going to select an STM32f0R8 series.

Step 3: configuring the stm board by setting the clock, input and output pins.

Select the serial wire and timer pin, you can select any timer here we are using TIM3.

In TIM3 select the clock source as internal clock ad We are going to selected 9th pin as an output pin. As shown below

Step 4: Setting the clock configuration.

In the configuration window, we will get the timer which you have chosen here I am using TIM3.

Step 5: Click on the timer you have chosen. you will get below window In the parameter setting, we are going to add the prescaler value which is 16 bits and the counter period.

Step 6: Enable the timer by choosing the timer global interrupt.

Step 7: Now we have to save our project. Give a project name and browse the location where you want you save it.

Select the toolchain/ IDE which you are using, I am using MDK-ARM V5. OTHER SETTINGS ARE KEPT AS IT IS. CHECK BELOW FIGURE.

Step 8: Now our code is generated. We will open the project directly through keil.

Step 9: In this keil select the Application user you will get the  main.c.

 In main.c we can write the program.

Connect the stm32f0308 kit to computer using the data cable.

After writing the program.

  • build the program(shortcut press key-F7).
  • load(F8).
  • start/stop debug the program (ctrl+F5).

we got the disassembly screen. Here we can run the program

Step 10: Run the program(F5).

Step 11: If everything goes correctly we can see the LED blinking on STM board.

 

What is Embedded Antenna

EMBEDDED ANTENNA

Nowadays Embedded Systems Design gathering a lot of attention. In the future, the world may be fully automatic. Almost every work will be done automatically. With the rise of the Internet of Things (IoT) and the use of embedded antennas, machines could communicate with little or no interaction with humans.

Embedded antennas are a class of antennas which use metamaterials to increase the performance of miniaturized antenna systems

Their purpose, as with any electromagnetic antenna, is to launch energy into free space.

However, this class of antenna incorporates metamaterials, which are materials engineered with novel, often microscopic, structures to produce unusual physical properties.

Antenna designs incorporating metamaterials can step-up the antenna’s radiated power.
Conventional antennas that are very small compared to the wavelength reflect most of the signal back to the source.
A metamaterial antenna behaves as if it were much larger than its actual size because of its novel structure stores and re-radiates energy. Established lithography techniques can be used to print metamaterial elements on a Pc board
These novel antennas aid applications such as portable interaction with satellites, wide-angle beam steering, emergency communications devices, micro-sensors and portable ground-penetrating radars to search for geophysical features.
Some applications for metamaterial antennas are wireless communication, space communications, GPS, satellites, space vehicle navigation and airplanes.

  • Embedded antennas are a class of antennas which make use of unique materials to enhance the degree of performance of downsized antenna systems.
  • Their primary purpose is to launch energy into free space.
  • Unfortunately, they produce strange physical properties.
  • Antenna designs incorporating metamaterials can step-up the antenna’s radiated power.

They reflect most of the signal back to the source.

The physical behavior of this embedded material would be more size than predecessor because  of its unique structure absorbs and radiates energy again

Special lithography techniques can be used to print metamaterial elements on a PCB(Printed circuit board)

Applications:-

  1. Portable interaction with satellites,
  2. Wide angle beam steering
  3. Sound-penetrating radars to analyze geophysical features.
  4. Space communications
  5. GPS
  6. Satellites
  7. Space vehicle navigation
  8. Airplanes
  9. Emergency communications devices,

DESIGN PARAMETERS:

  • Basic Guidelines
  • Tuning
  • Voltage standing wave ratio(VSWR)
  • Impedance matching
  • Gain and orientation

Antenna tuning parameters:

The antenna should be tuned to correct frequency band.

Bluetooth and 802.11  operate at 2.4 and 2.5 GHZ, ISM band.

Antenna impedance matching:

  • 50 ohm input impedance should match the 50 ohm output impedance of the RF module.
  • If the impedance is mismatching, then a relatively low voltage level causes instability of RF module and poor transfer from RF module.

VSWR tuning (Voltage standing wave ratio) :

  • The reflection loss is a measure of reflection.
  • General specification is VSWR</=2.0
  • When voltage specification is =2.0 , reflection loss=-10 decibels.
  • VSWR is the ratio of the minimum and maximum voltage i.e., the combination of inserting and reflecting voltage waves.

GAIN AND ORIENTATION :

  • Gain is the ability to radiate and receiving an antenna.
  • To maximize gain do the following:

1 ) Decrease losses by:-

      Using good conductors

              Lossless polymers

2 ) Minimize impedance mismatch losses.

     By radiation pattern measurements we can measure the actual gain value and orientation of the antenna.

SOLUTION TO CUSTOMER REQUIREMENTS :

  • Keep free space around antenna to determine omni function when LCD open or close.
  • To get smaller material with different design or change substrate material like ceramics.
  • Keep material out of Aluminium-mg casing.

KEY BENEFITS:

  • Reduced Costs and Time-to-Market
  • Standard antenna eliminates design fees and cycle time associated with a custom solution; getting products to market faster.
  • Greater Flexibility
  • Has Unique Form Factors Ethertronics technology helps you deliver more advanced ergonomic designs without adverse impact on product performance.
  • Antennas are fully compliant with the LATEST STANDARDS.

APPLICATIONS :-

  • Machine to machine(m2m)
  • Automotive
  • Bluetooth
  • Barcode scanner
  • Healthcare
  • Point of Sale
  • Smart Metering

 

 

STM32 LED Blink

How to create a stm32 project? And do the experiment of toggling LED :

Step 1: Select that STM32CubeMX

Step 2: In this screen, you select the new project. After selecting a new project you get this screen.

Step 3: In this screen, you can select required STM board. Now here I am going to select an STM32f0R8 series.

Step 4: Wow!!! Successfully you created STM32 bored. Ok, now you to select gpio pins. Select on gpio pin on this board, you can get a menu. From that, you select whichever you required.

Step 5: Now we are going to select the gpio pin. I have selected 9th pin as an output pin.

Step 6: Now we are generating the source code based on the user setting.

Step 7: Now we have to save our project. Give project name and browse the location where you want you save it.

Select the toolchain/ IDE which you are using, I am using MDK-ARM V5. OTHER SETTINGS ARE KEPT AS IT IS. CHECK BELOW FIGURE.

Step 8: Now our code is generated. We will open the project directly through keil.

Step 9: In this keil select the Application/user- main.c.

      In main.c we can write the program.

      Connect the stm32f0308 kit with computer.

      After finishing program, build the program(shortcut press key-F7)- load(F8)-start/stop debug the program     (ctrl+F5).

we got the disassembly screen. Here we can run the program

Run the program(F5)

Wowwwww…!!!!!! We got the output of toggling led.

 

 

Embedded Systems in Automobile

Embedded in Automobile:

Embedded systems control engine management systems in automobiles, monitor home heating systems and regulate the quiet operation and the even distribution of laundry in washing machines. They are the heart of toys like Furry and Tamagotchi, of golf balls that cannot get lost and of gas pumps at gas online stations that advertise nearby restaurants on video. Above all, state-of-the-art communications equipment like WAP mobile telephones, MP3 players, set-top boxes and Net devices would not be possible without these powerful miniature brains.

Embedded system application in automobile:

A embedded system is an electronic or computer system which is designed to control, access the data in electronics based systems. This system includes a single chip microcontroller such as cortex, ARM and also microprocessors, FPGAs, DSPs, and ASICs. Nowadays the usage of embedded systems is widespread. But the software that is programmed into the microcontroller is capable of solving only a limited range of problems.

An advanced embedded system in automobiles has increased rapidly in the past two decades. Every year automobile manufacturers pack embedded systems into their cars for different functionalities like ignition, security and audio systems. The technological innovations of the embedded system within the vehicle are being ambitiously challenged to make the vehicle energy efficient, network savvy and safer. In 1968, the Volkswagen used first embedded system in the automobile industry.

Embedded Systems’ Applications:

 

Embedded systems have a huge variety of applications that vary from low to high-cost consumer electronics to industrial equipment, medical devices to weapon control systems, aerospace systems and entertainment devices to academic equipment, and so on. Embedded systems span all features of our present life.

  • Home Appliances: Washing machines, microwave appliances, security systems, dishwashers, DVD, HV and AC systems, etc.
  • Automobile: Airbag systems, GPS, anti-locking brake system, fuel injection controller devices, etc.
  • Office Automation: Copy Machine, Fax, modem, smartphone system, printer, and scanners.
  • Entertainment: Video games, mp3, Mindstorm, smart toy, etc.
  • Security: Building security system, face recognition, airport security system, eye recognition system, alarm system, finger recognition systems, etc.
  • Industrial automation: Voltage, temperature, current, and hazard detecting systems, data collection systems, assembly line, monitoring systems on pressure.
  • Aerospace: Flight attitude controllers, space robotics, automatic landing systems, navigational systems, space explorer, etc.
  • Medical: Medical diagnostic devices: ECG, EMG, MRI, EEG, CT scanner, BP Monitor, Glucose monitor.
  • Banking and Finance: Share market, cash register, smart vendor machine, ATM
  • Telecommunication: Cellular phone, web camera, hub, router, IP Phone
  • Personal: Data organizer, iPhone, PDA, palmtop.

Introduction to Automobiles Industry :

As far as automobile industry is concerned, a wide range of industries and companies are involved in the development, designing manufacturing and selling of cars, bikes, buses, etc. India represents one of the world’s largest automobile markets. From the past few years, even the middle-class has started showing interest in buying a vast range of cars or vehicles. The growth of the Indian automobile industry has recorded tremendous potential over the years.

The industry’s financial record is almost 7% of the country’s gross domestic product and both directly or indirectly, automobile industry employs about 19 million people. Moreover, with the government support and a special focus on exports of two and three wheelers, small cars, auto components and multi-utility vehicles, the automobile industry produced 1.73 million vehicles in February 2013 alone including commercial, two wheeler and three wheeler vehicles and passenger vehicles as well. In February 2014, the industry produced 1.81 million vehicles.

Embedded Systems in Automobiles

In automotive systems, more and more equipment is being changed from the mechanical systems to electronic systems. Embedded system is the heart of a vehicle’s electronic system because of its versatility and flexibility. The revolution of electronics has manipulated in automotive design including the fuel combustion, powertrain crash protection, etc. Advanced usage of the embedded system in the vehicle can help in controlling the pollution, increasing the facility to provide systems monitoring features that consumers demand. Today a typical vehicle contains around 25 to 35 microcontrollers, and some luxury vehicles contain approximately 60 to 70 microcontrollers per vehicle.

Today, a typical automobile on the road has computer controlled electronic systems, and the most commonly used embedded system in a vehicle includes Airbags, anti-lock braking system, black box, adaptive cruise control, drive by wire, satellite radio, telematics, emission control, traction control,automobile parking, in-vehicle entertainment systems, night vision, heads-up display, back up collision sensors, navigational systems, tyre pressure monitor, climate control, etc.

1. Embedded Airbag System

The below figure shows an embedded airbag system – an important safety device that provides extra protection against head-on crash – for the front seat occupants. This System works on the commands from the microcontroller The controller of this system gets the power from the battery. If the sensors detect accident, this microcontroller operates the airbag system by operating alternator.

2. Embedded Navigation System

Another advancement of the embedded system in automobiles is the navigation system using GPS. This navigational system consists of an embedded circuitry built with a GPS receiver, a gyroscope, a DVD-ROM, main controller and a display system as shown in the figure. The GPS receiver receives the current longitude and latitude values that are compared with the stored map. The Gyroscope and other sensors provide the road direction and speed. From all the information gathered at the main controller, the display system displays a navigation or route map of the destination in the display screen.

3. Adaptive Cruise Control

The innovation of the embedded system used in automobiles is Adaptive Cruise Control technology. By using this technology we can also make driverless vehicle control in a reality and many automobile manufacturers are also already engaged in work on these concepts. This adaptive cruise control allows cars to keep safe distances from other vehicles on the busy highway roads. The driver of the car can set the speed of his vehicle and the distance between his car and other vehicles. When the traffic slows down, ACC changes vehicle speed using moderate braking.

Each car has a laser transceiver or a microwave radar unit which is fixed in front of the car to find out the speed and distance of any other vehicle in the pathway. This is works on the principle of Doppler Effect; it is nothing but change in frequency of the waves.

4. Embedded Rain-Sensing System

Embedded rain-sensing system in automobiles is another automation system implemented with the use of an electronic system. In this, an optical sensor is placed on a small area of the front windshield glass (opposite to rear-view mirror). This optical sensor is placed at an angle to emit the infrared light which then reads the amount of light by it when the light is reflected back. This light is reflected in cases where the windshield is wet or dirty. Thus the optical sensor determines the necessary speed and frequency of windshield wiper depends on reflected light into the sensor.

5. Embedded Based Automatic Parking System

This automatic parking system is an independent car manipulation system that moves a car from traffic lane into a parking spot to perform the parallel parking, perpendicular parking and angle parking. This system mainly uses different methods to detect objects around the car. Sensors installed on the front of the vehicle and rear bumpers act as both a transmitter and receiver. These sensors send a signal that will be replicated back when it meets an obstacle near the vehicle, and then the carputer will receive the time signal and bumper will use the radar to decide the position of the obstacle. The car will sense the parking space and distance from the side of the road then drive the car to the parking place.

Thus, the modern day’s embedded systems have marked a revolutionary change in every aspect of the automobile designing and manufacturing processes because of their adaptability and flexibility. Now the question is: Have you got the basic concept of embedded systems in automobiles? If you have got some basic understanding of this concept with a little bit of doubt on this topic, you can give your feedback and suggestions in the comment section below, and let us know how would you like to get some help or assistance from us.

Use of Linux in Embedded Systems

Use of Linux in Embedded:

Linux as a free software, get a great deal of development, embedded systems and Linux combination is increasingly being optimistic. Linux has its own set of the toolchain, easy to create your own embedded system development environment and cross-operating environment, and embedded system development across the simulation tools obstacles. Linux kernel has a small, high efficiency, open source.

Linux device drivers can be either built into the kernel itself or can be built as modules. When built into the kernel, the device driver is always loaded and ready to be used. If built as a module, the device driver will have to be installed before attempting to use the device. This can be done automatically using scripts, manually from the command line, or the kernel can automatically load modules as needed.

Embedded Linux is increasingly popular Linux operating system modified so that it can be cut in the embedded computer system running an embedded Linux operating system on the Internet not only inherited the unlimited resources but also has embedded the open source operating system characteristics.

Advantages of Linux as an embedded system:

Linux can be applied to a variety of hardware platforms. Linux uses a unified framework to manage the hardware, from one hardware platform to another hardware platform changes and the upper application-independent.

Linux can be freely configured, does not require any license or business relationship, the source code is freely available. This makes the use of Linux as the operating system does not have any copyright disputes, which will save a lot of development costs.

Linux is similar to kernel-based, with full memory access control, supports a large number of hardware and other characteristics of a common operating system. All of its open source programs, anyone can modify and GUN General Public License issued under. In this way, developers can customize the operating system to meet their special needs.

Linux users are familiar with the complete development tools, almost all Unix systems applications have been ported to Linux. Linux also provides a powerful networking feature, a variety of optional window manager (X Windows).

The Linux powerful language compiler GCC, C++, etc. can also be very easy to get, not only sophisticated but easy to use.

The advantages of embedded Linux over embedded operating systems include multiple suppliers for software, development, and support; no royalties or licensing fees; a stable kernel; the ability to read, modify and redistribute the source code. The disadvantages are a comparatively large memory footprint complexities of user mode and kernel mode memory access.

Now let’s see in which all embedded system linux is used.

Nspire CAS CX Calculator: this is a simple calculator yet powerful. It is an ARM-based graph calculator that is powered by Linux.

Linux has proved itself to be a more stable operating environment; its functions are stable enough that seldom does one encounter screen freezes, repeated boot-ups, etc.

the Linux OS handles different functions through the kernel in a different way compared to Windows. This creates a faster system that is even closer to UNIX (it actual parent system).

Smart Tv: Ubuntu is powering Smart Tv.

 

Different versions of  Linux

Blue Cat Linux at http://www.lynuxworks.com,

Hard Hat Linux at http://www.mvista.com,

RT-Linux at http://www.rtlinux.com,

ThinLinux at http://www.thinlinux.org,

White Dwarf Linux at http://www.emjembedded.com/linux/dimmpc.html, and

Linux Embedded at http://linux-embedded.com.

 

Embedded C coding standard

Embedded C Coding Standard was developed to minimize bugs in firmware by fixating on practical rules that keep bugs out–while additionally ameliorating the maintainability and portability of embedded software. A C coding standard can avail keep bugs out of embedded software by leveraging prevalent language features and development tools.

Embedded C coding standard

K&R C

The C was developed by Dennis Ritchie between 1969 and 1973 at Bell Labs. It was widely accepted by almost all the professional programmers, and they started making their own additions to it. After a few years, there were a lot of C variants available for a programmer to choose from. The C Programming Language’, published in 1978 by Brian Kernighan and Dennis Ritchie; hence, the name K&R after Kernighan and Ritchie.

That time K&R C acted as an informal standards specification for C but also added language features like the new data types long int and unsigned int and the compound assignment operator.

The K&R C proposed a standardized I/O library. Since the most popular C standard followed in India was still ANSI C, the main differences between K&R C and ANSI C. There are 32 keywords in C.

According to K&R C, there are only 28 keywords in C. One keyword was called entry, which was neither implemented at that point in time by any of the compilers nor accepted into the list of keywords in ANSI C.

The other major difference is the definition of the function. A function definition in K&R C has the parameter types declared on separate lines. Consider the following lines of code showing a function definition in K&R C:

float fun( a, b )

int a;

float b;

{

float c;

c = a * b;

return c;

}

The function fun( ) accepts an integer and a floating-point variable, and returns the product. This is not the style for function definition in ANSI C.

The first line of the function definition in ANSI C will be

float fun( int a, float b ).

The gcc does not have an option to specify compilation in the K&R C standard. But programs written in K&R C will also be compiled without any errors because gcc compiler is backward compatible with K&R C.

ANSI C

The  K&R C was accepted by many programmers a standard of C, but no one was ready to accept it as the official standard of C.

The American National Standards Institute (ANSI) addressed this issue in 1983 by forming a committee, and the final draft of the standards it formulated was released in 1989. This is the reason why ANSI C is also called C89.

ANSI C is depends on the POSIX standard. POSIX is the Portable Operating System Interface, a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. The same standard proposed by ANSI was adopted by ISO officially as ISO/IEC 9899:1990 in 1990. This is the reason why ANSI C is also called as ISO C and C90. for one standard and  the four different names were given.

The five keywords const, enum, signed, void and volatile were added, and the keyword entry was dropped in ANSI C. The option -ansi from gcc compiler will compile programs in the ANSI C standard.

The options -std=c89 and -std=c90 will also compile programs in ANSI C. Since gcc is a backward compatible compiler, the above given options will result in successful compilation of programs with K&R C features. Almost all the popular C compilers support ANSI C features. These include compilers like gccfrom GCC, Portable C Compiler (PCC), Clang from LLVM, etc.

C99 Standard

C99 is the informal name given to the ISO/IEC 9899:1999 standards specification for C that was adopted in 1999. The C99 standard added five more keywords to ANSI C, and the total number of keywords became 37.

The keywords added in C99 are _Bool, _Complex, _Imaginary, inline and restrict.

  • The keyword _Bool is used to declare a new integer type capable of storing 0 and 1.
  • The keywords _Complex and _Imaginary are used to declare complex and imaginary floating point type variables to handle complex numbers.
  • The keyword inline is used to declare inline functions in C, similar to C++ inline functions.
  • The keyword restrict is used to tell the compiler that for the lifetime of the pointer, only the pointer itself or a value directly derived from it will be used to access the object to which it points.

New header files like <stdbool.h>, <complex.h>, <tgmath.h>, <inttypes.h>, etc, were also added in C99. A new integer data type called long long int with a minimum size of 8 bytes was added in C99.

In gcc compiler long long int usually takes 8 bytes. The C99 program named factorial.c given below to finds the factorial of 20. A program using the data type long int with the usual minimum size of 4 bytes will given the answer as -2102132736 due to overflow.

#include<stdio.h>

int main( )

{

long long int f=1;

int a=20,i=1;

for(i=1; i<=a; i++)

{

f = f * i;

}

printf(“the factorial of %d is %lld\n”,a, f);

return 0;

}

The program can be compiled by executing the command gcc -std=c99 fact.c or the command gcc fact.c on the terminal.The second command works due to ,by default, gcc compiler supports long long int.

The Features like variable length arrays, better support for IEEE floating point standard, macros with variable number of arguments, support for C++ style one line comments (//) many more, were  added in C99.

The official documentation of gcc: ‘ISO C99. This standard is substantially completely supported’. The legal term ‘substantially complete’ is slightly confusing but I believe it means that the gcc compiler supports almost all the features proposed by the standards documentation of C99.

C Language

The current and latest standard of the C programming language is C11 and, as the name indicates, this standard was adopted in 2011. The formal document describing the C11 standard is called ISO/IEC 9899:2011.

To C11, seven more keywords were added to the C programming language, thereby making the total number of keywords, 44. The seven keywords added to C99 are _Alignas, _Alignof, _Atomic, _Generic, _Noreturn, _Static_assert and _Thread_local. Consider the C11 program noreturn.c shown below, which uses the keyword _Noreturn.

#include<stdio.h>

_Noreturn fun( )

{

printf(“\nI TOO WILL BE PRINTED 🙂 \n\n”);

}

int main( )

{

printf(“\nI WILL BE PRINTED 🙂 \n”);

fun( );

printf(“\nI WILL NOT BE PRINTED 🙁 WHY? \n”);

}

There are a few warnings because the main( ) has one more line of code after the completion of the function fun( ). he last printf( ) in main( ) not is printed This is due to the difference between a function returning void and a function with the _Noreturn attribute. The keyword void only means that the function does not return any values to the called function, but when the called function terminates the program, the program counter register makes sure that the execution continues with the called function.

But in case of a function with the _Noreturn attribute, the whole program terminates after the completion of the called function. This is the reason why the statements after the function call of fun( ) didn’t get executed.

The function gets( ) caused a lot of mayhem and so was deprecated in C99, and completely removed in C11. Header files like <stdnoreturn.h> are also added in C11. Support for concurrent programming is another important feature added by the C11 standard.

Anonymous structures and unions are also supported in C11. But unlike C99, where the implementation of variable length arrays was mandatory, in C11, this is an optional feature. So even C11-compatible compilers may not have this feature.

The official documentation of gcc again says that ‘ISO C11, the 2011 revision of the ISO C standard. This standard is substantially completely supported’. the gcc compiler supports most of the features proposed by the C11 standard documentation. The option –std=c11 of gcc will compile programs in C11 standard.

Embedded C

The embedded C standard is different from all other c standards that is from K&R to C11, based on user requirements the programming languages are changed.

The standard known as Embedded C is slightly different from all the others. C from K&R C to C11 depicts the changes of a programming language over time, based on user requirements.

Embedded C is a standard that is being developed in parallel with c standards. A lot of non-standard features were used in C programs written for embedded systems. in 2008, the C Standards committee came up with a standardisation document called embedded C.

Embedded C  has the syntax and semantics of normal C with additional features like , named address spaces,fixed-point arithmetic, and basic I/O hardware addressing.

The keywords _Fract and _Accum are used in Embedded C.

New header files like <iohw.h> have also been proposed by the Embedded C standards committee. To support fixed-point arithmetic two groups of fixed-point data types called the fract types and the accum types were added to the C language. The main advantage of the Embedded C standard is that it is simpler and easier to learn than traditional C.

En-Query

Your Name*
Subject*
Phone Number*
Email Address*

Message*