NXP In-System Programming (ISP) Devices
The .NET Software Download includes libraries and demo applications for creating custom .NET applications
that communicate with NXP In-System Programming (ISP) interface devices.
Supported Boards
The following boards have the UART for ISP operations accessible for demonstration purposes.
DZX.Devices.dll Library
The devices library contains the ISPDevice class for communicating with NXP In-System Programming (ISP) microcontroller devices. The ISP interface uses a serial
port that is provided by an OEM bootloader that is installed by NXP.
Connecting to a Device
The ISPDevice class supports connecting to a device using either the FTDI driver or the standard serial port driver. The code snippet below shows how to establish
a connection using either driver.
using DZX.Devices.ISP;
private void FTDIExample()
{
// Probe for available FTDI devices
FTD2XX_NET.FTDI.FT_DEVICE_INFO_NODE[] nodes = ISPDevice.GetAttachedAsFTDI();
// Any FTDI devices attached?
if (nodes.Length > 0)
{
// Connect to the first available device
ISPDevice device = new ISPDevice();
device.Connect(nodes[0]);
}
}
private void COMExample()
{
// Probe for available serial port devices
string[] ports = ISPDevice.GetAttachedAsCOM();
// Any available ports
if (ports.Length > 0)
{
// Connect to the first available port
ISPDevice device = new ISPDevice();
device.Connect(ports[0]);
}
}
Invoking ISP Mode
The ISP interface requires that the host software knows the memory sector layout of the target device. The ISPDevice has the ability to automatically
detect the type of device and use the appropriate settings if the device is supported. If the device isn't supported for automatic detection, the target
information can be provided using the ISPTarget class.
The code snippet below shows how to invoke the ISP mode within the device.
using DZX.Devices.ISP;
private void Example()
{
// Specify the function of DTR (default shown)
device.DTRFunction = ISPSignalFunction.ResetActiveLow;
// Specify the function of RTS (default shown)
device.RTSFunction = ISPSignalFunction.ISPEnableActiveLow;
// Specify to use DTR and RTS (true by default)
device.UseSignals = true;
try
{
// Attempt to enter ISP mode
device.InvokeISP();
}
catch (ISPException)
{
// The device failed to enter ISP mode
}
}
Data can be downloaded to the device once the device is in ISP mode. The code snippet below shows how to open a hex file and download
the contents to the attached ISP device.
using DZX.DataFiles;
using DZX.Devices.ISP;
private void Example()
{
// Open a hex file that contains the data to be downloaded to the device
DataFile file = DataFile.FromFile("C:\\DZX\\some-file.hex");
// Hook some events to notify users of the download progress
device.SectorErasing += device_SectorErasing;
device.SectorErased += device_SectorErased;
device.SectorProgramming += device_SectorProgramming;
device.SectorProgrammed += device_SectorProgrammed;
// Download the data
device.Download(file.Address, file.GetBytes());
}
void device_SectorProgramming(object sender, SectorEventArgs e)
{
Console.WriteLine(string.Format("Programming sector {0}... ", e.SectorNumber));
}
void device_SectorProgrammed(object sender, SectorEventArgs e)
{
Console.WriteLine("Done.");
}
void device_SectorErasing(object sender, SectorEventArgs e)
{
Console.WriteLine(string.Format("Erasing sector {0}... ", e.SectorNumber));
}
void device_SectorErased(object sender, SectorEventArgs e)
{
Console.WriteLine("Done.");
}
Demo Application
The In System Programming (ISP) demo application provides a demonstration of using the DZX.Devices.dll library
to update an NXP microcontroller.
Begin by selecting a device from the drop down list. Use the 'Port Settings' button to edit the settings of the port
used to communicate with the device.
Browse and select a data file to be downloaded to the device. Use the 'Download' button to start the download. The results
of the operation are displayed on the lower portion of the dialog.