0% found this document useful (0 votes)
105 views18 pages

19ecs431 - Embedded Systems

An embedded system combines computer hardware and software to perform a dedicated function. It has characteristics like sophisticated functionality, real-time operation, low cost, and tight design constraints based on performance and functional requirements. The memory space of an EEPROM with address range 0x0001000 to 0x0001FFF is 4KB. Common conditional branch instructions in ARM include B, BL, BX, and BLX which allow conditional and unconditional changes to program flow, subroutine calls, and switching between ARM and Thumb instruction sets.

Uploaded by

Naresh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views18 pages

19ecs431 - Embedded Systems

An embedded system combines computer hardware and software to perform a dedicated function. It has characteristics like sophisticated functionality, real-time operation, low cost, and tight design constraints based on performance and functional requirements. The memory space of an EEPROM with address range 0x0001000 to 0x0001FFF is 4KB. Common conditional branch instructions in ARM include B, BL, BX, and BLX which allow conditional and unconditional changes to program flow, subroutine calls, and switching between ARM and Thumb instruction sets.

Uploaded by

Naresh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

GITAM(Deemedto beUniversity)

[19ECS431]

B.Tech.DegreeExamination

Computer Science& EngineeringVIISemester


EMBEDDEDSYSTEMS
(Effectivefrom theadmitted batch 2019–20)
--------------------------------------------------------------------------------------------
Scheme of evaluation
Section-A
1. Answer all Questions: (10X2=20)

a) Define an embedded system.

Ans: An embedded system is a combination of computer hardware and software designed


for a specific function. Embedded systems may also function within a larger system. The
systems can be programmable or have a fixed functionality. ------2Marks

b) Write any four the characteristics of an embedded system.

Ans:
Sophisticated Functionality. ...
Real-Time Operation. ...
Low Manufacturing Cost. ...
Processor and Memory. ...
Tight Design Constraint. ...
Based on Performance and Functional Requirements.----------------2Marks

c) What is pipelining in RISC processor?


Ans: A pipeline is the mechanism a RISC processor uses to execute instructions. Using a
pipeline speeds up execution by fetching the next instruction while other instructions are being
decoded and executed. ------1Mark
-----------1 Mark

d) Calculate the memory space of EEPROM with the following Address range 0x0001000 –
0x0001FFF

Ans: 16x16x16= 4K-------2 Marks

e) Write any four conditional suffix instructions in ARM.

any four conditional suffix instructions from above instruction ----2 Marks

f) What is the value of register R1 after execution of the below program?


LDR R1, = 0x00000045
MOV R1, R1, ROR #4

Ans: R1, = 0x50000004 ------------2 marks

g) Mention the function of SOC signal in ADC.

The SOC bit clears the SAR register for the new result as well as starting the clock of the A/D
converter for another conversion. --------1 mark

-----1 Mark
h) Write about the importance of UART communication.

In UART communication, two UARTs communicate directly with each other. The transmitting
UART converts parallel data from a controlling device like a CPU into serial form, transmits it in
serial to the receiving UART, which then converts the serial data back into parallel data for the
receiving device.
No of transmission lines less.

i)Define multitasking.
Multiple users can execute multiple programs apparently concurrently. Each executing
program is a task (or thread) under control of the operating system. If an operating system can
execute multiple tasks in this manner it is said to be multitasking.----------2 marks

j) How semaphores are used for synchronization of tasks?


Semaphores are integer variables that are used to solve the critical section problem by using two
atomic operations, wait and signal that are used for process synchronization. The wait
operation decrements the value of its argument S, if it is positive. If S is negative or zero, then no
operation is performed.
Section-B
Answer the following: (5X8=40)

UNIT-I

2. Explain the elements of an embedded system in detail.

--3 Marks

Explanation each block ---------- 5Marks

3. Explain the different on board and external communication interfaces in detail.

These are classified into

1 I2C (Inter Integrated Circuit) Bus.

2 SPI (Serial Peripheral Interface) Bus .

3 UART (Universal Asynchronous Receiver Transmitter).

4 1-Wires Interface.
1. I2C (Inter Integrated Circuit) Bus:

The sequence of operation for communicating with an I2C slave device is:
1. Master device pulls the clock line (SCL) of the bus to „HIGH‟
2. Master device pulls the data line (SDA) „LOW‟, when the SCL line is at logic
„HIGH‟ (This is the „Start‟ condition for data transfer)
3. Master sends the address (7 bit or 10 bit wide) of the „Slave‟ device to which it wants
to communicate, over the SDA line.
4. Clock pulses are generated at the SCL line for synchronizing the bit reception by the
slave device.
5. The MSB of the data is always transmitted first.
6. The data in the bus is valid during the „HIGH‟ period of the clock signal
7. In normal data transfer, the data line only changes state when the clock is low.
8.Master waits for the acknowledgement bit from the slave device whose address is sent
on the bus along with the Read/Write operation command.
9.Slave devices connected to the bus compares the address received with the address
assigned to them
10. The Slave device with the address requested by the master device responds by
sending an acknowledge bit (Bit value =1) over the SDA line
11. Upon receiving the acknowledge bit, master sends the 8bit data to the slave device
over SDA line, if the requested operation is „Write to device‟.
12. If the requested operation is „Read from device‟, the slave device sends data to the
master over the SDA line.
13. Master waits for the acknowledgement bit from the device upon byte transfer
complete for a write operation and sends an acknowledge bit to the slave device for a
read operation
14. Master terminates the transfer by pulling the SDA line „HIGH‟ when the clock line
SCL is at logic „HIGH‟ (Indicating the „STOP‟ condition).

-----------------2 Marks

2 Serial Peripheral Interface (SPI) Bus:

SPI requires four signal lines for communication. They are:


Master Out Slave In (MOSI): Signal line carrying the data from master to slave device.
It is also known as Slave Input/Slave Data In (SI/SDI)
Master In Slave Out (MISO): Signal line carrying the data from slave to master device.
It is also known as Slave Output (SO/SDO)
Serial Clock (SCLK): Signal line carrying the clock signals
Slave Select (SS): Signal line for slave device select. It is an active low signal. The
master device is responsible for generating the clock signal.
----2 Marks
3.UART:

--------2 Marks
4. Wire interface (protocol):

--------------2 Marks
UNIT-II

4. Explain the memory Map of ARM7 processor.

Diagram -----3 Marks


Explanation ----5 Marks

5. Explain the features of LPC2148 processor.

•16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

• 8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program memory.


128 bit wide interface/accelerator enables high speed 60 MHz operation.

• In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software.


Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1 ms.
• EmbeddedICE RT and Embedded Trace interfaces offer real-time debugging with the
on-chip RealMonitor software and high speed tracing of instruction execution.
• USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM.
In addition, the LPC2146/8 provide 8 kB of on-chip RAM accessible to USB by DMA.
• One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of 6/14
analog inputs, with conversion times as low as 2.44 s per channel.
• Single 10-bit D/A converter provides variable analog output.
• Two 32-bit timers/external event counters (with four capture and four compare
channels each), PWM unit (six outputs) and watchdog.
• Low power real-time clock with independent power and dedicated 32 kHz clock input.
• Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus
(400 kbit/s), SPI and SSP with buffering and variable data length capabilities.
• Vectored interrupt controller with configurable priorities and vector addresses.
• Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.
• Up to nine edge or level sensitive external interrupt pins available.

---------------8Marks

6. Explain the loop and branch instructions with a suitable example.

--------------------------- 1 Mark for syntax and 1 mark for example

B and BL

The B (Branch) and BL (Branch and Link) instructions cause a branch to a target address, and
provide both conditional and unconditional changes to program flow.
B{L}{<cond>} <target_address>

The BL instruction is used to perform a subroutine call. The return from subroutine is achieved
by copying the LR to the PC. Typically, this is done by one of the following methods:

BX
The BX (Branch and Exchange) instruction branches to an address held in a register Rm, with an
optional switch to Thumb execution. The branch target address is the value of register Rm, with
its bit[0] forced to zero. The instruction set to be used at the branch target is chosen by setting the
CPSR T bit to bit[0] of Rm.
BX{<cond>} <Rm>

BLX

This form of the BLX (Branch with Link and Exchange) instruction is used to call a Thumb
subroutine from the ARM instruction set at an address specified in the instruction. This
instruction is unconditional (always causing a change in program flow) and preserves the address
of the instruction following the branch in the link register (R14). Execution of Thumb
instructions begins at the target address.
BLX <target_addr> ---------------- -8 Marks

7. Explain the shift and rotate instructions in ARM with examples.

Shifted register operands

Logical shift right -------------------- 2Marks

MOV R0, R2, LSR #2 @ R0:=R2>>2 @ R2 unchanged


Example: 0…0 0011 0000
Before R2=0x00000030
After R0=0x0000000C
R2=0x00000030

Logical shift left ------------------ ----------- 2Marks

MOV R0, R2, LSL #2 @ R0:=R2<<2


@ R2 unchanged
Example: 0…0 0011 0000
Before R2=0x00000030
After R0=0x000000C0
R2=0x00000030

Arithmetic shift right----------------------------------2Marks

MOV R0, R2, ASR #2 @ R0:=R2>>2


@ R2 unchanged
Example: 1010 0…0 0011 0000
Before R2=0xA0000030
After R0=0xE800000C
R2=0xA0000030

Rotate right ---------------------------------------1Mark

MOV R0, R2, ROR #2 @ R0:=R2 rotate


@ R2 unchanged
Example: 0…0 0011 0001
Before R2=0x00000031
After R0=0x4000000C
R2=0x00000031

Rotate right extended -------------------------------1Mark

MOV R0, R2, RRX @ R0:=R2 rotate


@ R2 unchanged
Example: 0…0 0011 0001
Before R2=0x00000031, C=1
After R0=0x80000018, C=1
R2=0x00000031

8. Interface LM35 with LPC2148 and write a C program to read room temperature using
LM35.
Diagram -----------4 Marks
-
#include <lpc214x.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
uint32_t result;
float voltage;
char volt[18];
LCD_Init();
PINSEL1 = 0x01000000; /* P0.28 as AD0.1 */
AD0CR = 0x00200402; /* ADC operational, 10-bits, 11 clocks for conversion */
while(1)
{
AD0CR = AD0CR | (1<<24); /* Start Conversion */
while ( (AD0DR1 & 0x80000000) ==0); /* Wait till DONE */
result = AD0DR1;
result = (result>>6);
result = (result & 0x000003FF);
voltage = ( (result/1023.0) * 3.3 ); /* Convert ADC value to equivalent voltage */
LCD_Command(0x80);
sprintf(volt, "Voltage=%.2f V ", voltage);
LCD_String(volt);
memset(volt, 0, 18);
}

Program ---------------4Marks
9. Explain registers of PLL in detail.

PLL Register description

1.PLL Feed register (PLL0FEED): ----------2Marks


A correct feed sequence must be written to the PLLFEED register in order for changes to the
PLLCON and PLLCFG registers to take effect. The feed sequence is:
1. Write the value 0xAA to PLLFEED.
2. Write the value 0x55 to PLLFEED.

2.PLL Control register (PLL0CON ): 2Marks


The PLLCON register contains the bits that enable and connect the PLL. Enabling the PLL
allows it to attempt to lock to the current settings of the multiplier and divider values.
Connecting the PLL causes the processor and all chip functions to run from the PLL output
clock. Changes to the PLLCON register do not take effect until a correct PLL feed sequence has
been given

3.PLL Configuration register (PLL0CFG ): -----2Marks


The PLLCFG register contains the PLL multiplier and divider values. Changes to the PLLCFG register do
not take effect until a correct PLL feed sequence has been given

PLL Status register (PLL0STAT):- ----1Mark


The read-only PLLSTAT register provides the actual PLL parameters that are in effect at the
time it is read, as well as the PLL status. PLLSTAT may disagree with values found in PLLCON
and PLLCFG because changes to those registers do not take effect until a proper PLL feed has
occurred
VPBDIV --------------------1 Mark

----

10. Explain different states of task in an operating system?

Diagram -------3 Marks

Explaination----5Marks

Different states of a task

Task States
A task can exist in one of the following states:

Running
When a task is actually executing it is said to be in the Running state. It is currently utilising the
processor. If the processor on which the RTOS is running only has a single core then there can
only be one task in the Running state at any given time.
Ready
Ready tasks are those that are able to execute (they are not in the Blocked or Suspended state)
but are not currently executing because a different task of equal or higher priority is already in
the Running state.
Blocked
A task is said to be in the Blocked state if it is currently waiting for either a temporal or external
event. For example, if a task calls vTaskDelay() it will block (be placed into the Blocked state)
until the delay period has expired - a temporal event. Tasks can also block to wait for queue,
semaphore, event group, notification or semaphore event. Tasks in the Blocked state normally
have a 'timeout' period, after which the task will be timeout, and be unblocked, even if the event
the task was waiting for has not occurred.

Tasks in the Blocked state do not use any processing time and cannot be selected to enter
the Running state.

Suspended
Like tasks that are in the Blocked state, tasks in the Suspended state cannot be selected to enter
the Running state, but tasks in the Suspended state do not have a time out. Instead, tasks only
enter or exit the Suspended state when explicitly commanded to do so through the
vTaskSuspend() and xTaskResume() API calls respectively.

11. Draw and explain the implementation of blinking LED using free RTOS with Arduino.

Task is a piece of code that is schedulable on the CPU to execute. So, if you want to perform
some task, then it should be scheduled using kernel delay or using interrupts. This work is done
by Scheduler present in the kernel. In a single-core processor, the scheduler helps tasks to
execute in a particular time slice but it seems like different tasks are executing simultaneously.
Every task runs according to the priority given to it.
Apart from the LED task, there will be one more task which is created by the kernel, it is known
as an idle task. The idle task is created when no task is available for execution. This task always
runs on the lowest priority i.e. 0 priority. If we analyze the timing graph given above, it can be
seen that execution starts with an LED task and it runs for a specified time then for remaining
time, the idle task runs until a tick interrupt occurs. Then kernel decides which task has to be
executed according to the priority of the task and total elapsed time of the LED task. When 1
second is completed, the kernel chooses the led task again to execute because it has a higher
priority than the idle task, we can also say that the LED task preempts the idle task. If there are
more than two tasks with the same priority then they will run in round-robin fashion for a
specified time.

Every newly created task goes in Ready state (part of not running state). If the created task
(Task1) has the highest priority than other tasks, then it will move to running state. If this
running task preempts by the other task, then it will go back to the ready state again. Else if task1
is blocked by using blocking API, then CPU will not engage with this task until the timeout
defined by the user.

If Task1 is suspended in running state using Suspend APIs, then Task1 will go to Suspended
state and it is not available to the scheduler again. If you resume Task1 in the suspended state
then it will go back to the ready. ------------------------------4Marks

basic idea of how Tasks run and change their states., we will implement two tasks in Arduino
Uno using FreeRTOS API.
APIs to be used: -------------------------------------------------4Marks

1. xTaskCreate();
2. vTaskStartScheduler();
3. vTaskDelay();

Task to be created for this tutorial:

1. LED blink at Digital pin no with 200ms frequency


2. Print numbers in serial monitor with 500ms frequency.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy