4.2.8 Maximum UART Command/Response Frame Size
This section details the calculation of the worst case size a UART command/response frame can be.
4.2.8.1 Maximum Size of Command/Response
The maximum command and response data payload sizes are client dependent. The MaxCommandDataLength parameter defines the maximum number of bytes contained in the command data payload. See Command-Response Pairs for more information on command and response sizes.
The figure below shows the maximum size of a command and response.
4.2.8.2 Maximum Size of Command/Response With Checksum
The UART transport layer adds on a 2-byte checksum to commands and responses as shown in the figure below.
4.2.8.3 Worst Case Size of Expanded Command/Response With Expanded Checksum
The worst case scenario is if every byte in the command or response is equal to a reserved code and has to be replaced with a 2-byte substitution in the expanded command/response and checksum as shown in the figure below.
4.2.8.4 Worst Case Size of MDFU UART Command/Response Frames
Finally, the Start-Of-Frame and End-Of-Frame codes are added to the MDFU UART command/response frames. This results in a final formula for the worst case maximum size MDFU UART command frames and response frames.