LwM2M client with a B-L475E-IOT01A board (failed to setup networking)
Hello all,
I am experimenting with the LwM2M client example on a B-L475E-IOT01A board. Based on the lwm2m example that comes with Zephyr I have modified it and added code that initializes the Wi-Fi subsystem prior to the lwm2m setup. The code of the function can be found here: https://github.com/cvasilak/zephyr-lwm2m-client/blob/master/src/lwm2m-client.c#L94-L140 It is based on some networking example snippet found around the net. I can see from the logs that the connection to the WIFI succeeds and an IP address is assigned to the board (I can ping the board from another machine) . Unfortunately, the LwM2M subsystem complains with the following error when trying to establish a connection: .. 00:00:25.263,000] <err> net_lwm2m_engine: fcntl(F_GETFL) failed (-22) [00:00:25.296,000] <err> net_lwm2m_rd_client: Cannot init LWM2M engine () .. Here are the full logs: *** Booting Zephyr OS build zephyr-v3.2.0-3154-g3c4783042eed *** [00:00:00.546,000] <dbg> net_lwm2m_engine: lwm2m_engine_init: LWM2M engine socket receive thread started [00:00:00.546,000] <dbg> net_lwm2m_obj_security: security_create: Create LWM2M security instance: 0 [00:00:00.546,000] <dbg> net_lwm2m_obj_server: server_create: Create LWM2M server instance: 0 [00:00:00.546,000] <dbg> net_lwm2m_obj_device: device_create: Create LWM2M device instance: 0 [00:00:00.546,000] <dbg> net_lwm2m_obj_firmware: firmware_create: Create LWM2M firmware instance: 0 [00:00:00.546,000] <inf> net_lwm2m_client_app: Initializing network connection... Connected [00:00:07.554,000] <inf> net_lwm2m_client_app: Connected to network [00:00:07.554,000] <inf> net_lwm2m_client_app: Your address: 192.168.1.43 [00:00:07.554,000] <inf> net_lwm2m_client_app: Lease time: 0 seconds [00:00:07.554,000] <inf> net_lwm2m_client_app: Subnet: 0.0.0.0 [00:00:07.554,000] <inf> net_lwm2m_client_app: Router: 0.0.0.0 [00:00:07.554,000] <inf> net_lwm2m_client_app: Run LWM2M client [00:00:07.554,000] <dbg> net_lwm2m_registry: lwm2m_engine_set: path:0/0/2, value:0x2000d497, len:1 [00:00:07.554,000] <dbg> net_lwm2m_registry: lwm2m_engine_set: path:0/0/10, value:0x2000d496, len:2 [00:00:07.554,000] <dbg> net_lwm2m_registry: lwm2m_engine_set: path:1/0/0, value:0x2000d496, len:2 [00:00:07.557,000] <dbg> net_lwm2m_registry: lwm2m_engine_create_obj_inst: path:3303/0 [00:00:07.557,000] <dbg> net_ipso_temp_sensor: temp_sensor_create: Create IPSO Temperature Sensor instance: 0 [00:00:07.557,000] <dbg> net_lwm2m_registry: lwm2m_engine_create_obj_inst: path:3311/0 [00:00:07.557,000] <dbg> net_ipso_light_control: light_control_create: Create IPSO Light Control instance: 0 [00:00:07.557,000] <dbg> net_lwm2m_registry: lwm2m_engine_create_obj_inst: path:3340/0 [00:00:07.557,000] <dbg> net_ipso_timer: timer_inst_create: Create IPSO Timer instance: 0 [00:00:07.557,000] <inf> net_lwm2m_rd_client: Start LWM2M Client: disco_l475_iot1 [00:00:07.557,000] <dbg> net_lwm2m_registry: lwm2m_engine_set: path:3303/0/5700, value:0x2000d8f0, len:8 [00:00:08.547,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:0/0/1, buf:0x2000bfa7, buflen:1 [00:00:08.547,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:0/0/10, buf:0x2000bfde, buflen:2 [00:00:08.547,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:1/0/1, buf:0x2000bfb0, buflen:4 [00:00:08.548,000] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'disco_l475_iot1' with client lifetime 30 [00:00:08.548,000] <dbg> net_lwm2m_message_handling: lwm2m_parse_peerinfo: Parse url: coap://192.168.1.28 [00:00:08.649,000] <err> net_lwm2m_engine: fcntl(F_GETFL) failed (-22) [00:00:08.679,000] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-22) [00:00:09.679,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:0/0/1, buf:0x2000bfa7, buflen:1 [00:00:09.679,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:0/0/10, buf:0x2000bfde, buflen:2 [00:00:09.679,000] <dbg> net_lwm2m_registry: lwm2m_engine_get: path:1/0/1, buf:0x2000bfb0, buflen:4 [00:00:09.679,000] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'disco_l475_iot1' with client lifetime 30 [00:00:09.679,000] <dbg> net_lwm2m_message_handling: lwm2m_parse_peerinfo: Parse url: coap://192.168.1.28 [00:00:09.772,000] <err> net_lwm2m_engine: fcntl(F_GETFL) failed (-22) [00:00:09.803,000] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-22) ... As I mentioned earlier, pinging the board from my development machine works. ... $ ping 192.168.1.43 PING 192.168.1.43 (192.168.1.43) 56(84) bytes of data. 64 bytes from 192.168.1.43: icmp_seq=1 ttl=255 time=8.96 ms 64 bytes from 192.168.1.43: icmp_seq=2 ttl=255 time=4.30 ms ... In contrast, trying to ping from the board (using the network shell) I get this: ... uart:~$ net ping 192.168.1.1 PING 192.168.1.1 Failed to send ping, err: -134 ... I am newbie to Zephyr and possibly miss something obvious, will appreciate any help Kind regards, -Christos |
|