> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/hardware/card-readers/mms-dyna-devices/dynaflex-ii-go/documents/developers-manuals/programmers-manual-commands/commands/file-operations/load-firmware-file.md).

# Load Firmware File

## Command 0xD801 - Load Firmware File

The host uses this command to send a firmware image file, signed by MagTek, to the device as the first step in updating firmware. If the battery charge is five percent or less, a response is returned indicating that the command has not been executed. See **Table 209 - Response Example for Command 0xD801**.

{% hint style="warning" %}
If the battery charge is 5% or lower, the device will not allow the Load Firmware File command to execute and returns a response indicating the command was not executed.
{% endhint %}

The sequence of events is as follows:

{% stepper %}
{% step %}

### Host obtains firmware image

The host is assumed to have access to a binary file containing a firmware image signed by MagTek, which contains a complete instance of **Firmware File Type (MAGTEK INTERNAL ONLY)**.
{% endstep %}

{% step %}

### Host composes and sends request

The host composes a command request using the binary file as the **Payload**, and sends it to the device in the format described below.
{% endstep %}

{% step %}

### Device acknowledges receipt

The device sends a response to the host to acknowledge it has received the request. The device will not allow the Load Firmware File command to execute if the battery charge is 5 percent or lower.
{% endstep %}

{% step %}

### Device validates and authenticates

The device validates the request and authenticates the firmware file with the algorithm specified in the firmware file payload.
{% endstep %}

{% step %}

### Commit / Notifications

If the upload was not successful, then go to the next step. If the upload was successful and auto-commit was disabled, then go to the next step. Else, the device will commit the image automatically.

* If commit was successful, the device sends Notification 0x0905 - Firmware Update Successful to the host.
* If commit was unsuccessful, the device sends Notification 0x0906 - Firmware Update Failed to the host.

Commit Firmware Notification Detail Codes are used for auto-commit mode. In both cases, the device automatically resets.
{% endstep %}
{% endstepper %}

## Table - Request Data for Command 0xD801 - Load Firmware File

<table><thead><tr><th width="189.33331298828125">Tag</th><th width="74.3333740234375">Len</th><th width="264.33331298828125">Value / Description</th><th width="74.33331298828125">Typ</th><th width="75.99993896484375">Req</th><th width="96.6666259765625">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Request Message</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D801 = <strong>Command 0xD801 - Load Firmware File</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>81</td><td>01</td><td>Progress Indicator Reserved for future use. Populate with 0x03.</td><td>B</td><td>R</td><td></td></tr><tr><td>85</td><td>02</td><td>Image Type<br>- 0x0000 = Boot Loader 1 image<br>- 0x0001 = Main App image<br>- 0x0002 = WiFi Module image<br>- 0x0003 = BLE Module image</td><td>B</td><td>R</td><td></td></tr><tr><td>86</td><td>20</td><td>Hash Checksum </td><td>B</td><td>R/O</td><td></td></tr><tr><td>87</td><td>var</td><td>Payload </td><td>B</td><td>R</td><td></td></tr><tr><td>88</td><td>01</td><td><p>Load Options </p><p>0x00 = Default mode </p><p>0x01 = Auto Commit</p></td><td>B</td><td>O</td><td>0x00</td></tr><tr><td>End of any wrappers, at minimum including <strong>Request Message</strong></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Table - Response Data for Command 0xD801 - Load Firmware File

<table><thead><tr><th width="231">Tag</th><th width="73.6666259765625">Len</th><th>Value / Description</th><th width="75.66668701171875">Typ</th><th width="78">Req</th><th width="98">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Response Message</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D801 = <strong>Command 0xD801 - Load Firmware File</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>No parameters.</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>End of any wrappers, at minimum including <strong>Response Message</strong></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Table - Response Example for Command 0xD801 Battery Charge State

Example (Hex):

```
AA 00 81 04 82 01 D8 01 82 04 80 02 03 16
```

{% hint style="info" %}
If the request started successfully, the Request Status in the message wrapper is **OK, Started / Running, All good / requested operation was successful**.
{% endhint %}

***

## Table - Request Example

Example (Hex):

{% code overflow="wrap" %}

```
AA 00 81 04 01 01 D8 01 84 83 0C 76 58 D8 01 81 01 03 85 02 00 01 86 20 DF C7 1E 09 A3 CE 8E 86 B0 F5 B6 75 BE B7 7A 0E 82 33 BF F1 8A CD 8F 38 34 B0 DB 20 D9 40 4B 28 87 83 0C 76 28 

Plus 0C7628 bytes of firmware Payload, excluded here for brevity.
```

{% endcode %}

***

## Table - Response Example

Example (Hex):

```
AA 00 81 04 82 01 D8 01 82 04 00 00 00 00
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.magtek.com/hardware/card-readers/mms-dyna-devices/dynaflex-ii-go/documents/developers-manuals/programmers-manual-commands/commands/file-operations/load-firmware-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
