Ethernet WizNet Wiz810MJ to AVR - collaboration

Go To Last Post
22 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anyone else working to get the Wiz810MJ ethernet interface module to integrate with an AVR? I know of the Arduino effort. However, my use case needs more FLASH and RAM.

At this date, I have gotten a mega128 to control the '810MJ, using fast SPI. With a lot of time spent, the WizNet example for a DHCP client is working. WizNet has a lot of demo software, all based on their eval board with a mega128 that has an added 32KB RAM. However, I'm developing for a target that is less sophisticated, e.g., no external RAM, no LCD, etc.

So pick-and-choose, rearchitecting, etc. is what I am doing, to support DHCP, HTTP server, dynamic HTML, maybe replace AVR bootloader with one based on UDP instead of serial. That done, I can do the actual application I have in mind. The overall scenario is to keep the total cost very low.

So, anyone working in similar tracks?

Last Edited: Mon. Apr 7, 2008 - 12:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm also trying to get a contest entry in, but mine's pretty simple minded stuff. I have the hardware, such as it is, put together, and have done quite a bit of reading in preparation to tackle the software. Unfortunately I'm committed over these next 4 days so it'll be early next week before I get it pingable. Hopefully finished soon after that (he said, sounding like a typical hyper-optimistic programmer).

While it would be wonderful to come up with something that could potentially win one of the prizes, I just shoot for distinctive excellence. That seems within fairly easy reach, gets $100 and a little notoriety, assuages the guilt from getting the freebies, and pretty much guarantees getting more freebies. It gets me off my rear to actually play with the hardware, which is what the sponsors want, so it's a win-win. So mine's more a proof-of-concept approach.

I have written much of the documentation already - if I put it off until after playtime then it's drudgery, otherwise it's part of the focusing process. I'll post it as a project when the contest closes.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i am working in that but as a newbie to both avr and also to Ethernet and with home made boards and stuff i am making very little progress
:oops:

change without any change is no change ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not pursuing the contest.

My status:
1. The example DHCP is working on using a bare mega128, no ext. RAM. This was kind of difficult, as was the SPI interface as I got confused for a while regarding the serial programming I/O bit reassignments versus the user program arrangement for SPI. Also had to get the external interrupt 4 wired up so the '810MJ can tell the AVR when it needs attention.

2. Now I've modified the full suite of code intended for the WizNet eval board - the one with LCD and mega128 w/32K RAM - to run on a bare mega128, no RAM, no LCD. Haven't gotten that to run yet. Work in process. The total is 87KB of code and this includes the demo for DHCP, HTTP, DNS, Telnet, etc.

This is hard-going, as the Wiznet code lacks comments and the documentation, small it be, is oriented around the eval board; they didn't document much for someone trying to adapt to the eval board code for a different target. Fair enough, I guess.

So I'm on this approach rather than trying to reinvent all these apps using only the '810MJ SPI op code commands, alone.

The BASCOM example code for the WizNet via SPI is concise, but one HTTP case only.

That's it for now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey,

Sorry I don't know anything about Wiznet...

But there is a project called uIP that has a very small TCP/IP stack. It could run on some of the smaller AVRs.

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

c_oflynn wrote:
Hey,

Sorry I don't know anything about Wiznet...

But there is a project called uIP that has a very small TCP/IP stack. It could run on some of the smaller AVRs.

-Colin


see
http://www.wiznet.co.kr/products...
Has US distributor and Bay Area sales office.

I wanted a complete TCP/IP stack as a peripheral to the AVR. So the AVR runs TCP or UDP sockets, the NWK layer protocols like DHCP, FTP, HTTP server, TELNET, SNMP and so on. At $18, the '810MJ does so.

Last Edited: Fri. Jan 18, 2008 - 05:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Update on 810MJ integration with mega128 via SPI at 4MHz

I've made a half-dozen or so mods to the WizNet code for their development board as the target. It all now runs on my breadboard which is a bare naked mega128 (16MHz) with NO external RAM. Had to go to smaller I/O buffers. But these demos are working in the rehosting I've done:

Config the '810MJ device via serial port of mega128
socket driver (up to 4 simultaneous sockets)
DNS lookup
a ping client, interactive, like "ping -t yahoo.com"
DHCP client - get from Linksys router
HTTP server with get/post
TCP loopback tests to a TCP program on a PC on the LAN
UDP, same

took a long time to figure all this out. But I'm on top of it now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

stevech wrote:
I've made a half-dozen or so mods to the WizNet code for their development board as the target. It all now runs on my breadboard which is a bare naked mega128 (16MHz) with NO external RAM.

Do you have any plans to release any of your modifications? If so, under what sort of license--if any?

My Arduino-targeted W5100 / WIZ810MJ code is available from a SVN repository with my modifications/additions under a LGPL license.

At present I haven't got as many protocols working as you--I focused on trying to get a higher level interface working for Arduino users.

--Phil.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

c_oflynn wrote:
But there is a project called uIP that has a very small TCP/IP stack. It could run on some of the smaller AVRs.

Early on in my WIZ810MJ/W5100 research I looked into how easy it would be to create a "driver" that would allow uIP to use the W5100 but concluded at the time it wasn't the easiest path for me to get results.

Seems like it would be an interested exercise to do and thus gain the benefit of the existing uIP code out there though.

--Phil.

P.S. Finally now caught up on my avrfreaks reading after focusing on the competition entry... :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

follower wrote:
c_oflynn wrote:
But there is a project called uIP that has a very small TCP/IP stack. It could run on some of the smaller AVRs.

Early on in my WIZ810MJ/W5100 research I looked into how easy it would be to create a "driver" that would allow uIP to use the W5100 but concluded at the time it wasn't the easiest path for me to get results.

Seems like it would be an interested exercise to do and thus gain the benefit of the existing uIP code out there though.

--Phil.

P.S. Finally now caught up on my avrfreaks reading after focusing on the competition entry... :-)

I'm not in the contest. I have done a lot of work with the 810MJ, trying to get it to work at all then work reliably, interfaced via SPI to a mega128. I have learned how to use this chip by coding trial-and-error because the Wiznet documentation is inadequate, the sample code is uncommented and cumbersome to be kind, and there's effectively no tech support.

None the less, I've made good progress - have a web server running, using my own C code (WinAVR). The HTML it sends displays in a browser correctly most of the time, but one in about 20 is wrong. I'm trying to figure out why (using WireShark). My code is all interrupt driven and uses the AVRX RTOS.

I also translated a BASCOM program for the Wiznet in SPI mode to C, as this is non-interrupt and supposedly works well. This is a point of reference - it is super simple, no interrupts, hard-coded for one socket, etc. This is beginning to work.

I'm focused on SPI because I don't want to use all the I/O lines for the interface, nor do I want to use external RAM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Status...
I have the WizNet810MJ connected to a mega128 (see photo), enclosed) as a breadboard. The '810MJ module off-loads all the TCP/IP/ICMP/ARP stack from the AVR. So the AVR application software has a fairly simple socket-type of interface (open/close/listen/read/write).

It took me a long time and a lot of work to get the AVR code working correctly and reliably. The AVR code (a first cut at a web server) runs under the AvrX RTOS. All I/O to the WizNet810MJ is interrupt driven; there are no spinning busy-loops in the AVR. The reason this was all hard to do was that the code samples from WizNet were not interrupt driven, lacked any comments (horrible, classic never-code-this-way), and the module's data sheet was very terse. But I have it working now. I chose to use SPI for the interface, to keep the pin count low. And I chose to not add external memory to the AVR. The '810MJ has 16KB of RAM. This is divided as you please among four sockets, concurrently active, and the Transmit and Receive parts of each. So some sockets might be used for small UDP transactions and others for HTTP. Currently, I have 2KB for transmit and receive on each socket.

Now to get DHCP and DNS working. Not too hard, given the above.

Then interface the AVR to some I/O, like my weather station's serial port. And serve web pages and push data to databases on the web.

The AVR code in flash is 10.6KB now, including 2-3KB of HTML ASCII text in flash. Lots of room for more applications, servers, and HTML code. The AVR code edits the HTML on the fly ("dynamic HTML").

The '810MJ is pretty inexpensive, considering it runs the entire stack.

The photo shows the WizNet810MJ, ETT's mega128 "stamp", an RS232 level converter and a 5V/3.3V DC regulator. The '810MJ isn't on the breadboard because its pins aren't on 0.1 in. centers. The RS232 serial port is for downloading the AVR's code via a bootloader, and for debugging messages, and other uses in the future.

A PCB for this is planned.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, congratulations! Very nice work indeed.

I ended up getting two very simple projects submitted to the contest, and won "distinctive excellence" (honorable mention) on both, but they were a lot simpler than what you've done. Straight TCP, no interrupts, etc. The one thing I did do differently from what your photo shows is find some guy on eBay who sells an inexpensive ISP breakout board for the WIZ810MJ so I didn't have to mess with those odd headers. I've posted my entries as projects.

Being a cheapskate I've hit them (WIZnet) up for another board. It'll be interesting to see if they comply. I think it's a great piece of hardware, notwithstanding your very accurate assessment of the samples and documentation.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder what WizNet has or plans to do regarding updating the firmware on their '5100 chips, i.e., re-flash with newer code. Maybe they plan nothing: if you have bugs, buy a new chip or module?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Chuck for publishing these 2 fun projects for the Wiznet board using the butterfly. The SPI adapter board from nkcelectronics.com is really a steal at $5.00.
I was able to recreate one of Chuck's project using the Butterfly Carrier Board from Ecrostech (also check out the Dragon 500 Rider) and some hard work converting the VB6 app to VB.NET but it works and a great way to start with the Wiznet board.

Steve, are you planning to release the code for your Atmega128 design? I'd be very interested in building your project too. I have a board to use with the Ethernut software but can't rebuild the software into a working state.

Thanks all

jrseattle
oscilloscopeclock.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hai all

There was project like your requirement at
Ben Zijlsta homepage.

Needs only SPI line between WIZnet(810MJ) to AVR.
also He had tutorial about that.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jrseattle wrote:

Steve, are you planning to release the code for your Atmega128 design? I'd be very interested in building your project too. I have a board to use with the Ethernut software but can't rebuild the software into a working state.[/url]

Having all the IP stack off-loaded from the AVR makes it so much easier. As to putting the code in the public domain... maybe. It's well commented (unlike WIZnet's sample code-nada), and pretty well structured, in WinAVR GCC's dialect of C. I need to get the web server more developed. However, the socket I/O routines, interrupt driven under AvrX, seem OK. I think they'll stress test with concurrent use of up to 4 sockets, say, one for HTTPd, one for FTP, one for DNS, etc.

My development board in the photo is on the Internet; PM me if you want the website URL.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Together with JecksonS from Indonesia got a Distinctive Excellence Award for a small board with the WIZ810MJ-module and software written in Bascom-AVR.

A few nice applications like remote reboot, remote camera pan and tilt and remote messages. Checking the Circuit Cellar site every day for the other results.

Have fun
Ben Zijlstra
http://members.home.nl/bzijlstra

BTW The board will be on display on the Embedded Systems Conference at San Jose.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So does one assume no email(?) notification means no Distinctive Excellence and/or other placing?

I would've thought that if they're notifying DE winners they'd at least list them...

--Phil.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

May 18 update

Using the WIZ810MJ module, I built prototype #1, photo early in this tread.
Prototype #2 again uses the WIZ810MJ, plugged into an adapter board from NKC Electronics. That converts the pins to 0.1 inch centers.
The WIZ811MJ module ships in June and has 0.1 inch centers.

Photo enclosed here of prototype #2. Uses a $20 ETT AVR mega128 module. That is plugged into a development motherboard from ETT, $27. Attached is a JTAG board for programming and some debugging, from NKC Electronics, $20 or so. Serial port connected to PC for seeing debug messages. (I may change this to use Telnet).

The software I've done is as follows:

All my own code; the code samples from WizNet were not interrupt driven for SPI and the code was very poorly commented and hard to understand.

Uses AvrX RTOS. Fully interrupt driven; no busy loops. Supports all four socket interfaces on the WizNet modules, with semaphores/queuing for multi-tasking.

HTTP Server: HTML code in AVR's flash. I've implemented a form of Dynamic HTML, where the HTML code can contain keywords like %DATE% %HOUR% %NISTTIME% %MYNAME% %MYIP% and so on for 20 or so keywords at the moment. I'll add keywords for I/O things, like A/D, port bits, and so on. These keywords can be in HTML including forms.

DNS client: Looks up symbolic IP addresses using DNS query and user-defined DNS servers - like a home router does.

NTP client: connects to NIST "DayTime" servers to get the date, time, DST flag, etc. Uses that to set the clock maintained by the AVR's timer.

SMTP client: Application on the mega128 can send an email using one line of C code. Also can trigger an email from the web browser if you know the secret code.

SETUP Web page. Like a home router, the HTTP (web) server sends a form where you fill in the module's IP address, mask, gateway addr, DNS server IP addresses, SMTP server name, POP server name, and so on. These are saved in EEPROM in the AVR.

HTML GET and POST parsers. To implement the above.

So far, this is about 18KB of code in the AVR, including several KB of HTML code. So it doesn't need a mega128. But it would be hard to do all of the above with a smaller RAM.

I don't use an add-on RAM chip for the mega128. Instead, I exploit the 16KB RAM on the Wiz chip and I don't allocate ram until it's needed, e.g., an HTML connection is made, RAM allocated, response sent, then the RAM is released. Also, careful to not put constants in RAM.

---------------

As I talked about above, I'd like to collaborate.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Mr Steve,
It was nice see to your effort with Mega128 and Wiznet IC. We are using this Mega128 in one of our product. To this product we intend to add SNMP compatability. We request your support in completing this assignment for us.
Let me know how do we proceed...

regards,
ravikanth

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ravikanth wrote:
Dear Mr Steve,
It was nice see to your effort with Mega128 and Wiznet IC. We are using this Mega128 in one of our product. To this product we intend to add SNMP compatability. We request your support in completing this assignment for us.
Let me know how do we proceed...

regards,
ravikanth


send your email address to me in a personal message via this forum. My posting here was not to solicit for-profit product development, but we can discuss that in a different venue.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Mr Steve,
It was nice see to your effort with Mega128 and Wiznet IC. We are using this Mega128 in one of our product. To this product we intend to add SNMP compatability. We request your support in completing this assignment for us.
Let me know how do we proceed...