Arduino and WIZ810MJ ethernet module status update

We've been talking about this over here but I thought it might be worth mentioning it in the forums as well.

I'm working on porting the driver for the WIZ810MJ ethernet module to a form usable in the Arduino. A couple of other people are working on a PCB breakout board for the module as it uses non-breadboard/protoboard-compatible 2mm pitch headers (instead of the usual 0.1"). I've been using 2mm pitch jumpers salvaged from a floppy drive or you could also try 2mm pitch IDC ribbon connectors/cable.

You can track my Arduino and WIZ810MJ ethernet module progress here but the current state is I've got it working with ported driver routines enough to be a simple echo server that sends data okay but has some problems with receiving it. :slight_smile: The data's received okay, it's just a matter of accessing it. :slight_smile: Example source code and (currently only) binaries of the library files are linked from the page.

The reason why this particular module is of note at the moment is that Circuit Cellar and WIZnet are currently running a design competition and are (presumably, still) handing out a sample module if you request one.

Well, it turned out I fixed the receiving issue a few minutes later, but it's taken me until now to upload an all-in-one archive.

So, I've now updated the page:

http://code.rancidbacon.com/LearningAboutArduinoWIZ810MJ

with library binaries and demo source for echo server. (Version 0.0.3)

It's all rough at present but should be enough to get you started.

I'd be interested in feedback from anyone who tries it.

--Phil.

I designed a WIZ810MJ to breadboard spi adapter and it is available for purchase here: http://www.nkcelectronics.com/wiznet-wiz810mj-module-to-breadboard-spi-adap.html

Just a brief update while I think of it:

  • Constructed a IDC ribbon cable.

  • Have working echo server.

  • Have rough demo of webserver.

Check out Learning About Arduino and WIZ810MJ - LearningAboutArduinoWIZ810MJ for more details.

--Phil.

Follower, I think there is a bug in the WizDemo2.pde file:

byte config_gateway[] = {192,168,0.1};

I guess everybody is changing config_gateway anyway, and fixing the problem... but some n00bs can get confused with the 0.1 at the end, instead of 0,1

The webserver demo works great!!!

Indeed, Circuit Cellar is still accepting requests for free WIZnet samples of the 810 module but not for much longer. So if you want one, please make your request very soon. I am looking forward to seeing what this special community can build for this design contest. I'm already seeing a number of interesting sample requests referencing Arduino. I know WIZnet isn't asking for a lot. A cool project is always appreciated, but WIZnet is interested in basic applications as well and Circuit Cellar is known for making it worthwhile for contest entrants (whether they win or not). Good luck to all of you.

http://www.circuitcellar.com/wiznet/sample.html

-Sean (Publisher, Circuit Cellar)

Follower, I think there is a bug in the WizDemo2.pde file:

byte config_gateway[] = {192,168,0.1};

I guess everybody is changing config_gateway anyway, and fixing the problem... but some n00bs can get confused with the 0.1 at the end, instead of 0,1

Thanks for pointing out the issue--the current version should now work correctly. Also, for now the strings are back in RAM but that removes the need for a dependency which was causing problems as it wasn't included in the directory.

The webserver demo works great!!!

Cool, thanks for the feedback, much appreciated.

--Phil.

Time for another update:

I've been working on tidying up the code and pulling everything into nicely encapsulated classes in preparation for a "usable" 0.1 release.

The code I discuss here is all in the SVN repository.

The "demo of the moment" is four simultaneous echo server connections which is pretty cool--and also something that the Xport can't do... :slight_smile:

Of course, the code you have to use to setup four listening echo server connections on port 7 is pretty complicated:

  [color=#777755]// This uses the 1-argument constructor of EchoServer and supplies it with 7 for each instance.[/color]

EchoServer servers[MAX_SOCK_NUM] = {7, 7, 7, 7}; // This will break if MAX_SOCK_NUM changes.
 
 while (1) {
   for (int i=0; i<MAX_SOCK_NUM; i++) {
     servers[i].next();
   }
 }

Oh, wait, no it's not... :slight_smile:

I've had this working with three nc (netcat) sessions and one interactive telnet session running--no major lag issues.

If you want to do it the hard way you can skip the EchoServer class and do something like this (only one connection):

  NetworkConnection conn = Network.listen(7);

Serial.println("Waiting for connection...");

while (!conn.isConnected()) {
   [color=#996600]delay/color;
 }
 
 Serial.[color=#996600]println/color;

while (conn.isConnected()) {
    if (conn.[color=#996600]available/color) {
      conn.[color=#996600]print/color;
    }
 }
 
 Serial.[color=#996600]println/color;

conn.close();

The demo with the classes and four connections is about 8.9K in size with no major optimisation effort.

--Phil.

Hmmm, the code indentation seems to have been lost compared to the preview... :frowning: (And the edit function doesn't like [i] in the code!).

--Phil

If you're interested, here's an update on some progress with Arduino and IRC.

--Phil.

Awesome work on this.

I tried to use your code - I grabbed WizDemo3 and the associated library files, but I can't get it to compile. I get lots of warnings about "Stray '#' in program" and so on.

Not a lot to go on I know, but any ideas on what I can do to get it to compile?

I'm using a USB arduino, currently AtMega8, but also tried AtMega168.

I grabbed WizDemo3 and the associated library files, but I can't get it to compile. I get lots of warnings about "Stray '#' in program" and so on.

Not a lot to go on I know, but any ideas on what I can do to get it to compile?

Thanks for trying out the code. Could you please post the complete error message you're getting?

I'm using a USB arduino, currently AtMega8, but also tried AtMega168.

FWIW I've only tried it with the ATMega168 and currently I don't think it'd fit in a ATMega8.

--Phil.

FWIW I've only tried it with the ATMega168 and currently I don't think it'd fit in a ATMega8.

Could have something to do with it - also the reigsters and timers have different names between the 8 and 168, don't know if you get down to that level.

OK last time I tried it on version 0010, and maybe I stuffed up where the libraries are supposed to go, as they changed paths in that version. I'll try back in 0008.

I can't say I've ever used SVN before, so let me make sure I'm doing/grabbing the right things.

Starting at

root/branches/follower/wiz810mj

I go to src -> demo -> WizDemo4 -> WizDemo2.pde -> Download in Other Formats -> raw

saved that into a new sketch in the IDE.

then went back to

root/branches/follower/wiz810mj

Went to src -> lib

saved all the files with their extensions into a created directory

arduino-0008\lib\targets\libraries\WIZ810MJ

Yeah! It compiles on my work computer using IDE 0008.

Will try connecting it all up and writing it to the 168 when I get home.

Could have something to do with it - also the reigsters and timers have different names between the 8 and 168, don't know if you get down to that level.

Yeah, that might be an issue also.

OK last time I tried it on version 0010, and maybe I stuffed up where the libraries are supposed to go, as they changed paths in that version.

According to the README (who knows if it's accurate :slight_smile: ):

For Arduino version 0010 the library directory location is:

/hardware/libraries/

For Ardino version 0009 the library directory location was:

/lib/targets/libraries/

I can't say I've ever used SVN before

Yeah, once the code's more prepared I'll cut a tarball...

so let me make sure I'm doing/grabbing the right things.

Thanks for persisting. :slight_smile: BTW what are you using to connect the WIZ810MJ module to your Arduino?

I go to src -> demo -> WizDemo4 -> WizDemo2.pde -> Download in Other Formats -> raw

Hmmm, that's really weird, that file WizDemo2.pde shouldn't even be there--it's not on my system, so I don't no why it's not deleted in the repository. Anyway, you'll really want the WizDemo4.pde file.

Glad to see you got it working in your next post--hopefully WizDemo4.pde will work just as well. :slight_smile:

Please let me know how it goes--if you're ever on IRC on the #arduino channel I'm often there.

--Phil.

Damn it! just lost a big reply.

OK, my request for help..

Got WizDemo4.pde compiled and going in Arduino-009.

Using breakout board from nkcelectronics

http://www.nkcelectronics.com/wiznet-wiz810mj-module-to-breadboard-spi-adap.html

Got a 3.3V regulator taking 5.5V from the arduino, giving the breakout board 3.3V. All data lines directly interfaced like this...

PIN_DATA_OUT 11 // MOSI (Master Out / Slave In)
PIN_DATA_IN  12 // MISO (Master In / Slave Out)
PIN_SPI_CLOCK  13 // SCK (Serial Clock) 
PIN_SLAVE_SELECT 10 // SS (Slave Select)
PIN_RESET 8

LED connected to pin 2

On reset, I get LED indicators on W5100 module on solid,, "PWR, "LINK", and "FDX" LEDs on breakout lit, "TX"< "RX", "COL" LEDs off.

Randommly "RX" LED lights and "LINK" LED goes off for a brief time.

Get this output in the serial window

Setup enter...
Start W5100 configuration...
End W5100 conffiguration...
Setup exit...
Test sockets...

My router subnet mask is set to 255.255.255.0 . I've tried mucking around with

Network.device.setIp(192,168,1,20);

but it doesn't matter - I never seem to get past the "test sockets..." stage.

I can't say I know a lot about networking, so my apologies if I'm missing something basic, or if what I need to do is over my head - I can't say I understand all your code. Any help though would be awesome - just getting the LED web server up and running would be sweet.

Thanks,

Alex

OK I can now get a ping response!

I need to do a proper hardware startup - power up both, reset arduino, reset wiznet.

Ping response as expected. If I point a web browser at it, the "TX" and "RX" LEDs light up on the module, but the browser reports that it couldn't establish a connection.

Just an update, I believe both Cheater and Hyphenex on IRC have successfully got code working with the adapter from NKC.

I think the code in question was either WizDemo4 and/or WizDemo6 (note, I think the later has changed very recently.)

--Phil.

I've only gotten the first demo to work actually. :wink:

I'm familiarizing myself with the code in order to make a DNS and DHCP library.
Shouldnt take too long and it will make using it significantly easier.

The only tricky bit is to minimize code size.
A echo server is 8kb which is far too big imho.

Just a note to follower since I cant catch him on IRC:

The Wiznet's memory is nonvolatile.
I can still find stuff from your demos in it even after power has been removed and its been reset countless times.

Also DHCP is nearly working.
The problem I have is the packet is getting truncated and the rest of the length is being filled with random stuff from the Wiznet.
I cannot find whats wrong although its not a very small packet (one or two hundred bytes).
Wireshark can parse everything up to the broadcast flag (0x8000 in the Wiznet code) and then the rest is gibberish including stuff like 'w00t>' from your demo.