Updating Firmware
- Updated2025-08-04
- 2 minute(s) read
To apply a firmware update to the rack control unit, call the UpdateFirmwareAsync function and pass in the full firmware file path as an input parameter.
Note Download the firmware update file from
ni.com/downloads.
If the
UpdateFirmwareAsync function succeeds, perform a full restart by
calling the InitiateRackRestartAsync function with
RackRestartLevel.FullRestart as the input parameter. After the full restart, call GetFirmwareUpdateStatusAsync to check the firmware update status. If the return value evaluates to FirmwareUpdateStatus.Succeeded, the firmware update succeeded and the new firmware is running. If the returned value evaluates to FirmwareUpdateStatus.Failed, the firmware update failed and the system has rolled back to the previous firmware.
Note The firmware file must have a .bin file extension
to prevent UpdateFirmwareAsync from throwing an exception.
Updating Rack Firmware
IAteCoreSession ateCoreSession;
// New firmware file to update to
string firmwareFilePath = " C:\\new_rack_firmware_version_1.bin ";
try
{
// To create an object of IAteCoreSession.
ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password);
await ateCoreSession.UpdateFirmwareAsync(firmwareFilePath);
// Perform a full restart
await ateCoreSession.InitiateRackRestartAsync(RackRestartLevel.FullRestart); // Dispose ateCoreSession will be handled in InitiateRackRestartAsync
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
while (true)
{
try
{
ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password);
break;
}
catch
{
// For full restart after firmware update, it takes longer time to restart, timeout after 2 mins.
if (stopWatch.Elapsed.TotalSeconds > 2 * 60)
{
throw new TimeoutException();
}
}
}
stopWatch.Stop();
stopWatch.Restart();
while (await ateCoreSession.GetRackSystemStateAsync() != RackSystemState.Operational)
{
// throw if the ATECCGEN2 hasn't moved to Operational system state over 5 seconds
if (stopWatch.ElapsedMilliseconds > 5000)
{
throw new TimeoutException();
}
}
stopWatch.Stop();
FirmwareUpdateStatus firmwareUpdateStatus = await ateCoreSession.GetFirmwareUpdateStatusAsync();
if (FirmwareUpdateStatus.Succeeded != firmwareUpdateStatus)
{
throw new Exception("Firmware update failed.");
}
// Get the object of RCU component
IRackControlUnit rackControlUnit = ateCoreSession.RackControlUnit;
// Print new firmware version
Console.WriteLine("Rack control unit firmware version: {0}", rackControlUnit.FirmwareVersion);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message); //Print the exception message.
}
finally
{
if (ateCoreSession != null)
{
// To close the session.
ateCoreSession.Dispose();
}
}