Firmware for LPC1767 is not updating using c#

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Firmware for LPC1767 is not updating using c#

2,467 Views
bilalqureshi_ep
Contributor II

Hi,

Hope everyone is fine, The issue what i am facing is that i have made a c# code for LPC1767 and basically what i wanted to do is to update the firmware for it. Yes this can be achieved using flash magic and other tools but that is not what i want. 

Let me tell what i did in code step by step

1. I opened serial port

2. set all the parameters such as

serialport.StopBits = StopBits.One;
serialport.Parity = Parity.None;
serialport.ReadTimeout = 500;
serialport.WriteTimeout = 500;
serialport.BaudRate = 115200;

//serialport.RtsEnable = true;
//serialport.DtrEnable = true;
serialport.ReadTimeout = 4000;
serialport.WriteTimeout = 4000;

3. Give ? get syncronized, give crystal frequency of 12000Mhz, get OK from LPC1767.

4. Get device detection id for LPC1767

5. prepare and erase flash from sector 0 to 29

5. Then start writing in RAM basically W 268435968 512\r Which gives 0 ISP response.

6. Write 512 bytes of UU encoded data with checksum that gives OK back

7. Then same above command with W 268436480 512\r Which gives 0 ISP response.

8. Write 512 bytes of UU encoded data with checksum that gives OK back

9. The prepare flash and copy 1024 bytes to it C  flashAddress 268435968 1024\r (flash address starts from last to 0 basically in reverse).

10. Step 5,6,7,8,9 is in loop and after that finally after last copy on flash.

11. I give Go command G 0 T\r and in response i get 0 ISP response....

The issue is The firmware does not update itself with new one, so i had to use flash magic again to write a new firm ware for it to work.

Kindly guide me if i am doing some thing wrong here. I am trying to make it work since last 5 days. The code is in c#, i can post the code if wanted.

1 thing more i sniffed the data that i get from flash magic and my Application. On screenshot, on left side its flashmagic, whereas on right that is mine, i will also post the sniffed data in excel file from my application.

Thank You,

Regards,

M.Bilal

Labels (1)
4 Replies

2,322 Views
bilalqureshi_ep
Contributor II

I have come to an understanding that Go command works before any write operation to RAM and flash, but does not work after write operation in RAM and flash. but i is this even possible i am getting 0 isp response after every command and OK after write. Can someone help ?????????

0 Kudos
Reply

2,322 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear Muhammad,

This is the following process for update the MCU in ISP, this is also the process that follows the Flash Magic:

To erase:

-Unlock command

-Prepare Sector command

-Erase sector command

To write:

-Unlock command

-Prepare Sector command

Loop x2:

-Write Sector command (512 bytes)

-Payload package (45 bytes) * 11 + (rest of payload)

-Checksum

- Prepare sector for write command

-Copy RAM to Flash command

The only thing that I miss between this process and yours is the unlock command. Did you do this before writing?

Also, I will check if the UU-encoding is being done correctly, is a little tricky to use this.

Let me know if this helps you.

Best Regards,

Alexis Andalon

2,322 Views
bilalqureshi_ep
Contributor II

Thank you for your reply, But where to execute GO command? because after writing operations to RAM and flash i can't use GO command to update LPC1767 micro controllers firmware.

0 Kudos
Reply

2,322 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Muhammad,

Could you try using the unlock command before using the GO command? Before any sucession of command the unlock is used to enable the be sure the reception is doing correctly.

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos
Reply