Limit of SystemSerial.println()


#1

For DASH firmware, what’s the maximum string length that SerialSystem.println() can handle?

Let me know if it is possible to do an HTTP Post with around 15,000 characters.
If not then what’s the best option/alternative to send that data to the server using Dash Global board.


#2

15k characters went through which is enough for my usecase, but still have not tested the cap.
It turns out that the problem I had is not with the WRITE command but with the Serial Read commands of UBLOX for file system (AT+URDFILE and AT+URDBLOCK) which limit the READ DATA to around 216 characters only.

I also found out that it’s better to use TCP AT commands rather than the HTTP for large data over GPRS.
Hope the HOLOGRAM command wrapper will include TCP connections in the future.


#3

Can you share the code that you used to send the direct HTTP POST request? I’ve been looking for some documentation around using the AT commands directly for this without success.


#4

I’m using the UBLOX AT commands sample document as guide.

Skeleton Arduino code:

void setup() {
Serial.begin(115200);
SerialSystem.begin(115200);
HologramCloud.enterPassthrough();

//==== Call AT Commands to setup GPRS and HTTP SERVER
sendAT(“AT+UPSD=0,1,“placeAPNhere””);
sendAT(“AT+UPSDA=0,3”);
sendAT(“AT+UHTTP=0,1,“myHTTPServer””);
sendAT(“AT+UHTTP=0,5,80”);
}

void loop() {
//==== Call AT Commands for HTTP POST HERE
//==== Note that data to be posted needs to come from a FILE stored in the UBLOX memory.
//==== You need to write the data to the file, send the data via post, then delete the file
//==== (else new data appends to the existing file). Note also of the file size restriction of data.
sendAT(“AT+UDWNFILE=“postdata.txt”,22”);
sendAT(“The data to be posted.”); //The length of the text must be 22 as indicated above
sendAT(“AT+UHTTPC=0,4,”/post",“result.txt”,“postdata.txt”,1");
sendAT(“AT+UDELFILE=“postdata.txt””);
}

//======== Handle the AT COMMANDS here
//Stripped down function to send AT commands

void sendAT(String ATCommand) {
Char inputChar;
String returnChar;

SerialSystem.println(ATCommand);
while (!SerialSystem.available()) {
//Do nothing
}
delay(100); //Do a delay here or add conditional statement in the while loop that follows
//handle the WRITE FILE command separately as response needs to have “>” before writing the data
if (ATCommand.indexOf(“UDWNFILE”) > 0) {
while (SerialSystem.available() || inputChar != ‘>’) {
inputChar = (char)SerialSystem.read();
returnChar += inputChar;
}
}
else {
while (SerialSystem.available()) {
inputChar = (char)SerialSystem.read();
returnChar += inputChar;
}
}

//Code your own URC handling, Error checking and retry, and network fix
// handle returnChar (ERROR, ABORT, etc.)
// handle URC that interject itself to the status of current AT Commands
// handle retry for sending AT commands

}

I might missed some lines but I hope this helps.


#5

Excellent, thanks a lot. This will be very helpful.


#6

I updated the code with this line… (wrong datatype comparison in the original code).

delay(100); //Do a delay here or add conditional statement in the while loop that follows
//handle the WRITE FILE command separately as response needs to have “>” before writing the data
if (ATCommand.indexOf(“UDWNFILE”) > 0) {