This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220S: mDNS: Uniquely identifying similar stations on a local network

Part Number: CC3220S

Can someone help guide me on how best to implement the following.

I have 5x CC32xx devices connected as stations to a home router. They communicate with each other (a pair at a time using UDP) via the router. This all currently works via hard coded IP addresses. I’m now at the point where I need to make a real world implementation where each device will be provisioned and an IP address assigned.

My current understanding is:

  1. When I provision the device I would enter a unique name in the ‘Name your device’ field on the mobile phone. For example ‘STA_1’ (ending up with STA_5 for all 5 devices)
  2. Upon successful provisioning the new device can advertise and discover other devices/services using mDNS API functions (Query, other?)

Is there a way to only store the ‘STA_x’ devices in the list with just IPV4 address and port number?

I see the documentation in the NWP User’s Guide and just checking whether the above is the way to do it (or is there another?) and if there’s any more specific/concise example code available.

Grateful for any inputs.

regards,

Stuart

  • Hi Stuart,

    Yes, approach with mDNS can work, but t may to be better use slightly different approach with own Zero-conf protocol.

    Device can listen at selected UDP port for UDP broadcast. When receive packet with know structure it can response with own name, port and any other information. There could be two types of requests:

    • Response from all devices at network
    • Response from device with exact name

    You will be able to use this protocol to discover all your devices inside network during provisioning. After that device will be provisioned, you will use this protocol to discover IP address of device with exact name.

    Be aware that delivery of UDP broadcast may to be less reliable at WiFi network. That means you will need to have implemented some repeat mechanism.

    Jan

  • Hi Jan,

    Many thanks for your prompt answer.

    I do like the approach with zero-conf protocol and not having to implement mDNS.

    'When receive packet with know structure it can response with own name...'

    I thought the response would only have the numeric IP address and port number and not a name ? I thought you needed to use a mDNS query to get a name  ?

    I'm reading up on some background info to help me better understand and may come back to you early next week with some further questions.

    Stuart

     

  • Hi Stuart,

    Inside your UDP response you can have anything you want (port, device name, serial number, etc.).

    Using UDP broadcast you will achieve similar things like using mDNS with advantage of totally customisable data in the answer.

    But be aware that this approach will work inside local network only (this is same as mDNS). If devices will be at multiple subnets, it will be better send data through some server (e.g. MQTT).

    Jan