12 Binary data
The packet starts with \x01 (SOH, Start Of Header) followed by the length of the data in two-byte unsigned integer (UINT16) format, and then followed by the binary data.
The data shall not be terminated with the normal \x0D (Carriage Return, \r).
The binary header is comprised of three bytes:
0x01(SOHStartOfHeader),MSB_datalength,LSB_datalength
All commands and Unsolicited Result Codes (URC) that use binary data are “complete” without the binary data. In most cases, the binary data is sent directy after the AT command and the handle.
In the following AT+USOWB - Socket Write Binary command example, the binary data follows the the socket handle directly - without “,” or “\r” or any other character in between.
Example:
AT+USOWB=0{0x01,0x00,0x02,0xFF,0xEE}
This command writes to socket 0, 2 bytes data the data is 0xFF 0xEE.
Nota that the “{ }” should not be included in the data, it is only in this example, showing the binary data content.
Binary data for the Socket, SPS, and certificate upload all use the same Binary data format.
12.1 Binary mode command example
To send the following HellofromNORA-W36 message, the content must have a length of 19 bytes. The length in UINT16 format is \00\x13.
AT+USOWB=0\x01\x00\x13HellofromNORA-W36
Note that the AT command must not be terminated with the \r, The length shown in the header defines the number of bytes expected from the AT parser. The complete AT event includes the same three bytes header immediately after the handle in the event, like this:
+USORB:0\x01\x00\x13HellofromNORA-W36
12.2 Certificate upload command example
In the following example, the Security Certificate Upload Binary command, AT+USECUB, is entered with the X.509 certificate (or private key) using binary transfer. The certificate length is 1342 bytes and given in UINT16 format as \05\x3E.
To send the content of
-----BEGINCERTIFICATE-----\nABCDojCCAoqgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBkDELMAkGA1UEBhMCR0Ix\nFzAVBgNVBAgMDlVuaXRlZCBLaW5nZG9tMQ4wDAYDVQQHDAVEZXJieTESMBAGA1UE\nCgwJTW9zcXVpdHRvMQswCQYDVQQLDAJDQTEWMBQGA1UEAwwNbW9zcXVpdHRvLm9y\nZzEfMB0GCSqGSIb3DQEJARYQcm9nZXJAYXRjaG9vLm9yZzAeFw0yMzEwMDQxMDEw\nMzJaFw0yNDAxMDIxMDEwMzJaMHwxCzAJBgNVBAYTAlNFMQ4wDAYDVQQIDAVNYWxt\nbzEO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mB7Vo+65R/XwThzHjSXyCyHzRMd\nzOlrJZMuNWV2bI7vyIIp9/AdHNO6Hwnj+I5hBDvyV+T9RT2jLUTRZldGUJQBlDVj\nQUKa8NSwzVrvoVTPAT6gcPCn4VQkwxLE/LWaNw2X8mxtyo3nXVoo291TzB8mKHUQ\nubOA1iBEcKtAFjqOlZSLanVNvrn5KwXY\n-----ENDCERTIFICATE-----\n
+USECUB:1342
OK
Note that the AT command must not be terminated with the \r. The length of the header defines the number of bytes expected from the AT parser.
12.3 Python pseudo code example
byte='AT+USECUB=0,"ca.pem"'
byte+=b'\x01'
byte+=len(bin_data).to_bytes(2,'big')
byte+=bin_data#bin_datacontainsthebinarydatatobesent
write(byte)
12.4 C# Pseudo code example
byte[]bin_data'//datacontainsthebinarydatatobesent
byte[]dataHeader=newbyte[3];
dataHeader[0]=0x01;
dataHeader[1]=Convert.ToByte(bin_data.Length>>8);
dataHeader[2]=(Convert.ToByte(bin_data.Length&0xff));
write("AT+USECUB=0,"ca.pem")
write(dataHeader)
write(bin_data)
Last updated: 25 August 2025