Hi, Muhammad Bilal,
Q1: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?
>>>>>>>Yes, the on-chip flash of LPC17xx is NOR flash, you have to erase the flash every time before you program it. Ersaing flash makes all flash data in 0xFF(all bits in flash are ONE), programing flash can make the bits to 0 or keep to 1. I do not think you need any synchronization or crystal setting when you erase/program flash.
Q2: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.
>>>>>>>>>>>>>>>Whether the LPC17xx enters ISP mode or user application code is dependent on the P2.10 pin logic during/after Reset, when the pin is logic 0 by a pull-down resistor during/after Reset, the chip enters to execute user application code. When the pin is logic high by a pull-up resistor during/after Reset, the chip enters ISP mode.
Q3: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?
>>>>>>>>>>>>>>>I suppose that the baudrate of uart does not match, which leads to the issue, pls check you code on both PC and the LPC sides.
Hope it can help you
BR
Xiangjun rong