This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 LWM2M sample with Leshan prj.conf setup

I've been trying to run the LWM2M sample from here but I've been running into some issues. Leshan provides two URLs for publicly accessible test LWM2M servers, coap://leshan.eclipseprojects.io:5683 and coaps://leshan.eclipseprojects.io:5684, as described here. I've followed the instructions on the "nRF9160: LwM2M Client" page but I've been unable to connect to the LWM2M server and my client prints this error:

[00:17:17.579,650] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'nrf-{IMEI REDACTED}' with client lifetime 30
[00:17:17.579,772] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-22)

My best guess is that I'm entering the server URL in the prj.conf incorrectly. I've tried a few different possible combinations but to no avail

CONFIG_APP_LWM2M_SERVER="coaps://leshan.eclipseprojects.io:5684"
CONFIG_APP_LWM2M_SERVER="coaps://leshan.eclipseprojects.io"
CONFIG_APP_LWM2M_SERVER="leshan.eclipseprojects.io:5684"
CONFIG_APP_LWM2M_SERVER="coap://leshan.eclipseprojects.io:5683"
CONFIG_APP_LWM2M_SERVER="coap://leshan.eclipseprojects.io"
CONFIG_APP_LWM2M_SERVER="leshan.eclipseprojects.io:5683"
CONFIG_APP_LWM2M_SERVER="leshan.eclipseprojects.io"

I also have my LWM2M_PEER_PORT set to 5684 if that matters. It could also be possible that my PSK settings are wrong. My config in the Leshan server is as described in the guide (id=Client_identity, PSK=000102030405060708090a0b0c0d0e0f, endpoint=nrf-{IMEI})

Any help to get this sample up and running would be appreciated.

EDIT:

I've checked the modem firmware and it's up to date (1.0.1). I also verified the Leshan demo LWM2M server using a separate LWM2M client running locally and it appears to be working fine as well.

Related