Help Center/ IoT Device Access/ FAQs/ LwM2M/CoAP Device Access
Updated on 2023-12-12 GMT+08:00

LwM2M/CoAP Device Access

How Do I Connect Devices to the IoT Platform Through LwM2M over CoAP Protocols?

  1. Development on the platform: Create products, develop product models and codecs on the platform, and register devices. For details, see Creating a Product, Developing a Product Model, Developing a Codec, and Registering a Device.
  2. Development on the device: Use modules and Tiny SDKs on the device side for access. For details, see IoT Device SDK Tiny (C) User Guide.
  3. (Optional) Develop applications.

How Do I Know the Strength of the NB-IoT Network Signal?

Run the AT+CSQ command to query the NB-IoT signal strength.

The returned value is +CSQ. <rssi>,<ber>

A larger value of rssi indicates a stronger signal. The formula for calculating the signal strength is as follows: Signal strength = 113 dBm + (rssi x 2)

  • rssi = 0: The signal is poor.
  • rssi = 31: The signal is very strong.
  • rssi = 99: There is no signal.
  • The ber field is not used. It is fixed at 99.

If there is no signal or the signal is poor, contact the carrier.

Why Did the NB-IoT Module Not Attach to the Network?

  1. Run the AT+NUESTATS command to check whether there is a network signal.
  2. If the value of Signal power is 0, there is no network signal. Check whether the frequency band corresponding to the base station has been released, or move the device to somewhere where the signal is stronger and try again.
  3. Run the AT+NBAND? command to check whether the configured frequency band is the same as that of the module.

What Do I Do If an NB-IoT Module Failed to Be Bound to a Device?

When the NB-IoT module and real NB-IoT network are used to access the IoT platform, the first step is to bind a device.

If the device fails to be bound, you can troubleshoot the error by checking the following items:

  • When you register the device on the platform, are the values of nodeId correct? Is the timeout period too short?

    The values of nodeId must be the IMEI of the NB-IoT module. In addition, the timeout period should be long enough, so that the device can send a binding request to the platform within the period after the registration is successful.

  • Is the product information used during device registration the same as that in the product model?

    If you register the device in the IoTDA console, ensure that the correct product model is selected. If you call an API to register the device, make sure the value of deviceInfo is the same as that defined in the profile.

  • Is the signal from an NB-IoT base station reaching the module?

    Run the AT+CSQ? command to check the NB-IoT signal strength. If there is no signal or the signal strength is weak, contact the carrier.

  • Can the NB-IoT module be attached to the network?

    Run the AT+CEREG? command to obtain the network registration details. If the returned status is unregistered or rejected, contact the carrier. The version of the NB-IoT module may not match the version of the carrier's base station.

  • Can the NB-IoT module ping the Huawei Cloud IoT platform?

    Run the AT+NPING command to ping the Huawei Cloud IoT platform. If the platform cannot be pinged, it indicates that the carrier's network cannot reach the public network. Contact the carrier to check if its core network is connected to the public network and if the core network can be connected to only the carrier's IoT platform. Work with the carrier on the connection to the public network.

  • Are the domain name and port of the platform correctly set for the NB-IoT module?

    Run the AT+NCDP command to set the domain name and port of the platform. To obtain the domain name and port, log in to the IoTDA console and check the connection details of CoAP or CoAPs devices.

  • Does the AT command sent to the NB-IoT module end with \r\n?

    Each command sent to the NB-IoT module must end with \r\n. If not so, the command is cached in the NB-IoT module.

  • Is the transmitted data in the "SENT" status in the NB-IoT module?

    Run the AT+NQMGS command to check the status of the commands sent.

    PENDING: The data was sent but the platform has not responded.

    SENT: The data was sent and the platform has responded.

    ERROR: Data reporting is abnormal.

    If the status is PENDING or ERROR, there may be network issues. Check the base station and core network.

  • Can the AT+NMGS data sent by the NB-IoT module be parsed properly?

    Use the codec test tool to check whether the streams to be sent can be parsed.

What Can I Do If an NB-IoT Module Cannot Report Data?

Ensure that the NB-IoT module has been bound to a device. The binding is performed when the NB-IoT module reports the first piece of data to the IoT platform. If the binding fails, the device is not activated on the platform. In this case, resolve the fault by referring to What Do I Do If an NB-IoT Module Failed to Bind to a Device.

Let's assume that the device binding is successful and the device is displayed as online on the platform. Check the following the items:

  • Does the AT+NMGS command sent to the NB-IoT module end with \r\n?

    Each command sent to the NB-IoT module must end with \r\n. If not so, the command is cached in the NB-IoT module.

  • Can the payload of the sent AT+NMGS be parsed by the codec?

    Use the codec test tool to check the payload in the code stream to be sent. Check whether the message structure is correct and complies with the definition in the product model.

Why Was a 513 Message Reported During the Connection of an NB-IoT Device?

After being powered on, devices initiate a TUP registration flow to the IoT platform. TUP is a Huawei proprietary protocol over CoAP. It is similar to LwM2M. The TUP registration flow on HiSilicon chipsets cannot exceed 4 seconds. If the TUP registration is not completed within 4 seconds, a 513 message is reported.

When a 513 message is reported, do as follows:

  1. If a 513 message is reported due to poor network performance, contact the NB-IoT network carrier to check the network status.
  2. You are advised to restart the device and run AT+NMGS. When you send service data by running AT+NMGS, registration is triggered. If the subscription to the t/d resources (resources for receiving and sending service data) is not received within 4 seconds, an error is returned, but the registration is continued based on the CoAP-layer retransmission. Only when the subscription to the t/d resources is not received within 160 seconds, will the registration fail. The 160 seconds is sufficient for device registration. If an error message is returned after 4 seconds, only the data of the first packet is discarded. You are advised to restart the device and run AT+NMGS to trigger the registration.

    You can run AT+NMSTATUS? to query registration status. If +NMSTATUS:MO_DATA_ENABLED is returned, the registration is successful.

Why Does Data Reporting Fails When an NB-IoT Card Is Used in Another Device?

Some carriers' cards are bound to devices. If a device is changed, the card bound to the device may be unavailable. In this case, contact the carrier.

What Can I Do If I Cannot Connect a Registered NB-IoT Device to the IoT Platform?

  • Run the AT+CGATT=1 command in the module and see if there is an error reported. If there is, do as follows:
    • Contact the NB-IoT network carrier to check if the NB-IoT card works properly.
    • Contact the module manufacturer to check if the model works properly.
  • If no error is reported, check if the IP address and port number of the platform are correct.

You can obtain the IP address and port number from the platform service provider. Port 5683 is used for unencrypted access, whereas port 5684 is used for encrypted access.