From 3d2a8275b4da1f40abc020268a5f45b3dec2758a Mon Sep 17 00:00:00 2001 From: TIM ANDERSON Date: Tue, 27 Oct 2026 15:57:54 +1000 Subject: [PATCH] docs(sdo): configure aligned write buffering for block downloads --- doc/sdo.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/sdo.rst b/doc/sdo.rst index 29314028..e6f55007 100644 --- a/doc/sdo.rst +++ b/doc/sdo.rst @@ -89,8 +89,9 @@ server supports it. This is done through the file object interface:: FIRMWARE_PATH = '/path/to/firmware.bin' FILESIZE = os.path.getsize(FIRMWARE_PATH) - with open(FIRMWARE_PATH, 'rb') as infile, - node.sdo['Firmware'].open('wb', size=FILESIZE, block_transfer=True) as outfile: + with open(FIRMWARE_PATH, 'rb') as infile, \ + node.sdo['Firmware'].open('wb', size=FILESIZE, block_transfer=True, + buffering=7 * 1024) as outfile: # Iteratively transfer data without having to read all into memory while True: @@ -99,6 +100,10 @@ server supports it. This is done through the file object interface:: break outfile.write(data) +For block downloads, use a write buffer size divisible by seven, since each +block segment carries seven data bytes. The input chunk size can remain 1024 +bytes as shown above; it does not need to match the write buffer size. + .. warning:: Block transfer is still in experimental stage!