chipKIT® Development Platform

Inspired by Arduino™

Digilent's DWIFIcK WiFi Beta Library

Created Thu, 16 Feb 2012 08:10:53 +0000 by KeithV


Thu, 16 Feb 2012 08:10:53 +0000

Digilent just posted a beta version of their DWIFIcK WiFi libraray. This library adds WiFi support to the DNETcK IP Network library (Digilent’s extension of the Ethernet library). This library works with the MRF24WB0MA WiFi transceiver. Just unzip the library in your libraries directory. Both the DWIFIcK library and transceiver can be found at:,401,884&Prod=PMOD-WIFI

This is a beta version and there is no documentation for the WiFi Class yet, however there are 8 examples that should make it clear how to use the class. I figured this is a desirable enough library that getting it out early is a good thing, and I need feedback to determine what I am missing before I am willing to say it is done. If you have a DNETcK sketch it should be almost trivial to update it to WiFi. In short, you connect to WiFi and then use DNETcK as before. There are some issues that I am still working out and I will try to explain them.

  1. DWIFIcK contains both the source for the WiFi Class as well as a modified version of DNETcK to be used with the WiFi Class. Ultimately I hope to make the DNETcK sources exactly the same for wired and wireless usage; but today there are some differences in the initialization. Unfortunately, if you are using DNETcK for wired Ethernet sketches, when you install the DWIFIcK library MPIDE will pick up the DNETcK from the DWIFIcK library and your wired sketch will no longer work. Sorry, I need to fix this somehow; but for now under your libraries directory only have the DNETcK or DWIFIcK library installed, but not both; so move one library to a backup location when not in use. One way or another I will fix this.

  2. The MRF24WB0MA is a 1&2Mbps device. That is within the Wireless-B range and will most likely show up on your router as Wireless-B (but does not have too). But more to the point, your router MUST support 1&2Mbps and must support a basic rate of 1&2Mbps. So what does this mean exactly? Yeah, exactly, it should just work right? It is a complicated issue and I won’t bore you with the blah, blah, blah and just try and explain how to get this to work for you. a. First, just try to connect with your router’s default settings; there is a good chance it will just work. b. The Basic Rate is a speed that the router will transmit basic information such as the broadcast SSID and security info on. Almost by specification, all routers are supposed to support basic rates of 1&2Mbps, and optionally higher ones if they like. However some routers have proprietary features that transmit this data at higher rates and some don’t even support the 1&2Mbps by default because almost no current devices run that slow anymore; except the MRF24WB0MA. If your router does not have a basic rate of 1&2 Mbps, the MRF24WB0MA will not connect. To solve this, some routers have options to specifically set the basic rate (so select 1&2Mbps). Other routers will do this if you select Wireless-B or Mixed Wireless B,G,&N. And then other routers will just support basic rates of 1&2Mbps by default and you can get away with just selecting Wireless-G or N. Another thing to try if things don’t work, try turning off all proprietary options, like QOS or speedup features. c. I found that my LinkSys just works. My Belkin I had to specify Mixed B,G, & N, and chipkit_Andy on the form had a NetGear that he had to install the DD-WRT open source Firmware to get the option to specify 1&2Mbps.

  3. WPA and WPA2 sound a lot alike, but they have very little in common. WPA was invented to “fix” WEP on existing hardware. WPA2 is the real fix and in most cases required new hardware. WPA is WEP on steroids; WPA2 is secure and is quickly becoming the standard. However from the users point of view WPA and WPA2 look similar, that is, you provide a SSID and passphrase and away you go. Most routers will support a mixed WPA/WPA2 mode, and the MRF24WB0MA WiFi MAL also supports mixed WPA/WPA2 mode. However, how the router and the MAL “determine” what to use when both are in mixed mode can get you in trouble. You would think that WPA2 would be selected, and that is typically the case. However, I have a router that has no problem (LinkSys) and one that has a terrible problem (Belkin). So by default I coded the MAL in WPA2 only mode, this seems to resolve most issues. However, if you are still having problems, put your router in WPA2 ONLY mode. If you need WPA, you can specify WPA with DWIFIcK but that requires you to use the long (explicit) form of the DWIFIcK::connect() to do that. Using the simpler overloaded SSID/PassPhrase DWIFIcK::connect() will put the MRF24WB0MA in WPA2 ONLY mode. a. Another issue with WPA/WPA2 to be aware of is that the passphrase is used to calculate a 32 byte key. This takes the MAL about 30 seconds to do. So when you use a passphrase expect the connection process to take 30s or more; this will appear like nothing is happening, but there is calculations going on. I provided an isConnected() method so you can loop and do other things while waiting for the connect. In fact, you must execute periodicTasks() in your loop in order for it to complete. Just look at the examples, this will become clear.

  4. I have found that once you are connected, the code is very reliable. I have a server that has been up for several weeks now without failure. All of the DNETcK features are supported once WiFi is up and running. The most comprehensive example is the RemoteWOL example and shows everything from a WiFi Scan, to connection loss and reconnect as well as a complete restart of both the WiFi connection as well as a DHCP restart. For Simplicity, start with the WiFiScan and TCPEchoClient examples; from there it should be clear.

OH, and this works on: Max32 with PmodShield and PmodWiFi on connector JC Uno32 with PmodShield and PmodWiFi on connector JC MX3cK with PmodWiFi on connector JE MX4cK with PmodWiFi on connector JB MX7cK with PmodWiFi on connector JF

And I can let you know that Digilent will be coming out with a WiFi Shield for the Max32 and Uno32 so you don't have to buy the PmodShield. I am not sure when this will hit the market, but expect it to be a few months. In the meantime you can use the PmodShield, your code will transfer to the WiFi Shield unaltered.

I suspect that we are going to get some issues with all of the various routers out there. I would like to get some feedback to see what problems we have, and what features I missed. I kept it simple for now, so let’s see what I missed.


Thu, 16 Feb 2012 09:23:26 +0000

That's great news. Thanks :!:

The only caveat for me is I've to find a breadboard I could solder my MRF24WB0MA on. :?


Thu, 16 Feb 2012 17:38:18 +0000

A quick trip to Radio Shack :o


Thu, 16 Feb 2012 17:42:28 +0000

Unfortunately, no longer in France :!:


Fri, 17 Feb 2012 00:16:14 +0000

Three messages after a first build:

annoying space in the folder name: DWIFIcK/utility/TCPIP Stack annoying space in the file extension: DWIFIcK/utility/DWIFIcKAPI .c

multiple definition of '_general_exception_handler' DWIFIcK/utility/DNETcKAPI.c /Applications/


Fri, 17 Feb 2012 05:52:19 +0000

I do not understand this...

What is this annoying space thing? do you suppose it is complaining about the space in the name "TCPIP Stack", that would be ugly as that is part of the Microchip MAL.

Do you define an exception handler?

Are you building an example? Which one?


Fri, 17 Feb 2012 05:58:41 +0000

Yes it is the space in the name; what are you building on?

I took the space out of DWIFIcKAPI .c, I didn't even notice that. But the space in TCPIP Stack you will have to live with as this comes from Microchip, sorry.

As for the excption handler, you must be defining one as well. Hmmm... interesting. I should probably remove mine huh? I do define one. For now, go into the library and just delete the handler.


Fri, 17 Feb 2012 09:00:47 +0000

Sorry, it was late and I posted it on a rush...

The example I worked with is WiFiScan.pde.

DNETcKAPI.c line 104

void _general_exception_handler(unsigned cause, unsigned status)

exceptions.c line 66

void _general_exception_handler(void)
	asm volatile("mfc0 %0,$13" : "=r" (_epc_code));
	asm volatile("mfc0 %0,$14" : "=r" (_excep_addr));

The space in the TCPIP Stack folder is annoying when using makefiles.


Fri, 17 Feb 2012 16:44:50 +0000

I removed the exception handler from DNETcKAPI.c, you can too. I removed the space in the name DWIFIcKAPI.c. You will have to live with the annoying space in the TCPIP Stack name; I really don't want to mess with the Microchip files. Please verify that that space is not blocking you?

Otherwise can you get it to build?


Fri, 17 Feb 2012 17:05:07 +0000

Thank you for your message.

I removed the exception handler from DNETcKAPI.c, you can too.

So did I.

I removed the space in the name DWIFIcKAPI.c.

So did I.

You will have to live with the annoying space in the TCPIP Stack name; I really don't want to mess with the Microchip files. Please verify that that space is not blocking you? Otherwise can you get it to build?

Yes, build works fine, even with the extra space, because the #includes are

#include "TCPIP Stack/TCPIP.h"


Sun, 19 Feb 2012 16:06:24 +0000

Just a question: have you considered Microchip MCW1001A? ( :arrow: data sheet)

MCW1001A is a companion chip to the MRF24WB0 802.11 module. It provides simple socket based method of sending and receiving data from the MRF24WB0 802.11 module. The MCW1001A has an on-board TCP/IP stack and 802.11 connection manager to simplify the connection between a wireless network and the TCP/IP stack management. After the initial configuration is set, the MCW1001A can access the MRF24WB0 802.11 module to connect to a network and send/receive serial data over a simple UART interface from the Host controller.

So basically, the trade is max speed of 230400 bps for hardware TCP/IP stack.


Fri, 24 Feb 2012 17:16:43 +0000

Short answer, no.

I don't make the hardware decisions and the library was written to the Pmod we are selling now... we just wanted to get WiFi working as a starting point.

I think it is reasonable to consider other hardware and I will bring this up with GeneA.


Wed, 21 Mar 2012 07:11:57 +0000

Hi Keith,

I also downloaded the DWIFIcK libs and I wanted to compile and upload to target(I have a chipKit max32 board) the WiFIScan example.The problem is that I got this type of errors at compilation:

'undefined reference to <function_name>'

This is the actual message returned by the compilator:

WiFiScan.cpp.o: In function setup': C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:84: undefined reference to DNETcK::setDefaultBlockTime(unsigned long)' C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:87: undefined reference to DWIFIcK::beginScan()' WiFiScan.cpp.o: In function loop': C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:200: undefined reference to DNETcK::periodicTasks()' C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:200: undefined reference to DNETcK::periodicTasks()' C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:95: undefined reference to DWIFIcK::isScanDone(int*, DNETcK::STATUS*)' C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:113: undefined reference to DWIFIcK::getScanInfo(int, DWIFIcK::SCANINFO*)' C:\Users\Calin\AppData\Local\Temp\build5667214434945342934.tmp/WiFiScan.cpp:100: undefined reference to `DNETcK::isStatusAnError(DNETcK::STATUS)' collect2: ld returned 1 exit status

Do you have any clue what this may be about?

Thank you!


Tue, 27 Mar 2012 14:47:19 +0000

These errors all appear to be on the .o or objects, so this is happening in the link phase; which would imply that the DNETcK and WIFIcK files did not compile. What system are you running this on? Linux/windows/mac?

My first guess is that you selected an unsupported board. Make sure you picked the Max32 in MPIDE. If you select a non-supported board, none of the DNETcK or WIFIcK code will build and will give you like errors like this.

The other possibility is that the other problem is that the official released DNETcK is incompatible with the beta DWIFIcK libraries and you don't want them both installed at the same time. I just got them to co-exist last week and am testing out that the libraries will work properly. But for now make user you "delete (move)" DNETcK before installing the beta DWIFIck library.

Hope this helps.


Sat, 07 Apr 2012 16:17:15 +0000

Hello Keith!

The selected board in MPIDE is the right one: ChipKit Max32. I have uninstalled the DNETck library but no improvement, the compiler still returns that kind of errors: 'undefined reference to <function name>'.

These errors appear only after I add the 'DNETck.h' and 'DWIFIcK.h' libraries to the sketch: Sketch -> Add File.... I think this is the right way to do it, isn't it?

Any other hints are welcomed!

I really need this WiFi module to be functional as it is crucial for a project that has to be done by June, 2012... So, please, help! :D




Tue, 10 Apr 2012 15:07:26 +0000

Sorry I have been off the form for a week.

Hold off for a day, I am having a new library installed on the Digilent site that will allow both DNETcK and DWIFIcK to co-exist. Then I want to carefully install this.

I need to know your installation, are you running windows? what version of MPIDE are you using?

The plan will be for you to delete DNETcK and DWIFIcK from your Arduino\libraries subdirectory and install the new library in your libraries subdirctory. This should replace both DNETcK and DWIFIcK.

I got the new libraries in the system to be updated on the Digilent site, I will let you know when it shows up. I'm hoping it shows today.


Tue, 10 Apr 2012 20:45:53 +0000

Digilent just posted the Beta 2 version of the WiFi library, you can find instructions at: