Dear all,
I use for some years now the LPC811 and LPC812 microcontroller. Programming is done with Flash Magic and a FTDI C232HD USB 2.0 Hi-Speed to UART Cable where RTS is connected to PIO0_12 (ISP entry) and DTR to PIO0_5 (Reset). This works without any issue.
Now I want to write small c# windows programs for some ISP tasks, which shall be used during production and test.
My first try is a command line tool that shall read the UID of the microcontroller.
using System;
using System.IO.Ports;
using System.Threading;
public class PortChat
{
static bool _continue;
static SerialPort _serialPort;
public static void Main()
{
_serialPort = new SerialPort("COM4", 115200, Parity.None, 8, StopBits.One);
// Set the read/write timeouts
_serialPort.ReadTimeout = 1000;
_serialPort.WriteTimeout = 100;
_serialPort.Open();
_continue = true;
//ISP-Entry to 0V
_serialPort.RtsEnable = true;
Thread.Sleep(100);
//Reset-Pin to 0V
_serialPort.DtrEnable = true;
Thread.Sleep(100);
//Reset-Pin to 3.3V
_serialPort.DtrEnable = false;
Thread.Sleep(100);
Console.WriteLine("UID:");
_serialPort.WriteLine("N");
while (_continue)
{
try
{
string inputmessage = _serialPort.ReadLine();
Console.WriteLine(inputmessage);
}
catch (TimeoutException)
{
_continue = false;
Console.WriteLine("Nothing received");
Thread.Sleep(2000);
}
}
//ISP-Entry
_serialPort.RtsEnable = false;
Thread.Sleep(50);
//Reset-Pin
_serialPort.DtrEnable = true;
Thread.Sleep(50);
//Reset-Pin
_serialPort.DtrEnable = false;
_serialPort.Close();
}
}
Unfortunatly that doesn't work.
The communication with the same device via Flash Magic or generally via UART with other small c# programs works all well.
Any help or good ideas would be very much appreciated.