cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7B3I-DK (Tiny Shark) Wi Fi How To Configure mDNS

Garnett.Robert
Senior III

Hi,

This question is more a network protocol question than about MCU's however I am writing a driver for the Inventek and wish to use the built in mDNS server so the device may use DHCP and have a local host name.

The Inventek manual doesn't explain what the mDNS parameters do. I was thinking some one with better network knowledge than me might be able to help.

I have gotten the data transport working for UDP with the device configured as a station

I will publish the drivers on this site when I have got them working.

The parameters in question are:

‘D1’ Set mDNS State and Name. I am guessing state is whether the mDNS service is on or off and the name is the name that will be assigned as an alias of the device IP Address.

‘D2’ Set mDNS Services. This is the diffcult one: The usage is -

D2=<Service # 0/1>,<Instance(32chars)>,<Service(32Chars)>,<Port>,<TTL>

There seems to be an error in the manual as this command takes 6 parameters not the five shown in the usage.

The example shows 6 par's:

D2=0,1,web_service,_web_service._tcp.local,80,60

Does anyone know what these should be set to to get the mDNS working. I know that the TTL is "Time to Live" and that it is usually set to around 60 minutes.

As I'm using UDP I guess the 4th par should be:

_myName._udp.local and the port should be 5353

I have tried asking Inventek for help, but they haven't replied to my email.

Best regards

Rob

1 ACCEPTED SOLUTION

Accepted Solutions
Garnett.Robert
Senior III

Hi,

Thanks for that.

I got mDNS working very reliably.

Th command I ended up with is:

sendWiFiCmd("D2", "0", wf->mDNS_ServiceNo, wf->mDNS_Instance, wf->mDNS_Service, wf->mDNS_Port, wf->mDNS_TTL,...
 
 
where:
 
Par 1 = "0" => Service No
Par 2 = "shorttclock" => mDNS_Instance
Par 3 = "shorttclock._tcp.local" => mDNS_Service
Par 4 = "5353" => mDSN_Port  /* (according to Wikipedia this is standard at 5353) */
Par 5 = "60" =>  mDNS_TTL  /* In seconds */
 
 
 

Th example in the Inventek manual gives and example:

D2=0,1,web_service,_web_service._tcp.local,80,60

Which looks like 6 pars, but I am sure that the thing uses only five and that they have added an extra one "1" at the start of the example.

I don't know why I put shorttclock in twice, but it works and that's good enough for me.

I note their manual is preliminary, I haven't been able to get hold of a finished one.

In any event the command works OK. I wished to use mdns as I wanted to use DHCP sp users don't have to fiddle with IP addresses.

I started off thinking the WiFi Module was a beast, but after working with it for a while, it actully works very well.

I also used the getTime GT command. The manual doesn't tell you what the returned number is, but I guessed it was Unix Epoch time. Which it is. i.e. unsigned 64 bits.

This is a very handy feature for a real-time system as I can set the RTC clock with it.

Best regards

Rob

Best regards Rob.

View solution in original post

3 REPLIES 3
Garnett.Robert
Senior III

hi,

Just to follow up.

I used the following setup and got the mDNS to work, however I am still not sure what all the parameters do;

My code is:

#define M_DNS_OFF						 "0"
#define M_DNS_ON						 "1"
 
#define M_DNS_SERVICE_NO_0	 "0"
#define M_DNS_SERVICE_NO_1	 "1"
 
#define M_DNS_PORT					 "5353"
#define M_DNS_TTL 					 "60"
 
 
	wiFiPars.ssid 						= LINK_SYS_SSID;
	wiFiPars.hostName				= "shortclockudp";
	wiFiPars.mDNS_On				= M_DNS_ON;
	wiFiPars.mDNS_ServiceNo		        = M_DNS_SERVICE_NO_1;
	wiFiPars.mDNS_Instance		        = "shortclock";
	wiFiPars.mDNS_Service			= "shortclock._udp.local";
	wiFiPars.mDNS_Port				= M_DNS_PORT;
	wiFiPars.mDNS_TTL				= M_DNS_TTL;
 
The AT command becomes:
 
sendWiFiCmd("D2", "0", wf->mDNS_ServiceNo, wf->mDNS_Instance,  wf->mDNS_Service,  wf->mDNS_Port, wf->mDNS_TTL,  WIFI_CMD_TIME0UT)
 
"D2=0,1,shortclock,shortclock,shortclock._udp.local,5353,60"
 
 I set the device name:
 
wiFiPars.DeviceName				= "shortclockudp";
 
The command for this is:
sendWiFiCmd("D1", wf->mDNS_On, wf->DeviceName,  "",  "", "", "",  WIFI_CMD_TIME0UT)
 
Which provides and AT command of:
 
"D1=1,shortclockudp"
 

Even though it works I would still like to know the details of the parameters as I don't really understand what I'm doing

Guillaume K
ST Employee

Hello

I've never used mDNS service on Inventek WiFi.

I understand "D1" command advertises the human-readable name (DNS name) for the device,

I understand "D2" command advertises the various services offered by the device when queried by other devices on the local network. But you have to set up a TCP or UDP server for each service you advertise (Inventek "P1" and "P5" AT commands).

Note: I use Inventek "AT_Command_Set_Users_Manual_4.2.pdf" documentation. In the description of "D2" command I'm not sure what are the "2 available services" mentioned ? only 2 services can be advertised ?

In your first post you say that the usage in the user manual is wrong with 5 parameters. Is it ?

Is it really the example with 6 parameters which is right ?

note that in your example you use 7 parameters:

"D2=0,1,shortclock,shortclock,shortclock._udp.local,5353,60"

is it really needed to use "shortclock" twice ?

Garnett.Robert
Senior III

Hi,

Thanks for that.

I got mDNS working very reliably.

Th command I ended up with is:

sendWiFiCmd("D2", "0", wf->mDNS_ServiceNo, wf->mDNS_Instance, wf->mDNS_Service, wf->mDNS_Port, wf->mDNS_TTL,...
 
 
where:
 
Par 1 = "0" => Service No
Par 2 = "shorttclock" => mDNS_Instance
Par 3 = "shorttclock._tcp.local" => mDNS_Service
Par 4 = "5353" => mDSN_Port  /* (according to Wikipedia this is standard at 5353) */
Par 5 = "60" =>  mDNS_TTL  /* In seconds */
 
 
 

Th example in the Inventek manual gives and example:

D2=0,1,web_service,_web_service._tcp.local,80,60

Which looks like 6 pars, but I am sure that the thing uses only five and that they have added an extra one "1" at the start of the example.

I don't know why I put shorttclock in twice, but it works and that's good enough for me.

I note their manual is preliminary, I haven't been able to get hold of a finished one.

In any event the command works OK. I wished to use mdns as I wanted to use DHCP sp users don't have to fiddle with IP addresses.

I started off thinking the WiFi Module was a beast, but after working with it for a while, it actully works very well.

I also used the getTime GT command. The manual doesn't tell you what the returned number is, but I guessed it was Unix Epoch time. Which it is. i.e. unsigned 64 bits.

This is a very handy feature for a real-time system as I can set the RTC clock with it.

Best regards

Rob

Best regards Rob.