CREATING .Bin FILE AND UPLOADING TO LPC2148

How to create a ‘.Bin’ file in keil Tool

This is a Post that tells you how to create and upload bin file to lpc2148.It is an easy method to upload the code.When you connect the arm stick it shows as a mass storage device and you can paste the code into it.We can avoid the flashing time by using this method.

Creating a project

1.Open keil software , select project and click on new microvision project.

2.Select the location where you want to store the program.

3.Select NXP(founded by Philips).

4.Select LPC2148 and press ok.

5.Press Yes button.

6.Select ‘File’ and click on ‘New’ to create a new file.

7.After creating new file , type the code and save with extension ‘.c ‘.

8.Add the saved file to source Group


9.After adding the file ,  ‘Build’ the code and check if there is any error and fix it. The ‘.bin’ file is still not created

Creating ‘.Bin’ file

1. Select Target option to generate ‘.Bin’ file.

2. Set IROM1 start address 0X3000. Boot loader will be stored from  0X0000-0X3000, so application will be stored from 0X3000.

3. Choose Linker setting. Select ‘Use memory layout from target option‘ to use the IROM1 address as configured in set up.

4. Choose the output and select ‘Create hex file‘ for creating hex file.

5.Select User in target option.Write the command to generate ‘.Bin’ file from .’axf’ file.

Command: fromelf –bin “led.axf” –output “led.bin”

6.Rebuild the project . You can see the ‘.Bin’ file in the project folder

 

Uploading ‘.bin ‘ file to LPC2148

To upload the bin file to LPC2148, first you have to flash the secondary boot loader to the controller using flash magic software.Then you should shot the USB pin to internal USB at the bottom of the arm stick , default it is connected to external USB. Remove the jumpers on the arm stick (ISP,JTAG) and connect the arm stick to PC using USB cable. Then it is detected as mass storage device in your PC. Just open the device and delete the old .bin file in the mass storage device and paste the new file. Press the reset button then the code will work.

How to flash a ‘hex’ to LPC2148

1. Open flash magic software.

2. Select Controller (LPC2148).

3. Select the COM port (Check the device manager of your PC, you can see the COM port used by the ARM Stick).

4. Select the baud rate.

5. Set the Oscillator frequency as 12MHz.

6. Click on browse button. Select hex file(boot loader).

 7. Click on Start button to flash the program.

8.After successfully finished, you can see a finished indication in flash magic.

After flashing hex file, remove the jumper (ISP,JTAG). Then you should shot the USB pin to internal USB at the bottom of the arm stick, default it is connected to external USB and connect the ARM stick to your PC. You can see that arm stick is detected as mass storage device.

Open the mass storage device and delete the old .bin file and paste the new bin file.

 Press Reset button. Now your application is running on the board.

Resource
Shop With Us

ARM 7 Stick LPC2148

Leave a Reply