Jump to content

[Energia Library] Adafruit MDNS Library ported for Energia + CC3000

Recommended Posts

I ported the Adafruit MDNS Library for Energia + CC3000, tested on Tiva-C LP, should also work for F5529 LP after changing the Boosterpackpins.


Using this library you can access the CC3000 by "energia.local" or whatever you name it when calling mdns.begin(<servername>) in the setup.

You have to call mdns.update() in the main loop to handle incoming name queries.


I modified Robert's simpleWebServer example to use the library.


Be aware that some access points and wifi routers do not forward multicast packets from the LAN to the WiFi Interface.

(My Router has this bug and it took me over a week to find out...  :angry: )


This library is Copyright © 2013 by Tony DiCola published under MIT license (see CC3000_MDNS.h for details).

I just changed a few things to make it work with Energia.


Have fun, Nick 


Link to post
Share on other sites
  • 2 months later...

@Thorvard Thanks for sharing. 

What do you mean by "...after changing the Boosterpackpins"?

I am using F5529 LP with CC3000 boosterpack, Energia v12.


Do I need any firmware upgrade? My goal is to make the F5529LP device mdns discoverable so the mDNS Watch app could find it.


I tried adding mdnsAdvertiser(1, "CC3000", 6); in the SimpleWebServer example but doesn't work.


Please suggest.

Link to post
Share on other sites

@Thorvard Thanks for sharing. 

What do you mean by "...after changing the Boosterpackpins"?


The Example i included is for the Tiva-C Launchpad which uses different pins for the boosterpack than the LP5529, you have to change at line 51:

  // Set communication pins for CC3000
  WiFi.setCSpin(PE_0);  // 18: P2_2 @ F5529, PE_0 @ LM4F/TM4C
  WiFi.setENpin(PB_5);   //  2: P6_5 @ F5529, PB_5 @ LM4F/TM4C
  WiFi.setIRQpin(PB_2); // 19: P2_0 @ F5529, PB_2 @ LM4F/TM4C


  // Set communication pins for CC3000
  WiFi.setCSpin(P2_2);  // 18: P2_2 @ F5529, PE_0 @ LM4F/TM4C
  WiFi.setENpin(P6_5);   //  2: P6_5 @ F5529, PB_5 @ LM4F/TM4C
  WiFi.setIRQpin(P2_0); // 19: P2_0 @ F5529, PB_2 @ LM4F/TM4C

You also need to edit the Wifi SSID and Password at the start of the sketch.


I recommend updating the firmware of the  CC3000, at versions earlies than 1.26 the mDNSadvertise ignores the Name parameter, it uses instead "target.local".


i hope this helps, Thorvard

Link to post
Share on other sites

@Thorvard, thanks for the reply

I was able to capture the mDNS packet from CC3000 @ F5529  at Wireshark without changing the pin. Now after changing the pin in the sketch, the result is still the same - mDNS packet from CC3000 is seen in Wireshark but not in the  mDNS Watch app. Although I see my Apple devices in the  mDNS Watch app. 


I haven't updated the fw_patch.h (don't have one for F5529). The naming is not really an issue for me. But the page http://<ip_address>/config.html loads very slowly


Any thoughts?

Link to post
Share on other sites

Can you post a Wireshark screenshot of the mDNS packet, i like to see if its a broadcast or a multicast packet.


I've posted an updated fw_patch.h in the 43oh forum:


I've tested it on the Tiva-C Launchpad, but it should work on the 5529 launchpad too.

Very old firmwares of the cc3000 had problems with multicast pakets.


The slow loading of config.html is normal since the webserver send for each client.print() a seperate paket. A normal tcp paket can be about 1500 bytes large, but beware, in cc3000_common.h the paket size is limited to 130+1 bytes, you can edit this to 1519+1 bytes in line 147, change:




you can find cc3000_common.h in <installdir of energia>\hardware\msp430\libraries\SimplelinkWifi\utility\


regards, Thorvard

Link to post
Share on other sites

The wireshark capture looks fine to me, the cc3000 is multicasting the mDNS pakets correctly (as far as the cc3000 is correct).

But one question: do you have a mDNS client installed on your pc? Windows normally doesnt have a mDNS client, without it target.local will always fail.


You can either install iTunes (which includes a mDNS service called Bonjour) or only the Bonjour service, Apple offers a standalone Bonjour version for airprint.


Bonjour standalone: http://support.apple.com/kb/DL999


iTunes: http://www.apple.com/itunes/download/

Link to post
Share on other sites

The cc3000 does not correctly implement mDNS out of the box. The correct implementation of mDNS works like this:


- you type for example http://target.local in your browser

- the mDNS service on your machine multicasts a query paket to the network asking which machine is named "target.local"

- the target listens for mDNS queries on upd port 5353

- the target receives the query paket, checks the name and when the name in the query matches its own name it sends a reply paket publishing its IP (mDNS advertising paket)

- the paket is received by your machine and resolves "target.local" to the IP

- your browser connects to the IP


the cc3000 only implements mDNSadvertise(), it does not responds to query pakets, so you have to spam the network with advertisepakets in short intervals, this has some impact on the networkperformance.


i recommend the mDNS library which implement the listening for queries and only when it receives a query of its registered name it send an reply paket.


See the example included in the library for details.


regards, Thorvard

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...