I am working with a Quectel EC200U module and trying to upload a CA certificate for MQTT TLS using the AT+QFUPL command.
When I upload the certificate directly from a PC using QCOM (serial terminal), the entire certificate is transferred correctly and the MQTT TLS connection works as expected.
However, when I upload the same certificate via an MCU (Arduino over UART) using AT commands, the uploaded file is truncated or missing some bytes, which makes the certificate invalid and causes the TLS connection to fail.
The certificate content and size are identical in both cases; only the upload method differs.
Questions:
-
What is the correct and reliable procedure to upload a CA certificate to the EC200U using an MCU over UART with AT+QFUPL?
-
Why does the upload work correctly from a PC serial tool like QCOM but result in missing or corrupted bytes when sent from an MCU?
-
Are there specific requirements that must be followed when uploading from an MCU, such as:
-
Exact byte-count handling
-
Waiting for and handling the > prompt
-
Delays between chunks
-
UART flow control (RTS/CTS)
-
Timeouts or buffer limitations
-
Is the certificate data expected to be sent strictly as binary data (not line-based/text-based)?
-
Are there any official examples, application notes, or best practices for uploading certificates via MCU (e.g., chunk size, timing constraints, retry handling)?
Any guidance or reference material would be greatly appreciated
Hi Kazuki,
The recommended and most reliable method to upload a CA certificate (or any file) to the EC200U from an MCU is to use the ACK mode of AT+QFUPL .
The recommended procedure is as follows:
- Configure UART flow control if supported:
AT+IFC=2,2
This enables RTS/CTS hardware flow control. If hardware flow control is unavailable or unreliable, ACK mode becomes very important.
- Start the upload using ACK mode:
AT+QFUPL="cacert.pem",<file_size>,<timeout>,1
The final parameter 1 enables ACK mode.
Important:
<file_size> must be the exact byte count of the certificate
- Do not estimate or include extra characters
- Wait for the module response:
You must wait for:
CONNECT
before sending any certificate data.
- Send data in 1 KB chunks:
- Send 1024 bytes
- Wait for the module to respond with:
A
- The
A means the module has successfully buffered that chunk
- Only then send the next 1024 bytes
Repeat until all bytes are transferred.
- Upload completion:
After the exact number of bytes has been received, the module exits data mode automatically and returns:
+QFUPL: <upload_size>,<checksum>
OK
Why uploads often fail from MCU but work from PC tools like QCOM:
- PC serial tools usually use large buffers and sometimes hardware flow control
- MCUs often have very small UART buffers
- If the MCU continuously streams data without waiting, the module UART buffer can overflow
- During flash write operations, the module may temporarily stop consuming UART data, causing dropped bytes
- This results in truncated or corrupted certificates
Important best practices:
- Send the certificate strictly as raw binary data
- Do not use functions like
println() that append \r\n
- Use raw byte APIs such as
Serial.write()
- Do not send any extra bytes after the specified file size
- Wait for
CONNECT before sending data
- Prefer ACK mode over manual delay-based transmission
If ACK mode is not used:
- You must implement delays between smaller chunks (for example every 32–64 bytes)
- However, this method is significantly less reliable compared to ACK mode
You can also compare the returned checksum with your own MCU-side checksum calculation to verify transfer integrity.
Do let me know if you also require the documents for reference.
Thank you and have a nice day!
Hi AmarRaaj,
Thank you for the detailed explanation.
I have a few follow-up questions regarding ACK mode with AT+QFUPL:
-
Is the ACK response (“A”) generated after every received chunk regardless of chunk size, or is it specifically optimized for 1024-byte packets?
-
In my MCU implementation, memory constraints may require sending smaller packet sizes. Could you please confirm whether smaller chunks (for example 64, 128, or 256 bytes) are fully supported in ACK mode?
-
Could you also share any official documentation or application notes describing the ACK-mode upload mechanism and recommended MCU implementation practices?
I am trying to understand the behavior because certificate uploads through QCOM work consistently, while uploads through MCU occasionally result in missing bytes.
Thank you for your support.
Regards,
Kazuki