Saturday, 10 December 2016

An Introduction To GPS (Global Positioning System)

GPS - Global Positioning System-
 
Now a days when technology is going higher and higher every day, we all are using many technologies which are now integral part of our day to day life. So this post is an introduction to such a technology which is very useful in our day to day life.In this modern era people can go almost everywhere on the earth and its surroundings with the help of GPS. When a person leave his home for office or airport or market or weekend parties, he can easily track his destination using his mobile device or another device which is equipped with GPS receiver chip.GPS has made our daily life very easy in many ways. So let's go through this interesting technology  in this post.

History:

During the world war 2nd US has developed a system which is known as the First GPS System named as LORAN (Long Range Navigation System). This system used to work on low range frequencies and it was used to track up to 1,500 miles (2,400 km) with accuracy of tens of miles
.This system was mostly used by the US Military and Large Commercial Users.This system was used to send one signal in every 60 minutes to the receiver.The drawback of this system was its cost and size  so it was succeeded by LORAN -C (LOARN -B was not successful). Below is the picture of LORAN System.


Modern GPS System:
The Modern GPS System was launched by US Military in 1970s. Initially its usage was limited for military purposes,but in 1980s US government allows its usage for Civilian purposes. 

This modern GPS system is a global navigation satellite system (GNSS) made up of a network of a minimum 24 satellites.This system also consist 6 more satellites for backup purposes.So GNSS contains total of 30 satellites.These 24 satellites are situated in 6 orbits i.e. 4 satellites per orbit.Also these satellites are not Geo synchronous.The satellite orbits are arranged on six planes. The inclination of the angles of the planes towards the equator is 55° and these planes are rotated by 60° against each other. This gives complete coverage of the globe. This means that the orbits range from 55° north to 55° degrees south.

The GPS satellites orbit the earth in a Medium Earth Orbit (MEO). The mean distance from the center of the Earth is 26560 km (the mean radius of the Earth is 6360 km) and this means that the orbit altitude of the satellites is around 20 200 km.

The GPS satellites travel with a speed of about 3.9 km /s relative to the Earth as a whole, as opposed to relative to a fixed point on its surface. They have an orbit time of 12 hours (sidereal time) which equates to about 11 hours 58 minutes "Earth" time. This means that each satellite reaches a given position four minutes earlier each day (as it orbits the earth twice a day).

Within each orbit, there are at least four satellites. The system was designed for four satellites in each slot, but additional satellites are in orbit to act as "hot" spares in case of failure. In this way, when a satellite fails, and other one can be quickly put into its position to fill the gap.

This arrangement provides the earth user with a view of between five and eight satellites at any time from any point on the Earth. When four satellites are visible, sufficient information is available to be able to calculate the position on Earth.


Saturday, 22 November 2014

I2C (Inter-Integrated Circuit) Bus, Interface & Protocol



I2C is a serial protocol for two-wire interface to connect low-speed devices like microcontrollers, EEPROMs, A/D and D/A converters, I/O interfaces and other similar peripherals in embedded systems. It was invented by Philips and now it is used by almost all major IC manufacturers. Each I2C slave device needs an address – they must still be obtained from NXP (formerly Philips semiconductors).

i2c bus

The I2C bus physically consists of 2 active wires and a ground connection. The active wires, called SDA and SCL, are both bi-directional. SDA is the Serial DAta line, and SCL is the Serial CLock line.

Every device hooked up to the bus has its own unique address, no matter whether it is an MCU, LCD driver, memory, or ASIC. Each of these chips can act as a receiver and/or transmitter, depending on the functionality. Obviously, an LCD driver is only a receiver, while a memory or I/O chip can be both transmitter and receiver.

The I2C bus is a multi-master bus. This means that more than one IC capable of initiating a data transfer can be connected to it. The I2C protocol specification states that the IC that initiates a data transfer on the bus is considered the Bus Master. Consequently, at that time, all the other ICs are regarded to be Bus Slaves.

As bus masters are generally microcontrollers, let's take a look at a general 'inter-IC chat' on the bus. Lets consider the following setup and assume the MCU wants to send data to one of its slaves 
I2C Bus

First, the MCU will issue a   START  condition. This acts as an 'Attention' signal to all of the connected devices. All ICs on the bus will listen to the bus for incoming data.

Then the MCU sends the ADDRESS of the device it wants to access, along with an indication whether the access is a Read or Write operation (Write in our example). Having received the address, all IC's will compare it with their own address. If it doesn't match, they simply wait until the bus is released by the stop condition (see below). If the address matches, however, the chip will produce a response called the ACKNOWLEDGE signal.

Once the MCU receives the acknowledge, it can start transmitting or receiving DATA. In our case, the MCU will transmit data. When all is done, the MCU will issue the STOP condition. This is a signal that the bus has been released and that the connected ICs may expect another transmission to start any moment.

Start and Stop Conditions

Prior to any transaction on the bus, a START condition needs to be issued on the bus. The start condition acts as a signal to all connected IC's that something is about to be transmitted on the bus. As a result, all connected chips will listen to the bus.

After a message has been completed, a STOP condition is sent. This is the signal for all devices on the bus that the bus is available again (idle). If a chip was accessed and has received data during the last transaction, it will now process this information (if not already processed during the reception of the message).
StartStart waveformThe chip issuing the Start condition first pulls the SDA (data) line low, and next pulls the SCL (clock) line low.
StopStop waveformThe Bus Master first releases the SCL and then the SDA line.
A few notes about start and stop conditions:
  • A single message can contain multiple Start conditions. The use of this so-called "repeated start" is common in I2C.
  • A Stop condition ALWAYS denotes the END of a transmission. Even if it is issued in the middle of a transaction or in the middle of a byte. It is "good behavior" for a chip that, in this case, it disregards the information sent and resumes the "listening state", waiting for a new start condition.

Getting Acknowledge from a Slave Device

When an address or data byte has been transmitted onto the bus then this must be ACKNOWLEDGED by the slave(s). In case of an address: If the address matches its own then that slave and only that slave will respond to the address with an ACK. In case of a byte transmitted to an already addressed slave then that slave will respond with an ACK as well.

The slave that is going to give an ACK pulls the SDA line low immediately after reception of the 8th bit transmitted, or, in case of an address byte, immediately after evaluation of its address. In practical applications this will not be noticeable.
     
Ack waveformThis means that as soon as the master pulls SCL low to complete the transmission of the bit (1), SDA will be pulled low by the slave (2).

The master now issues a clock pulse on the SCL line (3). the slave will release the SDA line upon completion of this clock pulse (4).

The bus is now available again for the master to continue sending data or to generate a stop condition.

In case of data being written to a slave, this cycle must be completed before a stop condition can be generated. The slave will be blocking the bus (SDA kept low by slave) until the master has generated a clock pulse on the SCL line.

Special Addresses and Exceptions

In the I2C address map there are so-called "reserved addresses". This section contains some more details on these addresses and what they do.
AddressR/WDesignation
0000-0000General call address (see note 1)
0000-0001START byte (note 2)
0000-001xReserved for the obsolete C-Bus format (note 3)
0000-010xReserved for a different bus format (note 4)
0000-011xReserved for future purposes (note 5)
0000-1xxxReserved for future purposes
1111-1xxxReserved for future purposes
1111-0xxx10-bit slave addressing mode (note 6)
Note 1: The general call address
This address is being used to access all devices on the bus which are capable of handling the general call and need this data. Devices which are capable of handling this general call but do not need it will not answer.
All bytes transferred after this address may or may not be taken in by the slaves that are responding to it. If no slave is acknowledging a transmitted byte, the operation is stopped by issuing a STOP on the bus.
The meaning of the general call address is specified in the 1st byte transmitted after this "general call". This first byte can contain the following information:
If the LSB is set to 0:
0000-0110Reset and write programmable part of slave address. All devices who respond to this will reset and take in the programmable part of their address. This is done by re-reading the levels on the address select pins of the device (if any). This command can be used to reset an entire I2C system.
0000-0100The same as above but without the reset . This can be useful if the state of the address select pins of a device are configurable. This way the device address will change.
If the LSB is set to 1:
xxxx-xxx1This is a Hardware Call. If a device needs urgent attention from a master device without knowing which master it needs to turn to, it can use this call. This is a call "to whom it may concern". The device then embeds its own address into the message. This call means as much as: Please contact me, I need to be serviced. All masters will listen and the master that knows how to handle the device with the address transmitted will contact its slave and act appropriately.
Note 2: The START address
This can be used between masters. A master which does not have an I2C interface in hardware but in software needs to monitor the bus all the time. Since this can require a lot of processing time, the START address was introduced. The masters can sample the bus at a low rate. As soon as they detect that the SDA line is low (it is held low for over 7 clock periods) it can switch to a higher sampling rate to detect the Start condition.
This address is not followed by a stop condition but rather by a repeated start condition.
Notes 3 and 4: These addresses are used when data other than I2C data has to be transmitted over the bus.
Note 5: These addresses are for further expansion and are currently not allowed.

Extended Addressing (10-bit)

Due to the increasing popularity of the I2C bus the 7-bit address space got exhausted. This started posing problems for people currently in the phase of designing a new I2C compatible IC. Therefore the I2C standard has been updated to implement a 10-bit addressing mode.

A chip that conforms to the new standard receives two address bytes. The first consists of the extended addressing reserved address including the 2 MSB's of the device address and the Read/Write bit. The second byte contains the 8 LSB's of the address.

This scheme insures that the 10 bit addressing mode stays completely transparent for the other devices on the bus. Any new design should implement this new addressing scheme.

Transmitting a Byte to a Slave Device

Once the START  condition has been sent, a byte can be transmitted by the MASTER to the SLAVE.

This first byte after a start condition will identify the slave on the bus (address) and will select the mode of operation. The meaning of all following bytes depends on the slave.

Waveform sending byte

A number of addresses have been  reserved for special purposes. One of these addresses is reserved for the "Extended Addressing Mode". As the I2C bus gained popularity, it was soon discovered that the number of available addresses was too small. Therefore, one of the reserved addresses has been allocated to a new task to switch to 10-bit addressing mode. If a standard slave (not able to resolve extended addressing) receives this address, it won't do anything (since it's not its address).

If there are slaves on the bus that can operate in the extended 10-bit addressing mode, they will ALL respond to the ACK cycle issued by the master. The second byte that gets transmitted by the master will then be taken in and evaluated against their address.

Note: Even in 10-bit extended addressing mode, Bit 0 of the first byte after the Start condition determines the slave access mode ('1' = read / '0' = write).

Receiving a Byte From a Slave Device

Once the slave has been addressed and the  slave has acknowledged this, a byte can be received from the slave if the R/W bit in the address was set to READ (set to '1').

The protocol syntax is the same as in transmitting a byte to a slave, except that now the master is not allowed to touch the SDA line. Prior to sending the 8 clock pulses needed to clock in a byte on the SCL line, the master releases the SDA line. The slave will now take control of this line. The line will then go high if it wants to transmit a '1' or, if the slave wants to send a '0', remain low.
     
Receive waveformAll the master has to do is generate a rising edge on the SCL line (2), read the level on SDA (3) and generate a falling edge on the SCL line (4). The slave will not change the data during the time that SCL is high. (Otherwise a Start or Stop condition might inadvertently be generated.)

During (1) and (5), the slave may change the state of the SDA line.
     
In total, this sequence has to be performed 8 times to complete the data byte. Bytes are always transmitted MSB first.
Receive waveform
The meaning of all bytes being read depends on the slave. There is no such thing as a "universal status register". You need to consult the data sheet of the slave being addressed to know the meaning of each bit in any byte transmitted.

Conclusion

I2C bus is used by many integrated circuits and is simple to implement. Any microcontroller can communicate with I2C devices even if it has no special I2C interface. I2C specifications are flexlible – I2C bus can communicate with slow devices and can also use high speed modes to transfer large amounts of data. Because of many advantages, I2C bus will remain as one of the most popular serial interfaces to connect integrated circuits on the board.

Tuesday, 9 September 2014

Encoding vs. Encryption vs. Hashing

Encoding is often confused with encryption and hashing. They are not the same. But before I go into the differences, I’ll first mention how they relate:
1.     All three transform data into another format.
2.     Both encoding and encryption are reversible, and hashing is not.
Let’s take a look at each one:
Encoding
The purpose of encoding is to transform data so that it can be properly (and safely) consumed by a different type of system, e.g. binary data being sent over email, or viewing special characters on a web page. The goal is not to keep information secret, but rather to ensure that it’s able to be properly consumed.
Encoding transforms data into another format using a scheme that is publicly available so that it can easily be reversed. It does not require a key as the only thing required to decode it is the algorithm that was used to encode it.
Examples: ASCII, Unicode, URL Encoding, Base64
Encryption
The purpose of encryption is to transform data in order to keep it secret from others, e.g. sending someone a secret letter that only they should be able to read, or securely sending a password over the Internet. Rather than focusing on usability, the goal is to ensure the data cannot be consumed by anyone other than the intended recipient(s).
Encryption transforms data into another format in such a way thatonly specific individual(s) can reverse the transformation. It uses a key, which is kept secret, in conjunction with the plaintext and the algorithm, in order to perform the encryption operation. As such, the ciphertext, algorithm, and key are all required to return to the plaintext.
Examples: AES, Blowfish, RSA
Hashing
Hashing serves the purpose of ensuring integrity, i.e. making it so that if something is changed you can know that it’s changed. Technically, hashing takes arbitrary input and produce a fixed-length string that has the following attributes:
1.     The same input will always produce the same output.
2.     Multiple disparate inputs should not produce the same output.
3.     It should not be possible to go from the output to the input.
4.     Any modification of a given input should result in drastic change to the hash.
Hashing is used in conjunction with authentication to produce strong evidence that a given message has not been modified. This is accomplished by taking a given input, encrypting it with a given key, hashing it, and then encrypting the key with with the recipient’s public key and signing the hash with the sender’s private key.
When the recipient opens the message, they can then decrypt the key with their private key, which allows them to decrypt the message. They then hash the message themselves and compare it to the hash that was signed by the sender. If they match it is an unmodified message, sent by the correct person.
Examples: SHA-3, MD5 (Now obsolete), etc.
Summary
  • Encoding is for maintaining data usability and can be reversed by employing the same algorithm that encoded the content, i.e. no key is used.
  • Encryption is for maintaining data confidentiality and requires the use of a key (kept secret) in order to return to plain text.
  • Hashing is for validating the integrity of content by detecting all modification thereof via obvious changes to the hash output.


Friday, 5 August 2011

Device Drivers on ARM9/Embedded linux

I have ported my own linux kernel 2.6.29, memory partitioned (MTD) & ported on S3C2440-SBC.& WROTE FIRST ,BASIC CHARACTER DRIVER.

Thursday, 4 August 2011

Porting uClinux 2.4.x on S3C4510 Board

I have ported Linux Kernel on ARM Board.Steps : kernel compilation, memory addressing.Hardware Specification:Vendor Selection,linux version selection.