AnsweredAssumed Answered

Firmware for LPC1767 is not updating using c#

Question asked by Muhammad Bilal on Oct 2, 2019
Latest reply on Oct 10, 2019 by Alexis Andalon

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

Attachments

Outcomes