Dr.Y.NARASIMHA MURTHY Ph.D [email protected]UNIT-IV APPLICATIONS –EMBEDDED SYSTEMS JTAG –FLASH PROGRAMMING JTAG stands for Joint Test Action Group, which is an IEEE test standard , started in 1985 by a group of European companies and by 1988, the concept gained momentum in North America and several companies formed the Joint Test Access Group (JTAG) consortium to formalize the idea. In 1990, the Institute of Electrical and Electronic Engineers (IEEE) refined the concept and created the 1149.1 standard, known as IEEE Standard Test Access Port and Boundary Scan Architecture. The primary application, for which Boundary Scan was initially developed, was to detect and diagnose manufacturing defects related to connectivity at the board level, such as stuck-at-0 and stuck-at- 1 faults, open solder joints, and shorted circuit nodes. Today, the test access port defined in IEEE 1149.1 is used for many additional applications, such as in-system programming, access to built-in self test, on-chip emulation and debug resources, and system level test.A number of additional standardization efforts related to JTAG / Boundary Scan have recently been completed (e.g. IEEE 1149.7, IEEE 1500, IEEE 1581) or are under way (e.g. IEEE P1149.8.1, IEEE P1687, IEEE P1838, SJTAG). Boundary scan is a methodology allowing complete controllability and observability of the boundary pins of a JTAG compatible device via software 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
A brief description of the JPEG encoder is given in steps below.
Step 1.Reading the pixel value of the original image in RGB color space.
Step 2. Transfer the RGB color space to YCbCr space since the human eyes are sensitive to luminance than chrominance which can be down sampled (ex. 4:2:0) to save the storage.
Step 3. Transfer the YCbCr space from space domain to frequency domain by discrete cosine
transform (DCT) since the human eyes are sensitive to low frequency than high frequency which
can be hardly quantized to save the storage.
Step 4. Using quantization to decrease the DCT coefficient values required to recode.
Step 5.Encode the bit stream by Huffman coding due to the probability distribution of symbols.
Symbols with high probability will have shorter codelength, which is a good property to decrease
the memory usage.
The Decoding process is explained below.
1. Reading the bit stream and decode by Huffman decoding.
2. De-quantize the quantized DCT coefficient values.
3. Do the inverse DCT (IDCT) to transfer the YCbCr space from frequency domain to space
This program blinks the LEDs continuously with a small delay. The LEDs are connected to the
Port1 pins P1.24 to P1.31 and the these pins are configured as General Purpose output pins.
#include<lpc2148.H> //LPC2148 Header void delay(){for(int i=0x00;i<=0xff;i++)for(int j=0x00;j<=0xFf;j++) ; // Delay program } void main(){PINSEL2 = 0X00000000; // Set P1.24 TO P1.31 as GPIOIO1DIR = 0XFF000000; //Port pins P1.24 to P 1.31 Configured as Output port.
while(1) //Infinite loop{IO1SET=0XFF000000; // Pins P1.24 to P1.31 goes to high statedelay();IO1CLR=0XFF000000; // Pins P1.24 to P1.31 goes to low statedelay() ;
INTERFACING A STEPPER MOTOR TO ARM 7 CONTROLLER- (LPC2148 )
A stepper motor is a brushless, synchronous electric motor that converts digital pulses into mechanical rotation in steps. Every revolution of the stepper motor is divided into a discrete number of steps, and for each pulse it receives the motor rotates through one step.
Fig below shows the interface of the Stepper Motor to ARM 7 controller. The stepper motor is connected to Microcontroller using a ULN2003 driver IC. The ULN driver IC is connected to the Port1 pins P1.19 to P1.22 pins. So as the microcontroller gives pulses with a particular frequency to ULN2003, the motor is rotated either in clockwise or anticlockwise.
This program first configures the ARM Port1 as a GPIO and also as an out port. The sequence code is sent to the driver IC using these port pins. A suitable delay is incorporated between each step rotation. By applying the code in the reverse order, the stepper motor can be rotated in the anticlockwise direction.
# include <LPC214X.H> // LPC2148 HEADER
void delay_ms() ; // Delay function
void main() ; // Main program starts
{
PINSEL2 = 0X00000000; // Set P1.19 TO P1.22 as GPIO
IO1DIR=0x000000F0 ; // Set Port 1 as out port
while(1) // Infinite Loop
{
IO1PIN = 0X00000090; // Send the code1 for phase 1
delay_ms() ; // Call Delay
IO0PIN = 0X00000050 ; // Send the code 2 for phase 2
delay_ms() ; // Call Delay
IO1PIN = 0X00000060 ; // Send the code 3 for phase 3
delay_ms() ; // Call Delay
IO1PIN = 0X000000A0 ; // Send the code 3 for phase 3
unsigned long DACval, DACreg; int main (void) // Main program{ PINSEL0 = 0 ; // Port 0 as GPIO PINSEL1 = 0x0000 ; // Port 0 as Outport PINSEL2 & = 0x0000000C; SPI_ init (&IOPIN0,29/*CS*/, 5/*MISO*/, 6/*MOSI*/, 4/*SCK*/, 0/*CPOL*/, 0/*CPHA*/) ; // Set output voltage
DAC val = 2047 ; // Range [0..4095] DAC reg = DACval | 0x7000 ; SPI_enable () ; // Enable SPI port SPI_char ((DACreg >> 8) & 0x00FF); SPI_char (DACreg & 0x00FF) ; SPI_disable () ; // Disable SPI port while (1) ; // Infinite Loop}
SCB_PCONP |= SCB_PCONP_PCAD0; // Initialise ADC converter AD0_CR = AD_CR_CLKS10 // 10-bit precision | AD_CR_PDN // Exit power-down mode | ((3 - 1) << AD_CR_CLKDIVSHIFT) // 4.0MHz Clock (12.0MHz / 3) | AD_CR_SEL3; // Use channel 3 } int adcRead0_3(void) // Read the current value of ADC0.3
AD0_CR &= ~(AD_CR_START_MASK | AD_CR_SELMASK); // Deselect all channels and stop all conversions { AD0_CR |= (AD_CR_START_NONE | AD_CR_SEL3); // Select channel 3
AD0_CR |= AD_CR_START_NOW; // Manually start conversions (rather than waiting on an external input) while (!(AD0_DR3 & AD_DR_DONE)) ; // Wait for the conversion to complete return ((AD0_DR3 & AD_DR_RESULTMASK) >> AD_DR_RESULTSHIFT); // Return the processed results
} INTERFACING A SEVEN SEGMENT DISPLAY–LPC21XX
A seven segment display can be used to interface with LPC21XX microcontroller using the GPIO lines. By using one seven segment display module along with LPC21XX ,a Hex counter which counts 0 to F can be designed. By interfacing two Seven segment displays, a Hex counter which counts 00 to FF can be designed. The LSB segment is interfaced to Port1 GPIO lines(P1.16 to P1.22) and MSB module is interfaced to Port0 GPIO lines(Port0.16 to Port0.22) as shown in the circuit diagram.
S INTERFACING OF 2X16 LCD MODULE - LPC21XXThe ARM7 LPC21xx processor is interfaced to the 2x16 LCD mpdule in 4-bit mode .The interfcae diagram is shown below.The four data pins are connected with 4 data bits (P0.19 – P0.22 pins to bits D4-D7), address bit (RS-P0.16), read/write bit (R/W-P0.17) and control signal (E-P0.18) to make LCD display complete.The pins D0,D1,D2,D3 are left free with out any connections.
16X 2 LCD is a 16 pin module . In which pins 1 &16 are grounded, 2 &15 are given to V CC
and 3rd pin is given to potentiometer in order adjust the contrast of LCD. Pins 4, 5 & 6 corresponds to RS, R/W & EN respectively. Pins 7 to 14 are data lines from D0 to D7 respectively. Here the LCD is used in 4 bit mode i.e. upper 4 bits are used to transfer the data with MSB first and LSB next. Port 0 pins i.e. from P0.16 to P0.22 are used for both data and control signals. The interfacing diagram of 16X2 LCD is shown below.
PINSEL0 = 0x00000000; // Select Port 0 pins as GPIO lines IODIR0 = 0x00ff0000; // Configure the required pins of Port 0 as output pinslcd_init(); // LCD initializationdelay(2500); // Delay
{ temp1 = 0xc0; // Goto 2nd line in the LCD lcd_com(); // Byte to nibble conversion of LCD command delay(800);
} // End if data = *ptr; lcd_data(); // Byte to nibble conversion of LCD data
ptr++;} // End for loop
} // End mainvoid lcd_init(void) // Initialization of LCD{
temp2=0x30; // Assign command to temp2temp2=temp2<<16; // Shift the data by 16 bits left cmd_wrt(); // Command write subroutine delay(800); // Delaytemp2=0x30; // Assign command to temp2temp2=temp2<<16; // Shift the data by 16 bits leftcmd_wrt(); // Command write subroutine delay(800); // Delaytemp2=0x30; // Assign command to temp2temp2=temp2<<16; // Shift the data by 16 bits leftcmd_wrt(); // Command write subroutine delay(800); // Delaytemp2=0x30; // Assign command to temp2temp2=temp2<<16; // Shift the data by 16 bits leftcmd_wrt(); // Command write subroutinedelay(800); // Delaytemp2=0x20; // Assign command to temp2temp2=temp2<<16; // Shift the data by 16 bits leftcmd_wrt(); // Command write subroutine delay(800); // Delay
temp1 = 0x28; // Command for LCD to function in 4 bit modelcd_com();delay(800);
temp1 = 0x0c; // Command for display on, cursor offlcd_com();delay(800);temp1 = 0x06; // Command for cursor increment lcd_com();delay(500);temp1 = 0x80; // Command to force the cursor to beginning of 1st linelcd_com();delay(800);
}void delay(unsigned int j) // Delay subroutine{ unsigned int k; for(k=0;k<j;k++);}void clr_disp(void) // To clear LCD display{ temp1 = 0x01; lcd_com(); delay(320);}void ret_home(void) // To return home{ temp1 = 0x02;
lcd_com();delay(320);
}void lcd_com(void) // Byte to nibble conversion of LCD command{ temp2= temp1 & 0x00f0;
Acknowledgment: I thank all the people without whose contribution ,this class notes would have not been possible ,especially Pantech Solutions website .