mbedtls_ssl_write() error when sending AWS-IoT using the spresense LTE board

Asked 1 years ago, Updated 1 years ago, 403 views

When sending data to AWS-IoT using the LteGnsTracker as a reference, errors occur frequently after several hours.
The source is simple:

mqttClient.beginMessage(topic_ini);
mqttClient.print(buff); 
mqttClient.endMessage();

There are three types of error conditions:

(1) ERROR: mbedtls_ssl_write() error:-0x50
(2)ERROR:mbedtls_ssl_write() error:-0x7100
(3)ERROR:mbedtls_ssl_write() error:-0x4e

(1) In the case of (2), connect() can be reinstated by rerunning
(3)For , freeze on endMessage() for about 10 minutes (not coming back from endMessage),
After that, you may or may not be able to restart connect() by rerunning it.

The operating environment has been updated to SPRESENSE v2.5.1 and LTE RK 2.1.2.10.108.54.

If you know how to deal with it, I would appreciate it if you could let me know.

spresense

2022-09-30 22:04

2 Answers

MbedTLS error codes are defined in two files:

https://github.com/sonydevworld/spresense/blob/master/externals/mbedtls/mbedtls-v2/include/mbedtls/ssl.h#L78
https://github.com/sonydevworld/spresense/blob/master/externals/mbedtls/mbedtls-v2/include/mbedtls/net_sockets.h#L52

According to this, the error is as follows:

(1) ERROR: mbedtls_ssl_write() error:-0x50→ Connection was reset by peer.
(2) ERROR:mbedtls_ssl_write() error:-0x7100→Bad input parameters to function.
(3) ERROR:mbedtls_ssl_write() error:-0x4e→Sending information through the socket failed.

I think (1) is simply disconnected from the other party.
(2) For , it means that the parameters given to mbedtls_ssl_write are defective, so it is possible that the parameters are incorrect or that the parameters are no longer available due to external factors.
(3) As for , it is possible that the Socket has failed to be sent, so the connection partner is no longer found (it is not closed, but cannot communicate).

In my experience, (3) often happens when the IP address is changed from the LTE network about once a day.
Therefore, when this error occurs, the IP change operation is running behind the scenes, so it may take some time to process it.

I hope it will be helpful.


2022-09-30 22:04

Thank you for your reply.
(2) ERROR:mbedtls_ssl_write() error:-0x7100
As for this, when I changed the LTE board from RK2 to RK3, it stopped coming out at all.
(3) ERROR:mbedtls_ssl_write() error:-0x4e
I heard from SIM manufacturers that this is easy to come out with a NAT type SIM.
SIM for dynamic global IP would be better or better.

As a result, the freezing phenomenon has not been stopped, so
I used the watchdog when it froze and restarted it to deal with it.


2022-09-30 22:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.