Issue when using SendString from UART
Posted: Tue Dec 05, 2023 7:24 am
Hi,
I hope this is a simple one as an example might be difficult to provide, I have attached the FC file but it would also require the DB and a couple of PHP files to actually work.
I have been testing the example with Chipfryer for retrieving values from a DB, it does not work for me and in the process of tracking the problem down have I been losing hair.
So the issue appears to be the difference in the string I am getting from the request, according to Wireshark the string is 333 bytes so I increased the Rx string to 350. When I sent the string to a serial terminal I was not getting what I expected so started to play.
Although the string can be 333 characters it appears there is a limit of 255 to what it can send. If I send a string of 255 I get what I expected (although not what I want). If I increase it to 256 I get nothing and if I increase it to 257 I get the first character of the string and so on.
This is the message I am expecting.
HTTP/1.1 200 OK\r\n
X-Powered-By: PHP/5.5.10\r\n
Content-type: text/html\r\n
Transfer-Encoding: Chunked\r\n
Date: Mon, 04 Dec 2023 11:39:39 GMT\r\n
Server: Abyss/2.16.9.1-X1-Win32 AbyssLib/2.16.9.1\r\n
\r\n
[HTTP response 1/1]
[Time since request: 0.250211000 seconds]
[Request in frame: 10]
[Request URI: http://192.168.0.15/request_sensor_a.php?Sensor=FC1]
File Data: 147 bytes
Line-based text data: text/html (13 lines)
88\r\n
<!DOCTYPE HTML>\r\n
<html lang="en">\r\n
<head>\r\n
<meta charset="UTF-8">\r\n
<title>Connect db</title>\r\n
</head>\r\n
<body>\r\n
\r\n
</body>\r\n
</html>FC1=432\r\n
0\r\n
\r\n
This is what I get on my serial terminal at 255.
HTTP/1.1 200 OK
X-Powered-By: PHP/5.5.10
Content-type: text/html
Transfer-Encoding: Chunked
Date: Mon, 04 Dec 2023 18:48:51 GMT
Server: Abyss/2.16.9.1-X1-Win32 AbyssLib/2.16.9.1
88
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
Length_RX String = 255
When I change the string length to 256. Nothing yet the string shows it is 256.
Length_RX String = 256
If I then change it to 257 the same thing happens except it now prints "H" which is the first character of the message string???
H
Length_RX String = 257
And at 333.
HTTP/1.1 200 OK
X-Powered-By: PHP/5.5.10
Content-type: text/html
Transfer-
Length_RX String = 333
I hope this is a simple one as an example might be difficult to provide, I have attached the FC file but it would also require the DB and a couple of PHP files to actually work.
I have been testing the example with Chipfryer for retrieving values from a DB, it does not work for me and in the process of tracking the problem down have I been losing hair.
So the issue appears to be the difference in the string I am getting from the request, according to Wireshark the string is 333 bytes so I increased the Rx string to 350. When I sent the string to a serial terminal I was not getting what I expected so started to play.
Although the string can be 333 characters it appears there is a limit of 255 to what it can send. If I send a string of 255 I get what I expected (although not what I want). If I increase it to 256 I get nothing and if I increase it to 257 I get the first character of the string and so on.
This is the message I am expecting.
HTTP/1.1 200 OK\r\n
X-Powered-By: PHP/5.5.10\r\n
Content-type: text/html\r\n
Transfer-Encoding: Chunked\r\n
Date: Mon, 04 Dec 2023 11:39:39 GMT\r\n
Server: Abyss/2.16.9.1-X1-Win32 AbyssLib/2.16.9.1\r\n
\r\n
[HTTP response 1/1]
[Time since request: 0.250211000 seconds]
[Request in frame: 10]
[Request URI: http://192.168.0.15/request_sensor_a.php?Sensor=FC1]
File Data: 147 bytes
Line-based text data: text/html (13 lines)
88\r\n
<!DOCTYPE HTML>\r\n
<html lang="en">\r\n
<head>\r\n
<meta charset="UTF-8">\r\n
<title>Connect db</title>\r\n
</head>\r\n
<body>\r\n
\r\n
</body>\r\n
</html>FC1=432\r\n
0\r\n
\r\n
This is what I get on my serial terminal at 255.
HTTP/1.1 200 OK
X-Powered-By: PHP/5.5.10
Content-type: text/html
Transfer-Encoding: Chunked
Date: Mon, 04 Dec 2023 18:48:51 GMT
Server: Abyss/2.16.9.1-X1-Win32 AbyssLib/2.16.9.1
88
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
Length_RX String = 255
When I change the string length to 256. Nothing yet the string shows it is 256.
Length_RX String = 256
If I then change it to 257 the same thing happens except it now prints "H" which is the first character of the message string???
H
Length_RX String = 257
And at 333.
HTTP/1.1 200 OK
X-Powered-By: PHP/5.5.10
Content-type: text/html
Transfer-
Length_RX String = 333