Unit III ARM Interface and ARM Programming

download Unit III ARM Interface and ARM Programming

If you can't read please download the document

  • date post

    15-Jul-2015
  • Category

    Engineering

  • view

    610
  • download

    3

Embed Size (px)

Transcript of Unit III ARM Interface and ARM Programming

  • UNIT III

    Interfacing and Programming

    Dr. P. H. Zope SSBTs College of Engineering and Technology Bambhori Jalgaon

    North Maharashtra University

    phzope@gmail.com

    9860631040

  • 1. What is Interfacing and Need of interfacing.

    2. Different Interfacing techniques.

    3. Basic embedded C programs for on-chip peripherals

    studied in system architecture.

    4. Interfacing of different displays including Graphic LCD

    (320X240), Interfacing of input devices including touch

    screen etc,

    5. Interfacing of output devices like thermal printer etc.,

    6. Embedded communication using CAN and Ethernet,

    7. RF modules, GSM modem for AT command study etc.

    Topics

  • An interface is the point of interaction with software, or computer

    hardware, or with peripheral devices such as a computer monitor or

    a keyboard.

    Some computer interfaces such as a touch screen can send and

    receive data, while others such as a mouse, microphone or joystick

    can only send data.

    Types of Interfacing

    1. Hardware

    2. Software

    What is Interfacing

  • Hardware interfaces Hardware interfaces exist in computing systems between many of

    the components such as the various buses, storage devices,

    other I/O devices, etc.

    A hardware interface is described by the mechanical, electrical and

    logical signals at the interface and the protocol for sequencing

    them (sometimes called signaling).

    A standard interface, such as SCSI, decouples the design and

    introduction of computing hardware, such as I/O devices, from the

    design and introduction of other components of a computing

    system, thereby allowing users and manufacturers great flexibility

    in the implementation of computing systems.

    Hardware interfaces can be parallel where performance is

    important or serial where distance is important.

  • Software interfaces

    A software interface may refer to a wide range of different types of interface at different "levels": an operating system may interface with pieces of hardware.

    Applications or programs running on the operating system may need to interact via streams, and in object oriented programs, objects within an application may need to interact via methods.

  • Programming to the interface

    The use of interfaces allows a programming style called programming to the interface.

    The idea behind this is to base programming logic on the interfaces of the objects used, rather than on internal implementation details.

    Programming to the interface reduces dependency on implementation specifics and makes code more reusable.

    It gives the programmer the ability to later change the behavior of the system by simply swapping the object used with another implementing the same interface.

  • Benefits 1.Low cost 2.Easy interfacing & Design 3.Easy Production 4.users choice for interfacing 5.No Maintenance 6.Easier Handling

    Disadvantages 1.Compact size is not possible 2.Power consumption is more as compared to SOC 3.Leakage current is more 4.Limited Devices Addressing 5.No Support of Multi/ Master configuration

  • Different Interfacing techniques

  • ROM image creation in an Embedded System

    Process of converting C , C ++ -program into ROM image and ready to use To make the application run independently with the specific board one can follow the steps given below so that the application developed on the host system, after cross compiling the same for specific image and specific board

    The step wise process is as follows :

    To write your first program, you'll need to have the following software installed on your system: Triton IDE installed JRE of version 1.5 or higher ( provided in Triton IDE setup) Philips Utility ( provided in Triton IDE setup)

  • Setting up the Project To create an IDE project: Start Triton IDE. Select the workspace in which you can create all your projects as shown in the figure below. Click OK.

    Triton IDE C/C++ Environment opens as shown in below figure in which you can create new project, open existing one etc.

  • To create new project go to Project menu New C Project. You will get below figure.

    In the Project Name field, type keypad. o Select the Target as per the board you have. o Select the Variant from the variant list. o Select Operating System as per your requirement. o Select the Port from Port field. o Select the Baud Rate. o Select the Build options. o Select the Download options o Select the Debug type o You can also change the location of project. For that uncheck use default location. o Check Create Project Using Template.

  • Click Next.

    Belo sree ill appear. elet Deug ad Release configurations.

  • Click Finish.

    The project is created and opened in the IDE. You should see the following components:

    The Projets ido, hih otais a tree ie of the opoets of the project, including source files and properties file that your code depends on. .

    The oure Editor ido ith a file alled kepad_ai. ope.

  • Adding Code to the Generated Source File

    Because you have left the Create Project Using Template checkbox selected in the New

    Project wizard, the IDE has created a skeleton class for you. You can add your keypad

    code to the skeleton code by replacing the line:

    //TODO: You can write your code at here

    Sample code for Keypad

    ------------------------------- #include

    int main(void)

    {

    char key;

    q_keyinit(SPIRIT);

    q_lcdinit(SPIRIT); /* initialise the LCD*/

    q_printf("%s \r\nkey;","Hello");

    q_displaylcd("Hello", 5);

    while(1)

    {

    while((key = q_keyread()) == 0);

    key = key + 0x30;

    q_clrscreen();

    q_printf("%x \n", key);

    q_displaylcd(&key, 1);

    }

    }

    Save the change by choosing File > Save.

  • Compiling the Project To compile project you need to select Debug or Release mode. Debug mode: This creates an executable which you after downloading on the target board are able to debug. Release mode: This creates an executable which you can download on the target board but you wont be able to debug. Right click on the keypad project and point to Active Build Configuration and select Release as shown in the below screen.

  • To build Project right click on keypad project and select Build Project. Open the build console view to check for any errors as shown in the below figure.

  • If your project has built successfully *.hex will be created.

    If there are any errors in the project Build Console view will display the error messages and from Build Output view you can check the location of errors in your

    code.

    When you build the project, the keypad.hex is generated. You can see where the new file is generated by opening the C/C++ Projects view and expanding the

    keypad project node as shown in the following figure.

    Now that you have built the project, you download executable on target board and run the program.

  • Downloading the Program I Trito IDE eeutale a e doloaded three optios:

    ISP Utility, Odyssey JTAG and FTP.

    elet the appropriate doload optio ad right lik o the *.he file geerated and click Download as shown below.

    After successful download of

    program you can check the

    application by running it

    on target board.

  • Debugging the Program In Triton IDE you can debug your program by three options:-

    Monitor, Odyssey JTAG and Ethernet. As per your requirement select appropriate option for debugging and build the project in debug mode (same step as Release mode) After compilation download the generated executable and you can now debug the project. Right click on the project and select Debug As and click Debug Local C/C++ Application.

  • 330_09 30

    GPIO - General purpose input/output.

    FEATURES Direction control of individual bits Separate control of output set and clear All I/O default to inputs after reset

    APPLICATIONS General purpose I/O Driving LEDs, or other indicators Controlling off-chip devices Sensing digital inputs

  • 330_09 31

    IOPIN GPIO Port Pin value register. The current state of the port pins can always be read from this register, regardless of pin direction and mode. IOSET GPIO Port Output set register. This register controls the state of output pins in conjunction with the IOCLR register. Writing ones produces highs at the corresponding port pins. Writing zeroes has no effect. IODIR GPIO Port Direction control register. This register individually controls the direction of each port pin. IOCLR GPIO Port Output clear register. This register controls the state of output pins. Writing ones produces lows at the corresponding port pins and clears the corresponding bits in the IOSET register. Writing zeroes has no effect.

  • LED Interfacing

    32 330_09

    P0-15

    P0-16

    P0-17

    P0-18

    P0-19

    P0-20

    P0-21

    P0-22

    P0-23

  • 330_09 33

    A31302928 A27262524 A23222120 A19181716 A15141312 A111098 A7654 A3210 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0000 0000 0000

    0 0 7 F 8 0 0 0

    Prepare code for Pin Declaration

    A31302928 A27262524 A23222120 A19181716 A15141312 A111098 A7654 A3210 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0000 0000 0000

    0 0 7 F 8 0 0 0

    Prepare code for Data Display on port Lines

  • 330_09 34