Pages

Monday, 16 April 2018

Introduction to Keil






1.  Installation

1.1.       How to install Keil uVision 4

Follow the steps below to install Keil uVision 4 on your system.
1.        Run setup file MDK-ARM V4.13a.exe (Double click the file icon).
2.        Setup Window appears....

3.       Click Next.



4.       Click Checkbox of agreement in order to proceed and click Next

 
5.       In folder selection window, select suitable directory for the installation and press next (default directory should work fine!)




6.       Enter customer information and click next

7.       The setup should begin. Setup status window will show installation of different files. Wait until it gets installed completely.



8.       Once the installation gets over, message should appear with text File installation Completed”, Click Next without making any changes anywhere in the window.
9.      Next message will confirm “Keil uVision 4 Setup completed”. Click Finish

10.   This will lead you to the webpage of Keil Development Suit for ARM. This will provide you release notes for Keil Development kit. This document gives you the brief idea of which microcontrollers are being added in the Keil uVision 4. 

11.   Run “Keil uVision 4” by double clicking the "Keil uVision 4" icon from the desktop. Same can be done from Start menu.

1.2         How to install FTDI driver

1.       Visit FTDI’s VCP Drivers page (http://www.ftdichip.com/Drivers/VCP.htm) for the latest download of the Windows FTDI Driver executable and clicking on the Window’s “Available as a setup executable” link. Make sure to unzip the executable before proceeding to the next step.



2.       Choose ‘Run’ once it is has finished downloading, or find the file you just downloaded “CDM21228_Setup.exe” and double-click it to run it.


  1. Choose ‘Extract’ and continue through the installation until it finishes.


  1. If everything was successful, you should see some nice green check marks, indicating success!

1.3         How to install Flash Magic Utility

1.        Visit FlashMagic website http://www.flashmagictool.com/ and download the file FlashMagic.exe.
2.       Execute the downloaded file FlashMagic.exe, and follow the instructions.
3.       Start Flash Magic by selecting it from the Start Menu. In the Flash Magic windows select Options > Advanced Options ... menu item. In the window that appears enable the check box that says Use DTR and RTS to control RST and P0.14, and click on Ok.
When this option is enabled, during code download, the flashing tool will automatically switch the device into ISP mode. For more information on this, see the board user manual.



2.  Library Files (LibFiles)

Basically “LibFiles” contains “system_lpc17xx.c” and “.h” files.
Before executing lab programs it is important to have this library files in our system as we are going to link our programs to this folder.
Place “LibFiles” folder in a common path in all the computers. (ex: C->Documents->ARM->LibFiles)

1.       Open the Keil software and select “Project-> New µvision project” as shown below.





2.       Browse to your project folder (/Create a folder) and provide the project name and click on save.
      

3.       Once the project is saved a new pop up “Select Device for Target” opens, Select the controller (NXP:LPC1768) and click on OK.
    

4.       Select the controller (NXP:LPC1768) and click on OK.
  

5.       As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.

   


6.       Create a new file to write the program.





7.       Type the code or Copy paste the below code snippet.


8.       After typing the code save the file as main.c.




9.       Add the recently saved file to the project.




10.   Add the “main.c” along with system_LPC17xx.c.



11.   Build the project and fix the compiler errors/warnings if any.




12.     Code is compiled with no errors. The .hex file is still not generated. Follow section 4 (how to enable Hex  


 4.  How to Enable Hex File Generation
1.       Click on Target Options (or right click on “Target 1” and select “Options for Target ‘Target 1’…) to select the option for generating .hex file.




2.       Set IROM1 start address as 0x0000.




3.       Enable the option to generate the .hex file




4.       Hex file is generated after a rebuild.



5.       Check the project folder for the generated .hex file.

Once the “.hex” file is generated in keil, we need to upload the hex file to the hardware. We use Flash Magic Tool for the same.
Open the flash magic software and follow the below steps.
1.     Select the IC “LPC1768” from Select Menu.
2.     Select the COM Port. Check the device manager for detected Com port.
3.     Select Baud rate from 9600-115200
4.     Select None [ISP] Option for Interface.
5.     Oscillator Frequency 12.000000(12Mhz).
6.     Check the Erase blocks used by Hex file option
7.     Browse and Select the hex file.
8.     Check the Verify After Programming Option.
9.     If DTR and RTS are used then go to Options->Advanced Options-> Hardware Config and select the Use DTR and RTS Option.
10. Hit the Start Button to flash the hex file.
11. Once the hex file is flashed, reset the board. Now the controller should run your application code.


No comments:

Post a Comment