diff --git a/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt b/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt index 7ee0400ba7cac5..c3e6c69dda7df9 100644 --- a/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt +++ b/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt @@ -21,3 +21,5 @@ else() endif() target_sources(app PRIVATE "src/main.c" ${creds}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/cloud/aws_iot_mqtt/boards/mg100.conf b/samples/net/cloud/aws_iot_mqtt/boards/mg100.conf new file mode 100644 index 00000000000000..c2e957392c5624 --- /dev/null +++ b/samples/net/cloud/aws_iot_mqtt/boards/mg100.conf @@ -0,0 +1,11 @@ +# The HL7800 driver gets its IP settings from the cell network +CONFIG_NET_CONFIG_SETTINGS=n +CONFIG_NET_DHCPV4=n +CONFIG_DNS_SERVER_IP_ADDRESSES=n +# NB-IoT has large latency, so increase timeouts. It is ok to use this for Cat-M1 as well. +CONFIG_NET_SOCKETS_DNS_TIMEOUT=12000 +CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=15000 +# Wait for the network to be ready +CONFIG_NET_CONNECTION_MANAGER=y +# Don't require device to have time/date +CONFIG_MBEDTLS_HAVE_TIME_DATE=n diff --git a/samples/net/cloud/aws_iot_mqtt/boards/pinnacle_100_dvk.conf b/samples/net/cloud/aws_iot_mqtt/boards/pinnacle_100_dvk.conf new file mode 100644 index 00000000000000..c2e957392c5624 --- /dev/null +++ b/samples/net/cloud/aws_iot_mqtt/boards/pinnacle_100_dvk.conf @@ -0,0 +1,11 @@ +# The HL7800 driver gets its IP settings from the cell network +CONFIG_NET_CONFIG_SETTINGS=n +CONFIG_NET_DHCPV4=n +CONFIG_DNS_SERVER_IP_ADDRESSES=n +# NB-IoT has large latency, so increase timeouts. It is ok to use this for Cat-M1 as well. +CONFIG_NET_SOCKETS_DNS_TIMEOUT=12000 +CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=15000 +# Wait for the network to be ready +CONFIG_NET_CONNECTION_MANAGER=y +# Don't require device to have time/date +CONFIG_MBEDTLS_HAVE_TIME_DATE=n diff --git a/samples/net/cloud/aws_iot_mqtt/prj.conf b/samples/net/cloud/aws_iot_mqtt/prj.conf index fa0a5202a5dce3..ef5f6574ef7523 100644 --- a/samples/net/cloud/aws_iot_mqtt/prj.conf +++ b/samples/net/cloud/aws_iot_mqtt/prj.conf @@ -71,3 +71,9 @@ CONFIG_MBEDTLS_TLS_VERSION_1_2=y CONFIG_MBEDTLS_MEMORY_DEBUG=y CONFIG_MBEDTLS_HAVE_TIME_DATE=y CONFIG_MBEDTLS_SSL_ALPN=y + +# Debugging options +# CONFIG_MBEDTLS_DEBUG=y +# CONFIG_MBEDTLS_LOG_LEVEL_DBG=y +# CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=1 +# CONFIG_LOG_BUFFER_SIZE=50000 diff --git a/samples/net/cloud/aws_iot_mqtt/src/main.c b/samples/net/cloud/aws_iot_mqtt/src/main.c index c03f250bcaa21f..5c78e78530c43f 100644 --- a/samples/net/cloud/aws_iot_mqtt/src/main.c +++ b/samples/net/cloud/aws_iot_mqtt/src/main.c @@ -17,6 +17,7 @@ #include #include #include +#include "net_sample_common.h" #if defined(CONFIG_MBEDTLS_MEMORY_DEBUG) @@ -453,6 +454,8 @@ int main(void) { setup_credentials(); + wait_for_network(); + for (;;) { resolve_broker_addr(&aws_broker);