getaddrinfo error when porting "FOTA over Wi-Fi" exercise to nrf52840 + modem

I am trying to adapt lesson 9 (FOTA over Wi-Fi) exercise 7 of the DevAcademy nRF Connect SDK Intermediate course. I am trying to adapt it to work with nrf52840 connected to a simcom modem via UART. I managed to get it to boot but it fails at trying to resolve the DNS address.

See my changes here: https://github.com/olalonde/ncs-l9-e7/pull/1/files

It seems like the network connectivity goes up but when it is time of doing the dns request (getaddrinfo), the packet never makes it to the modem. If it did, we would see a CMUX log with some data after getaddrinfo is called, but it doesn't happen.

Full log: github.com/.../LOGS.txt

Relevant part:

[00:00:26.858,245] <inf> aws_iot_sample: Network connectivity established
...
...
[00:00:31.858,337] <inf> aws_iot_sample: Connecting to AWS IoT
[00:00:31.858,581] <dbg> mqtt_helper: broker_init: Resolving IP address for XXXX-ats.iot.us-east-2.amazonaws.com
[00:00:31.859,191] <dbg> net_l2_ppp: net_pkt_hexdump: send L2
[00:00:31.859,252] <dbg> net_l2_ppp: net_pkt_hexdump: 0x200314dc
                                     45 00 00 52 00 00 00 00  40 11 b9 69 64 7c 15 46 |E..R.... @..id|.F
                                     c8 58 7f 17 f3 b1 00 35  00 3e d5 aa 46 d9 01 00 |.X.....5 .>..F...
                                     00 01 00 00 00 00 00 00  08 78 78 78 78 2d 61 74 |........ .xxxx-at
                                     73 03 69 6f 74 09 75 73  2d 65 61 73 74 2d 32 09 |s.iot.us -east-2.
                                     61 6d 61 7a 6f 6e 61 77  73 03 63 6f 6d 00 00 01 |amazonaw s.com...
                                     00 01                                            |..               
[00:00:36.959,472] <err> mqtt_helper: getaddrinfo() failed, error -11
[00:00:36.959,533] <dbg> mqtt_helper: mqtt_state_set: Skipping transition to the same state (MQTT_STATE_DISCONNECTED)
[00:00:36.959,564] <err> aws_iot: mqtt_helper_connect, error: 11
[00:00:36.959,564] <err> aws_iot_sample: aws_iot_connect, error: 11

I assume there is something wrong with my configuration?

I am new to Zephyr/embedded development but it's as if getaddrinfo was not communicating with the modem PPP driver at all? 

I am able to successfully run the secure MQTT sample and cellular modem samples from Zephyr so I don't think it's an issue with the modem driver. I also tried increasing the DNS timeout but that doesn't help.

github.com/.../modem-port

Parents
  • After some debugging, I think the issue might be related to the fact that src/main.c uses the system work queue to resolve the address but the modem ppp driver also uses the system work queue leading to a deadlock? It seems that `k_work_submit(&ppp->send_work);` in `modem_ppp_ppp_api_send()` from `modem_ppp.c` gets called but the work handler (`modem_ppp_send_handler`) never gets executed.

    edit: Yep, that was the issue. I modified main.c to use its own work queue instead of system queue and it fixed this problem.

Reply
  • After some debugging, I think the issue might be related to the fact that src/main.c uses the system work queue to resolve the address but the modem ppp driver also uses the system work queue leading to a deadlock? It seems that `k_work_submit(&ppp->send_work);` in `modem_ppp_ppp_api_send()` from `modem_ppp.c` gets called but the work handler (`modem_ppp_send_handler`) never gets executed.

    edit: Yep, that was the issue. I modified main.c to use its own work queue instead of system queue and it fixed this problem.

Children
No Data
Related