Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Problem with mDNS & Adafruit CC3000 Firmware V1.13 #1

Closed
marcoschwartz opened this issue Jul 3, 2014 · 9 comments
Closed

Problem with mDNS & Adafruit CC3000 Firmware V1.13 #1

marcoschwartz opened this issue Jul 3, 2014 · 9 comments

Comments

@marcoschwartz
Copy link

Hello, I recently updated my CC3000 Adafruit board with the Adafruit CC3000 Firmware V1.13 Upgrade Sketch, and the mDNS server was not working anymore (could access the board by IP, but the DNS name was making the Arduino crash). I reverted back to V1.12 and it works fine again.

@tdicola
Copy link
Contributor

tdicola commented Jul 3, 2014

Oh interesting, thanks for raising the issue. I'll give it a repro later today to see what might be the issue.

@tdicola
Copy link
Contributor

tdicola commented Jul 6, 2014

Was also able to repro that with v1.13 the MDNS responder doesn't get notifications and respond. I'm investigating more but have a suspicion that the CC3k firmware might be listening for MDNS itself and conflicting. Will take a closer to look to see what's going on though.

@tdicola
Copy link
Contributor

tdicola commented Jul 6, 2014

It looks like v1.13 has some known issues with UDP: http://e2e.ti.com/support/wireless_connectivity/f/851/t/342177.aspx TI suggests an odd workaround for now, calling gethostbyname with localhost after connecting to the network. Amazingly this seems to work and I can get MDNS working with v1.13. The call to gethostbyname even fails with a -95 error code, but something is done internally which seems to get it into a good state.

There's some troubling discussion in that thread that there are still issues, but to check if it works for you too what if you add this right before calling the MDNS responder's begin:

  // Call gethostbyname on localhost as suggested by TI to deal with firmware v1.13 issue:
  //  http://e2e.ti.com/support/wireless_connectivity/f/851/t/342177.aspx
  uint32_t output;
  int result = gethostbyname("localhost", 9, &output);
  if (result < 0) {
    Serial.print("gethostbyname failed: ");
    Serial.println(result, DEC);
  }
  else {
    Serial.println("gethostbyname succeeded");
  }

  // Start multicast DNS responder
  if (!mdns.begin("cc3kserver", cc3000)) {
    Serial.println(F("Error setting up MDNS responder!"));
    while(1); 
  }

(ignore the lines after // Start multicast DNS responder... , they're just there for reference where to put the call)

Let me know how that works for you and I can look at adding it to the library's begin function as a workaround. You might see the call to gethostbyname fail, but try the MDNS request anyways. Still kind of concerning that v1.13 appears to have other strange behavior with UDP, but hopefully this works.

edit: Forgot to add, include utility/socket.h to get gethostbyname included if it isn't already included in your sketch.

@tdicola
Copy link
Contributor

tdicola commented Jul 6, 2014

Also I just merged in to master a small refactor I did earlier, this reduces the memory usage and simplifies the parsing. It doesn't really affect the firmware issue here but as an FYI you might grab the library again now to get this latest version.

@fynixtech
Copy link

Hello, I am having this same problem with firmware 1.13. I am unable to find the mDNS broadcast information from the CC3000. I have tried scanning using wireshark and wireshark does not discover the CC3000. It works via IP address though. I have tried the suggestion above using utility/socket.h and i only get the -95 error.

@tdicola
Copy link
Contributor

tdicola commented Aug 28, 2014

Interesting, adding the code block above to call gethostbyname on "localhost" in setup doesn't help the issue? I tried it earlier and it seemed to work, but I wonder if there's something else going on. What platform are you using to send the mDNS query, is it mac os, linux, windows, etc? Also if you downgrade to the 1.12 firmware (can use driverpatch_1_12 in the examples folder of the cc3000 library) does it work again?

As far as the root issue with UDP in 1.13 goes I haven't seen anything from TI unfortunately. They acknowledged the problem but mention it's a tradeoff to fix the TCP issues in 1.12. I'll take a look through the cc3000 forum later today to see if there's any updates.

@fynixtech
Copy link

I am using an iphone to send the mDNS query using the app mDNS watch which looks for mDNS services. I also tried using wireshark on Windows7 Ultimate x64 and wireshark finds all other mDNS devices except the CC3000. I get the -95 error code but no mDNS broadcast. I downgraded one of my CC3000 breaout boards to v1.12 and still the same problem. I will try again today and see what happens. I read in a TI forum that mDNS implementation in the CC3000 is buggy and to try a software implementation of mDNS running on the mcu but I dont have that level of coding skills. Is there any known software level mDNS for the CC3000?

@fynixtech
Copy link

I figured out the problem I was calling gethostbyname before connecting the CC3000 to the wifi network. I fixed that and now it all works. Thanks so much Tony

@tdicola
Copy link
Contributor

tdicola commented Aug 31, 2014

Ah yep, it needs to be called once connected but before begin() is called. Thanks for helping to check the workaround succeeds. I just commited a changed to integrate the call to gethostbyname on localhost into the begin() function. Annoying to have to put it in the library, but at least it works on both v1.13 and v1.12. Grab the latest library and you should just be able to use it as is without any extra call to gethostbyname in your sketch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants