I’m trying to connect a WP7702 to AWS IoT Core over MQTT. I’ve added the embedded C sdk with mbedtls on the device and made a test app. All is good until we get to the part where a connection is attempted.
sdkComponent.c (7.2 KB) My component source.
Feb 17 18:19:56 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c _sdkComponent_COMPONENT_INIT() 256 | Starting AWS SDK
Feb 17 18:19:56 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c _sdkComponent_COMPONENT_INIT() 265 | Currently: 2
Feb 17 18:19:57 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c _sdkComponent_COMPONENT_INIT() 270 | Requesting connection...
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c ConnectionStateHandler() 244 | Interface rmnet_data0 connected.
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 104 | AWS IoT SDK Version 3.0.1-
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 110 | rootCA /certs/rootCA.crt
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 111 | clientCRT /certs/certificate.pem
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 112 | clientKey /certs/private.pem
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 139 | Connecting...
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 148 | . Seeding the random number generator...
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 156 | . Loading the CA root certificate ...
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 162 | ok (0 skipped)
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 164 | . Loading the client cert. and key...
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 177 | ok
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 179 | . Connecting to a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com/8883...
Feb 17 18:20:06 swi-mdm9x28-wp user.err Legato: =ERR= | awsComponentExe[5877]/sdkComponent T=main | network_mbedtls_wrapper.c iot_tls_connect() 182 | failed ! mbedtls_net_connect returned -0x52
Feb 17 18:20:06 swi-mdm9x28-wp user.err Legato: =ERR= | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c run_main() 143 | Error(-23) connecting to a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com:8883
Feb 17 18:20:06 swi-mdm9x28-wp user.info Legato: INFO | awsComponentExe[5877]/sdkComponent T=main | sdkComponent.c ConnectionStateHandler() 250 | Interface disconnected.
The error is MBEDTLS_ERR_NET_UNKNOWN_HOST which is commented with "Failed to get an IP address for the given host.
I made a test app on PC and ran the sample apps just fine so all the connection information is correct. I can also ping and telnet the endpoint on PC:
johannes@legato-dev:~$ ping a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com
PING a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com (18.195.54.196) 56(84) bytes of data.
64 bytes from ec2-18-195-54-196.eu-central-1.compute.amazonaws.com (18.195.54.196): icmp_seq=1 ttl=234 time=34.5 ms
64 bytes from ec2-18-195-54-196.eu-central-1.compute.amazonaws.com (18.195.54.196): icmp_seq=2 ttl=234 time=34.2 ms
johannes@legato-dev:~$ telnet a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com 8883
Trying 18.194.135.217...
Connected to a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com.
johannes@legato-dev:~$ telnet a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com 443
Trying 35.157.179.254...
Connected to a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com.
But on the device it fails with telnet:
root@swi-mdm9x28-wp:~# ping a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com
PING a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com (18.192.252.248): 56 data bytes
64 bytes from 18.192.252.248: seq=0 ttl=239 time=69.754 ms
64 bytes from 18.192.252.248: seq=1 ttl=239 time=93.814 ms
root@swi-mdm9x28-wp:~# telnet a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com 8883
Connection closed by foreign host
root@swi-mdm9x28-wp:~# telnet a1o5neajgmytt9-ats.iot.eu-central-1.amazonaws.com 443
Connection closed by foreign host
My device information:
root@swi-mdm9x28-wp:~# cm info
Device: WP7702
IMEI: 352653090160540
IMEISV: 5
FSN: VU926300110710
Firmware Version: SWI9X06Y_02.35.02.00 5208b3 jenkins 2020/06/10 00:30:12
Bootloader Version: SWI9X06Y_02.35.02.00 5208b3 jenkins 2020/06/10 00:30:12
MCU Version: 002.014
PRI Part Number (PN): 9908741
PRI Revision: 002.001
Carrier PRI Name: GENERIC
Carrier PRI Revision: 001.064_001
SKU: 1104214
Last Reset Cause: Power Down
Resets Count: Expected: 176 Unexpected: 0
root@swi-mdm9x28-wp:~# legato version
19.11.2_f16c0ec00a58a647d801735f92005e87
I can also fetch websites with curl without any problems. Is this a firewall thing or what’s going on?