AnsweredAssumed Answered

Initial Synchronization and checksum related issues in LPC1767 using c#

Question asked by Muhammad Bilal on Sep 20, 2019
Latest reply on Sep 22, 2019 by xiangjun.rong


I am making a software to write into LPC1767, I have four questions

  1. My first question is , do we need to erase flash every time after its been written? or does it get overwritten after writing on it for second time? and for only erasing flash do we need initial handshaking i.e ?,synchronized\r\n,crystal frequency?
  2. Does the LPC1767 micro controller always enter ISP mode after connecting cable, I read what is said in "UM" but i didn't get it.
  3. This is my c# code for initial handshaking but after sending "Synchronized\r\n", we get invalid characters such as "?", "/","o" etc from reader instead of "OK" so that i can give crystal frequency next. I am following "UM" document by NXP. what might be the issue here?


if (serialport.IsOpen)
#region Attempt 2



string responseSync = "Synchronized\r\n";
string result = serialport.ReadExisting();
readTextBox.Text += result + System.Environment.NewLine;//sync by reader

// Synchronized OK

if (result.Equals(responseSync))
string w1 = "Synchronized\r\n";
string r1 = "OK\r\n";


string r2 = serialport.ReadExisting();// OK by reader <--------- ISSUE IS HERE I DON'T GET "OK" instead i get //random chars 


readTextBox.Text += "Check if sync ok" + System.Environment.NewLine;

readTextBox.Text += r2 + System.Environment.NewLine;
//crystal frequency
if (r2.Equals(r1))
//send crystal frequency
string crystalFrequency = "12000\r\n";
//host now send crystal frequency
//wait for reciever to sent OK
readWait(r1.Length);//wait after OK
string readCrystalFrequencyOk = serialport.ReadExisting();//will read response OK
readTextBox.Text += readCrystalFrequencyOk + System.Environment.NewLine;
if (readCrystalFrequencyOk.Equals(r1))
readTextBox.Text += "Crystal Frequency sent" + System.Environment.NewLine;

readTextBox.Text += "Closing SerialPort after initial commands" + System.Environment.NewLine;

4. This is the UU-encoded data which will be written later on device, The issue is the first 512 bytes checksum is valid according to "AN" NXP doc, but after sniffing data from flashmagic the first 512 bytes are invalid as they are 35644. 


Help will be appreciated, Thank you in advance.