chipKIT® Development Platform

Inspired by Arduino™

Ethernet Shield

Created Sun, 22 May 2011 23:45:08 +0000 by rmd6502


rmd6502

Sun, 22 May 2011 23:45:08 +0000

I'm working on getting the WebServer example from the Ethernet library working - so far needed to comment out avr/pgmspace.h and include stdint.h in w5100.h. I've just hit the !SS macro in w5100.h, which references PORTB directly. Next step is to cross-reference with the schematic and figure out how the pic32 references the corresponding bits, though I imagine I could change it to a digitalWrite instead.

Has anyone else taken a shot at this? I'll create a fork at my github account, "rmd6502" - anyone who wants to be added as a collaborator shoot me a message!

Thanks, Rob D


Charles

Mon, 23 May 2011 10:03:45 +0000

Very interested in this. I can not offer any help, but can not wait to see a working example!


philtor

Mon, 23 May 2011 20:47:12 +0000

I'm curious, the online specs for the chipKIT Max32 (here: http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,894&Prod=CHIPKIT-MAX32 ) says that it's got the 10/100 Ethernet MAC on board, but then it says that you need an add-on shield to access it. Is this add-on shield available yet? (since most arduino ethernet shields you'd buy now would also include the MAC, I think). where does one acquire this special add-on shield?

...and why didn't they just put the ethernet connector right on the board since it has a MAC?


cobbj

Mon, 23 May 2011 21:49:02 +0000

The PIC32 chip itself has a 10/100 MAC w/ MII/RMII interfaces, but it needs a PHY in order to work. Digilent is working on a shield that will use this and other advanced comms - there is a little discussion in the post on Hack-a-Day here: http://hackaday.com/2011/05/12/chipkit-max32-an-arduino-mega-upgrade-with-a-pic32-under-the-hood/ - June / July timeframe is what Digilent is saying for release.

The Ethernet connector itself is not on the board for a mix of reasons - footpring compatibility / IC's on the board / some other items... but the shield will be coming, and it will be awesome :)


Charles

Tue, 24 May 2011 00:26:04 +0000

The chipKIT Ethernet shield will be released sometime in June. The details I have are: Ethernet PHY and transformer, USB OTG, 32 KHz oscillator, 256 Kbit I2C EEPROM, and 2 CAN interfaces

There will also be a Basic I/O shield released around the same time. Details on it are: 4 switches, 4 buttons, I2Câ„¢ temperature sensor, 256 Kbit I2C EEPROM, 128x32 OLED display, 4 open drain channels, 1 potentiometer, and 8 LEDs


rmd6502

Thu, 26 May 2011 13:53:48 +0000

It's starting to look like the SPI pins on the Arduino don't correspond to the SPI pins on the chipkit - I'll check, perhaps SPI.h does a software "bitbanged" SPI on the corresponding pins?


rmd6502

Sat, 28 May 2011 01:07:43 +0000

I wrote a quick and dirty software SPI that hardcodes mode 0 (CPOL=0, CPHA=0, MSB). That seems to work, though I haven't tested with an actual ethernet cable yet. [url]git://github.com/rmd6502/chipKIT32-MAX.git[/url]


rmd6502

Sat, 28 May 2011 02:27:23 +0000

Yup! Example sketch works, though I have to hit the reset button first. I'll investigate then issue the pull request.


hobbified

Mon, 30 May 2011 06:23:10 +0000

If I wanted to play with the onboard etherMAC without waiting for a shield to come out, is there some recommended PHY that I could wire up without a lot of hassle? Preferably without surface-mount soldering, but I get the feeling that means buying someone's "demo board" that costs more than the whole rest of the system...


jamodio

Mon, 30 May 2011 15:18:42 +0000

I'm planning to put together a design for an Ethernet shield using Microchip's ENC424J600 controller, planning to drop in there a serial FLASH for the HTTP server, both using the PIC32MX SPI interface, and may be other stuff.

I'll probably include a digital temperature sensor that seems to be a popular thing for beginners.

I'm open for suggestions/comments about what else to include in the shield.

Cheers


jamodio

Mon, 30 May 2011 15:35:21 +0000

If I wanted to play with the onboard etherMAC without waiting for a shield to come out, is there some recommended PHY that I could wire up without a lot of hassle? Preferably without surface-mount soldering, but I get the feeling that means buying someone's "demo board" that costs more than the whole rest of the system...

The PIC32MX795 does not include the PHY for the Ethernet interface, you will need to add an external PHY chip such as the DP83848C used on the PIC32MX Ethernet starter kit, which uses the MII, I'm still in the process of digesting the chipKIT schematics but I remember seeing most of the required signals on the J8 header.

There are other PHY chips, but all of them are surface mount parts.

My .02


GeneApperson

Wed, 01 Jun 2011 22:57:12 +0000

If I wanted to play with the onboard etherMAC without waiting for a shield to come out, is there some recommended PHY that I could wire up without a lot of hassle? Preferably without surface-mount soldering, but I get the feeling that means buying someone's "demo board" that costs more than the whole rest of the system...

Unless you want to write your own TCP/IP stack, you will want to use a PHY that is supported by the Microchip Applications Library. I know that they support SMSC LAN8700 and the SMSC LAN8720 (the part that is on the forthcoming Network Shield). They support at least one other PHY, but I don't remember the part number.

However, the MII or RMII interfaces involve 25Mhz or 50Mhz signaling and I suspect it would be challenging to get it to work using point-to-point wiring.

Gene Apperson Digilent


Addidis

Fri, 03 Jun 2011 20:11:04 +0000

What about one of those cheep 1$ accelerometers (HAD POV post a few weeks back)


voyager

Tue, 07 Jun 2011 17:51:05 +0000

@ rmd6502

Hi could you share the tested sketch with me and pass over a zip file? It is difficult for me to access the github as i am newbie with a mac.

Thanks for your help.


prune

Wed, 15 Jun 2011 13:39:08 +0000

Any news from the Ethernet native shield for ChipKit ? Any delivery date ? I need to order soon... :)


stafil

Sat, 18 Jun 2011 17:56:51 +0000

Why is ethernet library can not be compiled?

error: chipkit max32

In file included from ...\mpide-0022-chipkit-win-20110530.\hardware\pic32\libraries\Ethernet/Ethernet.h:6:0, from WebServer.cpp:19: ...\mpide-0022-chipkit-win-20110530.\hardware\pic32\libraries\Ethernet/Client.h:6:30: error: expected class-name before '{' token WebServer.cpp: In function 'void loop()': WebServer.cpp:56:18: error: 'class Client' has no member named 'println' WebServer.cpp:57:18: error: 'class Client' has no member named 'println' WebServer.cpp:58:18: error: 'class Client' has no member named 'println' WebServer.cpp:62:20: error: 'class Client' has no member named 'print' WebServer.cpp:63:20: error: 'class Client' has no member named 'print' WebServer.cpp:64:20: error: 'class Client' has no member named 'print' WebServer.cpp:65:20: error: 'class Client' has no member named 'print' WebServer.cpp:66:20: error: 'class Client' has no member named 'println'


klbegeberg

Mon, 20 Jun 2011 09:50:48 +0000

Can anyone confirm, if the Arduino Ethernet shield, based upon Wiznet W5100 is compatible or not?

To me it seem not compatible, as all examples under Ethernet cannot be compiled.


matt.nelson

Fri, 24 Jun 2011 16:23:27 +0000

Any status updates on a compatible ethernet shied for the Max32?


Jacob Christ

Fri, 24 Jun 2011 18:27:34 +0000

It's starting to look like the SPI pins on the Arduino don't correspond to the SPI pins on the chipkit - I'll check, perhaps SPI.h does a software "bitbanged" SPI on the corresponding pins?

When I checked, the SPI pins seemed to match up.

The SPI lib is not bit banged, but it is c and not c++.

Jacob


GeneApperson

Mon, 27 Jun 2011 15:12:54 +0000

Any status updates on a compatible ethernet shied for the Max32?

The hardware is complete. We have about 20 preproduction boards on hand and are expecting to have the first production build this week. The problem is the software. It's taking longer to get library support done than we had anticipated.

Gene Apperson Digilent


prune

Mon, 27 Jun 2011 16:25:53 +0000

Thanks for the information. Let us know when everything's ready... you'll get new customers :)


chip_developer

Wed, 29 Jun 2011 10:33:52 +0000

Hi Everyone ... can someone help me to fix Ethernet library to compile Arduino Ide sketches without class-name error please?

I've the w5100 chip mounted on Arduino ethernet shield ..

ERRORS RECEIVED:

In file included from WebServer.cpp:1:0: /Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/libraries/Ethernet/Client.h:6:30: error: expected class-name before '{' token WebServer.cpp: In function 'void loop()': WebServer.cpp:60:18: error: 'class Client' has no member named 'println' WebServer.cpp:61:18: error: 'class Client' has no member named 'println' WebServer.cpp:62:18: error: 'class Client' has no member named 'println' WebServer.cpp:66:20: error: 'class Client' has no member named 'print' WebServer.cpp:67:20: error: 'class Client' has no member named 'print' WebServer.cpp:68:20: error: 'class Client' has no member named 'print' WebServer.cpp:69:20: error: 'class Client' has no member named 'print' WebServer.cpp:70:20: error: 'class Client' has no member named 'println'

i've used WebServer.cpp example and have already imported ethernet library:

#include <Client.h> #include <Ethernet.h> #include <Server.h> #include <Udp.h>


rftech

Wed, 29 Jun 2011 20:30:15 +0000

Gene,

Will you be releasing the hardware once its built or are you going to wait for librarys to be complete?

Also since the network shield is said to bring out the can bus access, are you developing a can library also to take advantage of this?

Thanks in advance.


GeneApperson

Thu, 30 Jun 2011 18:22:09 +0000

Gene, Will you be releasing the hardware once its built or are you going to wait for librarys to be complete? Also since the network shield is said to bring out the can bus access, are you developing a can library also to take advantage of this? Thanks in advance.

The option of releasing the hardware without the libraries is under discussion. The general opinion is to not do so. As of today, the only way to use the Network Shield would be via MPLAB and the Microchip Application Libraries. The biggest problem with releasing the hardware now with the library support not done would be to make sure that customers understand what they are getting and to not create a lot of ill-will by having people buy it and then not being able to make it work.

The current plan is that we are porting the existing ethernet library, adding a USB device and USB host library, and adding a basic CAN library. This is taking longer than I had originally planned for. I thought that they would be done by the end of June.

Gene


Albrektson

Tue, 12 Jul 2011 10:55:07 +0000

Any news? :)


Andy123

Sun, 17 Jul 2011 17:06:23 +0000

Did somebody find a solution on how to native compile code for W5100 arduino shield with Max32?

I think compiler errors have something to do with an attempt to redefine "print_h" class

Any ideas?


eicss

Mon, 18 Jul 2011 10:35:45 +0000

I'm designing an Ethernet-only shield. The GERBERs and BoM should be available by end July for entusiasts who my want to get it done on their own!


PapyEt

Fri, 12 Aug 2011 16:14:58 +0000

The hardware is complete. We have about 20 preproduction boards on hand and are expecting to have the first production build this week. The problem is the software. It's taking longer to get library support done than we had anticipated. Gene Apperson Digilent

Can you provide a quick description of this hardware, Thanks


GeneApperson

Sat, 20 Aug 2011 16:49:53 +0000

Several people have expressed interest in knowing when the Network Shield for use with the Max32 will be available. The hardware is now available for sale on the Digilent web site.

I apologize for how long this has taken, but I dramatically underestimated the amount work needed to get the library support done.

We're wrapping up the final details for the first library release on Monday. This first release will have support for Ethernet client and server, USB device, and CAN. The ethernet library adds support for DHCP and DNS, which aren't in the Arduino library. Planned for the next release will be adding UDP support for ethernet and USB host support, plus (probably) improvements to the CAN support, and improvements to the documentation.

I should know better than to give projected dates, but I am optimistically thinking that ths release will be in about three weeks.

Gene Apperson Digilent


kronicd

Sun, 21 Aug 2011 07:28:11 +0000

Gene,

I see that the network shield is now available for purchase and the reference manual says the ethernet & can libraries are available.

However the ethernet library still does not compile and I am unable to locate the CAN library at all. Are the libraries for this and possibly sample code available?

EDIT: Oh wow, I did not see how recent your post was. I'll wait till Monday :) Can't wait to see the work!

EDIT TWO: So I just saw mpide-0022-windows-20110821-test drop a few minutes ago. I have tested it and can confirm ethernet & SPI seem to be working now (at least for compiling). I'll have to wait for my ethernet shield to arrive to confirm it works on the device itself. Looking forward to it!

EDIT THREE: Still can't see any CAN Bus stuff in the libraries, we shall see how it goes on Monday though.


GeneApperson

Sun, 21 Aug 2011 16:31:41 +0000

The Ethernet library in the MPIDE release is for the Uno32 and the regular Arduino Ethernet shield that uses the WizNet chip. We got this working on the Uno32 (although it requires a small hardware mod to either the Uno32 or the shield) We haven't been able to get it to work on the Max32 yet.

The libraries that support the Network Shield are completely new libraries. These libraries will only be available from the Digilent web site as they contain code licensed from Microchip that isn't open source. We're planning on doing completely open source libraries, but that is a much bigger project.

The new Ethernet library is functionally compatible with the current Ethernet library (with some improvements) We've been able to get all of the Ethernet examples to build and run with the new library.

The USB and CAN libraries are additions to the Arduino system, and so aren't compatible with any existing libraries. The hope is to get some feedback on the interfaces, possibly improve them a bit, and then work toward clean, completely open source versions.

I've had a hiccup with the CAN library. It turn out it wasn't as done as I thought. I received the deliverable from the person working on it Saturday morning. What he did was good, but isn't really an Arduino style library. I'm working all weekend to convert what I got into a proper library. If I can't get it done by the end of the day today, we'll release the Ethernet and USB tomorrow and follow up with CAN in a couple of days.

Gene Apperson Digilent


Andy123

Sun, 21 Aug 2011 21:47:27 +0000

it requires a small hardware mod to either the Uno32 or the shield)

Can you provide more details please?


GeneApperson

Mon, 22 Aug 2011 04:33:19 +0000

The 2x3 connector on the right side of the board on the Arduino boards is an Atmel ISP connector. Because the AVR in-system-programming protocol uses SPI with the CPU held in reset, this connector has three of the SPI signals plus reset.

The Ethernet shield picks up those three SPI signals from this connector. It also ties the reset from this connector together with the reset on the power connector.

When I designed the Uno32 and Max32, I thought it would be more useful in the long run for this connector to be a full SPI connector, so I put the SPI slave select pin where reset is on an Arduino board. It didn't occur to me that some shield would tie both reset pins together.

So, right now, every time the sketch tries to bring Slave select low to start to send something to the shield, it resets the processor. Oops. If I'd been smarter, I would have put a jumper on the Uno32 and Max32 to disconnect this. But I didn't.

So, the mod is to cut reset somewhere. You can cut the trace on the Uno32, cut the pin from the connector on the Uno32, cut the pin on the Ethernet shield. I think if you cut the trace on the shield near the power connector that works also. Unfortunately, we couldn't find a schematic for the particular version of the shield we have to verify that. We cut the pin from the shield on our board.

The other problem is that there are at least five different versions of the ethernet shield out, and I only know for sure how to mod the one we have.

Gene Apperson Digilent


Andy123

Mon, 22 Aug 2011 12:00:00 +0000

Thanks Gene,

Another potential hardware issue related to the V5 Ethernet shield may be with SD card signals. There are resistors to go from 5V to 3.3V, but since chipkit is 3.3V already it may lower signals below minimums.


hobbified

Mon, 22 Aug 2011 13:27:17 +0000

Does the library for the Network Shield support an interrupt-driven mode of operation? Specifically, I want to be able to register a callback function that gets called on packet recv, instead of having to poll for packets in an idle loop. Latency makes a big difference.


GeneApperson

Mon, 22 Aug 2011 19:55:14 +0000

There are resistors to go from 5V to 3.3V, but since chipkit is 3.3V already it may lower signals below minimums.

Andy123, Assuming that the inputs on the SD card are typical high impedance CMOS inputs, the resistors won't affect the voltage at the pin, but will affect the rise time of the edges. The impedance of the input is so high that minimal current flows in and the drop across the reistor is negligable.

When the voltage at the pin is higher than the VCC of the chip (or in this case SD card), there will be current flow through the input protection diodes into the chip power supply. The resistors are to limit this current to a safe level.

The resistor in combination with the stray capacitance of the connection and the pin capacitance of the pin forms a low pass filter that slows the rise and fall times at the pin.

Since I haven't been able to find a schematic, this explanation could be complete nonsense. If they have an actual voltage divider at the inputs, then the voltage will be reduced.

Gene


Andy123

Mon, 22 Aug 2011 20:20:17 +0000

Gene

these are not series resistors, they have dividers [attachment=0]enet.jpg[/attachment] So it will drop the voltage to 2.2V and may affect timing

Actually Ethernet shield schematics (version 5) is here: http://arduino.cc/en/uploads/Main/arduino-ethernet-shield-05-schematic.pdf

I think there is another version with PoE, but this is the most common shield with micro SD


GeneApperson

Mon, 22 Aug 2011 22:54:00 +0000

You're right. Those are voltage dividers that will reduce the voltage. The SD cards probably won't work.

Gene


Andy123

Tue, 23 Aug 2011 00:10:14 +0000

I think it will be absolutely harmless to cut Reset line at the Ethernet Shield Since "reset" uses "power" header connection also. You can cut in any place along this line


GeneApperson

Tue, 23 Aug 2011 07:14:38 +0000

According to Tony at NKC, some early Arduino boards didn't have the reset signal at the power connector and only had it at the ICSP connector. I agree that on any newer board, the cut should be benign.

Thanks, Gene


Andy123

Tue, 23 Aug 2011 10:48:28 +0000

In any case, on V5 board I made a cut as shown by second arrow using a small drill bit.

I was able to complie few Ethernet samples and load them to MAX32. I can't say they wirk, but I was able to ping board with no SD card present Adding SD card kills ping.


GeneApperson

Thu, 25 Aug 2011 03:34:24 +0000

Does the library for the Network Shield support an interrupt-driven mode of operation? Specifically, I want to be able to register a callback function that gets called on packet recv, instead of having to poll for packets in an idle loop. Latency makes a big difference.

Sorry it took me a couple of days to get back to you. I've been travelling. I asked the guy who wrote the library, and he says that it doesn't support interrupt operation. It requires polling. He's not sure, but he doesn't think that the underlying Microchip stack exposes anything that would allow us to do it.

Gene Apperson Digilent


Andy123

Sat, 27 Aug 2011 01:08:15 +0000

Gene: Are you expectling to get standard Arduino Ethernet Shield working with MAX32?

It compiles now with the latest published Ethernet libraries but I can only get very unstable ping working (shield v5). None of the examples work. I don't have Uno32 to test.

I suspect this has something to do with SPI libraries. One thing needs to be changed for sure is SPI divider - I can clearly see 10MHz clock signal (DIV8) that is very fast for Wiznet chip. I tried to slow it down without any results. Other thing I already mentioned is SD card - with card inserted signals looking very bad (on the oscilloscope) - I think it is clear - SD slot is out at least until hardware changes done.


kmansfie

Sat, 27 Aug 2011 16:43:01 +0000

Andy123,

I have been trying to get my Ethernet Shield (V5) to work with the Uno32 also. I haven't had any success at all. I have been looking at the network using wireshark and it looks like I'm getting an IP address of 0.0.0.0 with a mac address of 0 from the Wiznet chip even though I set the IP address to 192.168.0.17 in the Webserver example. It seems to me that I'm not talking to the Wiznet chip properly thus not getting the IP and MAC address set in.

I just thought I would chime in and let you know that you are not alone in your troubles.

Kim


GeneApperson

Sun, 28 Aug 2011 01:17:51 +0000

Scott Hanson at Digilent was able to run some of the Ethernet demos on an Uno32, after cutting the reset pin from the shield. He had to fix some things in the library to get it to work. His corrected version of the library should be in the last release.

He was never able to get it to work with the Max32. He scoped the SPI pins at the WizNet chip and the signals looked good, but something else was apparently going wrong.

I'm in Phoenix right now, wrapping up my attendance at Microchip Masters. Il'll be back in the office on Monday. I'll ask Scott to come on line and work with you to get you up and running.

We would definitely like to get both the Uno32 and the Max32 working with the Arduino Ethernet shield.

Gene


GeneApperson

Sun, 28 Aug 2011 01:31:18 +0000

@andy123

I was going to suggest that you might be able to get the SD cards working by pulling the low side resistors on the dividers. However, from the piece of the schematic that you posted, it looks like it's a resistor pack, so you can't pull individual resistors.

Gene


Andy123

Sun, 28 Aug 2011 01:43:44 +0000

Gene,

At this point I am not really worry about SD, I want to get Ethernet going first

My plan was to remove 2k2 resistor pack completely using hot air and replace one of them with regular 0402 or 0603 resistor

As for Ethernet, I did cut reset trace and I can get an ocasional ping -t with MAX32: after 10-15 failed attempts I can get 10-15 pings in a row, but after that it dies. I am using UDPNTPclient example, that doen not work at all... Without Uno32 I can say if it works.

I did scope traces too - all looking good. At this point I am pretty sure initial SPI handshaking is the issue and this cauases Wiznet chip not to initialize correctly. Too bad there is no debugger...

If Scott wants he can contact me directly.


GeneApperson

Sun, 28 Aug 2011 01:51:40 +0000

I'll have Scott contact you. It will be great if you tow can figure out what the problem is.

Gene


Andy123

Sat, 03 Sep 2011 23:27:03 +0000

It looks like Ethernet libraries for standard Arduino W5100 shield are working now. I was waiting for Scott to post solution here since he found the issue, but to save time I will post it ;)

There is a problem with SPI Mode definition for Chipkit Also SPI divider 8 is too fast for w5100 chip

For now there is a temporary workaround: In \hardware\pic32\libraries\Ethernet\utility\w5100.cpp replace:

SPI.setClockDivider(SPI_CLOCK_DIV8);
SPI.setDataMode(SPI_MODE0);

with

SPI.setClockDivider(SPI_CLOCK_DIV32); // 2.5MHz SPI clock
SPI.setDataMode(SPI_MODE1);

In future releases SPI mode definitions will be corrected to match Arduino. The same workaround may help people having SPI issues with other shields.


Raf

Mon, 05 Sep 2011 21:24:40 +0000

I'm testing the Arduino Ethernet Shield with the Chipkit Uno but I cannot make it work even though I made the modification on the shield as described in this post. When I try to ping the Arduino, I get no answer. Is there an easy way to check that the shield is properly interfaced to the Chipkit board?


Andy123

Mon, 05 Sep 2011 22:21:09 +0000

Here is a full procedure to get Arduino Ethernet v5 shield working

All this must be done:

  • cut reset trace on the shield as Gene and I described few posts above
  • remove SD card - not supported - MUST remove
  • set JP5,JP7(Uno32) or JP3, JP4 (MAX32) for Master
  • UNO32 only: set JP4 to the left RD4 position
  • use current IDE and libraries (rev 110822 at the time of this post)
  • make changes in \hardware\pic32\libraries\Ethernet\utility\w5100.cpp SPI.setClockDivider(SPI_CLOCK_DIV32); // 2.5MHz SPI clock SPI.setDataMode(SPI_MODE1); [color=#BF4000]This line is not needed for build 20110907 or higher[/color]
  • in the sketch set IP address to match your local subnet Again I tested it with MAX32 only, I don't have Uno32, but I am told it works with Uno32 after these changes

**Edit Sept 08:**it appears newer build 20110907 corrected SPI mode issue Starting with build 20110907 correct should be SPI.setDataMode(SPI_MODE0);


fez56

Mon, 05 Sep 2011 23:26:38 +0000

Ethernet Shield 05 tested on UNO32 after cutting trace, checking/setting jumpers, updating library and W5100.CPP.

Now working!


Andy123

Mon, 05 Sep 2011 23:37:11 +0000

[Edit Sept 6] I am told that JP4 on UNO32 must be to the left position. This does not match the manual. Not sure why and I can't confirm it.


davervw

Tue, 06 Sep 2011 13:23:53 +0000

Now that 20110822 is out, I see the following changes in w5100.cpp

/*Updated  August/3/2011 by Lowell Scott Hanson to be compatable with chipKIT boards */
  SPI.setClockDivider(SPI_CLOCK_DIV8); //Sets the spi clock rate to around 10Mhz(divide by 4 will work but not recommended due to signal integraty issues) -LSH
  SPI.setDataMode(SPI_MODE0);			//Defines spi to operate in mode 0 -LSH

but I cannot get my custom shield (techwithdave * blogspot * com) to work with either W5100's CS connected to pin 10 or SS on the SPI connector.

Has the procedures changed with 20110822?


Andy123

Tue, 06 Sep 2011 13:38:12 +0000

Please make changes I described above - all these changes provided by Scott Hanson after release 20110822.


davervw

Tue, 06 Sep 2011 16:07:51 +0000

Okay, I've made the following changes in mpide-0022-windows-20110822\hardware\pic32\libraries\Ethernet\utility\w5100.cpp:

SPI.setClockDivider(SPI_CLOCK_DIV32);
  SPI.setDataMode(SPI_MODE1);

As I don't have a real Ethernet Shield, but a proven W5100 SPI module I built myself (see techwithdave * blogspot * com), I wire the SPI and power lines as follows.

  • W5100 GROUND to J13-6 GROUND
  • W5100 SCLK to J13-3 SCK
  • W5100 MISO to J13-1 MISO
  • W5100 MOSI to J13-4 MOSI
  • W5100 CS to J13-5 SS
  • W5100 RESET left unconnected
  • W5100 INTERRUPT left unconnected
  • W5100 3V3 to Max32 3V3

JP3 and JP4 are set to MASTER

No joy with this setup (trying Arduino's Telnet Client example). Anything obvious that I missed here?


Andy123

Tue, 06 Sep 2011 16:20:26 +0000

CS signal needs to go to J3-5 (RD4)


davervw

Tue, 06 Sep 2011 17:16:22 +0000

I've tried W5100 CS connected to either SS and/or the digital pin labeled 10, without success.


Raf

Tue, 06 Sep 2011 19:31:21 +0000

Andy123, you made my day, it's working fine thaanks to your help! The solution was to change the position of the jumper. I agree with you, it's not in line with what is written in the documentation, but at the end, it works!


Andy123

Tue, 06 Sep 2011 20:00:47 +0000

davervw:

may be connect rest to the main reset line or at least add pull up resistors for reset and INT. It definately needs to be RD4 for CS line

============ Now when we got running Arduino Ethernet shield I really want to test build-in Ethernet with external PHY. Too bad Ethernet Shield has too many extra components that inflated the price as result. And there is no way to solder PHY chip that small by hand.... Can someone point to a cheap PHY breakouts board?


davervw

Tue, 06 Sep 2011 20:32:36 +0000

Andy- The W5100 has pullups inside it for RESET, and INT is an output so can float. I was originally tying the RESET to the Max32, and all that gave me was resetting both the CPU and W5100 at the same time.

(and offtopic) I've used schmartboards for [mostly] successfuly soldering the 80-pin 0.5mm pitch PIC32MX795F512H broken out to four 8x2 headers. I recently got a couple PHYs, and plan to do similar, and wire up with the CPU, PHY, and Ethernet all on separate breakout boards. It's really ugly wiring, but it might just get the job done for prototyping.

I had broken down and gotten the chipKit Max32 and Network Shield because it's not ugly and the provided C++ support.


Andy123

Wed, 07 Sep 2011 00:26:42 +0000

davervw:

There are two W5100.cpp files

Make sure you are changing file in \hardware\pic32\libraries\Ethernet\utility\

If this still does not work, then ZIP email me me all folders under \hardware\pic32\libraries\ so I can compare to mine

Also may be add pull up to CS, RD and WR signals - there is a pull up on v5 board


davervw

Wed, 07 Sep 2011 15:14:55 +0000

Andy - missing pullups sound like a good theory. I have been sloppy with some of my circuits, doing just the bare minimum, so I may have gotten caught here. I will try adding pullups. Thanks!


Andy123

Thu, 08 Sep 2011 11:43:58 +0000

it appears that newer build 20110907 corrected SPI mode issue As a result the SPI.setDataMode(SPI_MODE1); change is not necessary anymore. It should be SPI.setDataMode(SPI_MODE0);

I tested it can confirm that DIV32 still necessary


Andy123

Sat, 10 Sep 2011 15:38:44 +0000

Going back to SD card support with Arduino Ethernet Shield V5. As mentioned earlier, SD card signals on this shield are going via resistor dividers and SD will not work as a result Depending on your goals there are few way to correct it. If you want to use this shield with Chipkit only, then you can remove 2.2K resistor network and shorten two pads on the left (closer to W5100 chip) to remove resistor network without destoroying it you may need to use hot air or fine tip iron. I tested this configuration with sample SD libraries.

If you are planning to use SD card with 5V Arduino as well, then the correct way is to replace 1K resistor networks with CD4050 buffer. SO16 package can be installed in the empty area and air wired to the network pins and/or vias


fez56

Thu, 15 Sep 2011 22:16:17 +0000

Going back to SD card support with Arduino Ethernet Shield V5. As mentioned earlier, SD card signals on this shield are going via resistor dividers and SD will not work as a result Depending on your goals there are few way to correct it. If you want to use this shield with Chipkit only, then you can remove 2.2K resistor network and shorten two pads on the left (closer to W5100 chip) to remove resistor network without destoroying it you may need to use hot air or fine tip iron. I tested this configuration with sample SD libraries. If you are planning to use SD card with 5V Arduino as well, then the correct way is to replace 1K resistor networks with CD4050 buffer. SO16 package can be installed in the empty area and air wired to the network pins and/or vias

I will mod my Arduino Ethernet Shield for UNO32 only to get the SD card working, but I have a question:

  • What is a good technique to remove RN6? All I have is a fine-tip iron.

After RN6 is out, you meant short pads 1 and 8 (numbering goes counterclockwise, with pad 1 at the lower left).

But, instead of removing RN6 (222 on top (2.2k)), I will probably cut the three component-side GND traces off of RN6 pads 2, 3 and 4. Then I will connect 3.3V to RN5 (102 on top (1k)) pad 1. That seems like it might be easier than trying to remove RN6.

Finally, looking at the Shield_Eth05_p.brd file in Eagle, the component side GND connections are not shown on RN6 pads 2, 3 and 4 in the file I am looking at. I wonder why? I am referring to the gridded ground plane areas. The connections are clearly on the board itself.

Thanks, Tom


Andy123

Thu, 15 Sep 2011 23:33:34 +0000

Let me start with removal: I have hot air rework station and this makes life much easier - it takes few seconds to remove any multi-pin device. Do what ever you think is easier for you, you can cut trace or simly shorten three 1K resistors instead

You can also use VIAs and pads to solder jumpers. I removed 2.2K resistors because I want to be able to put then back and use shield with Arduino.

After RN6 is out, you meant short pads 1 and 8 (numbering goes counterclockwise, with pad 1 at the lower left).

Correct

To see ground pins you need to click Ratsnest button, this will show ground planes I also changed plane from Hatch to Solid to see it better - see below

[attachment=0]sd.JPG[/attachment]


Andy123

Sat, 17 Sep 2011 14:29:17 +0000

Switching gears a little:

Test build 20110907 fails to compile Chipkit Network Shield Ethernet libraries All 3 examples failed

Build 20110822 compiles and works just fine


Raf

Tue, 20 Sep 2011 19:30:58 +0000

Just to say that the SD card is working fine with the version 6 of the Arduino Ethernet Shield since the network of resistance has been replaced by some kind of drivers: http://arduino.cc/en/uploads/Main/arduino-ethernet-shield-06-schematic.pdf


Andy123

Wed, 21 Sep 2011 01:05:53 +0000

I did not know V6 was available (and have no intentions to get it), but they finally made it right using buffers Just not sure why they put two in parallel...

I will tru to replace resistors on mine with buffers also so I can have universal shield


manut

Mon, 12 Dec 2011 12:51:07 +0000

Hello, I have a v6 Ethernet shield which I am trying to use with my UNO32 board (reset pin cutted on the UNO32 board). I'd like to port the ladyada webserver example : This example browses a Sd card (FAT 16 formatted) and lists (and displays, I hope) the text files in a browser. It works quite well except that I cannot read a file from the sd card when the client is working. One funny thing is that I can read a file in the setup() but I cannot in the loop(). I thought there was an issue with the chip select between the w5100 and the sd card, but, in fact, it isn't.

Here is my code :

///*
// * This sketch uses the microSD card slot on the Arduino Ethernet shield to server
// * up files over a very minimal browsing interface
// * 
// * Some code is from Bill Greiman's SdFatLib examples, some is from the Arduino Ethernet
// * WebServer example and the rest is from Limor Fried (Adafruit) so its probably under GPL

// Position des jumpers de la carte Chipkit UNO32 :
// - JP4 sur "RD4"
// - JP5 et JP7 sur "MASTER"
// - JP6 sur "RG3"
// - JP8 sur "RG2"
// - JP2 sur "REG"
// 
// Attention : la broche 5 de J8 doit être coupée :
// sinon, la platine Ethernet empêche le fonctionnement du bus SPI (broche SS2/RG9 tirée à l'état haut)

#include &lt;Ethernet.h&gt;
#include &lt;SPI.h&gt;
#include &lt;SD.h&gt;

/************ ETHERNET ************/
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 60 };
Server server(80);

///************ SDCARD ************/
Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;
File myFile;

// store error strings in flash to save RAM
#define error(s) error_P(/*PSTR*/(char*)(s))

void error_P(const char* str) {
  //PgmPrint("error: ");
  Serial.println("error: ");
  //SerialPrintln_P(str);
  Serial.println(str);
  if (card.errorCode()) {
    //PgmPrint("SD error: ");
    Serial.print("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.print(',');
    Serial.println(card.errorData(), HEX);
  }
  while(1);
}

void setup()
{
  Serial.begin(9600);

  Serial.println("Chipkit UNO32 Ethernet webserver");
  
  Serial.println("Initialisation de la carte SD...");
  // Sur la carte Ethernet, la broche de sélection CS est la broche 4. Elle est définie comme sortie par défaut.
  // Même si la broche SS n'est pas utilisée en tant que broche de sélection CS
  // (broche 10), elle doit être laissée comme sortie
  // sinon la bibliothèque SD ne fonctionnera pas.
  pinMode(10, OUTPUT);                       // set the SS pin as an output (necessary!)
  digitalWrite(10, HIGH);                    // but turn off the W5100 chip!
  
  pinMode(4, OUTPUT);                       // CS SD en sortie
  
  if (!card.init(SPI_HALF_SPEED, 4)) error("card.init failed!");
  
  SPI.setClockDivider(SPI_CLOCK_DIV32);  // is it necessary?
  SPI.setDataMode(SPI_MODE1);           // is it necessary?
  
  // initialize a FAT volume
  if (!volume.init(&amp;card)) error("vol.init failed!");

  Serial.print("Volume is FAT");
  Serial.println(volume.fatType(),DEC);
  Serial.println();
  
  if (!root.openRoot(&amp;volume)) error("openRoot failed");  
  
  // list file in root with date and size
  Serial.println("Files found in root:");
  root.ls(LS_DATE | LS_SIZE);
  Serial.println();
  
  // Recursive list of all directories
  Serial.println("Files found in all dirs:");
  root.ls(LS_R);
  
  Serial.println();
  Serial.println("Done");

          if (! file.open(&amp;root, "FICHIER1.TXT", FILE_READ))
          {
            Serial.println("erreur d'ouverture de fichier.");
            return;  
          }        
          Serial.println("Opened!");
          int c;
          c = file.read();
          while(c &gt; 0)
          {
            Serial.write(c);
            c = file.read();
          }
          file.close();
  
  // Debugging complete, we start the server!
  Ethernet.begin(mac, ip);
  server.begin();
}

void ListFiles(Client client, uint8_t flags) {
  // This code is just copied from SdFile.cpp in the SDFat library
  // and tweaked to print to the client output in html!
  dir_t p;
  
  root.rewind();
  client.println("&lt;ul&gt;");
  while (root.readDir(p) &gt; 0) {
    // done if past last used entry
    if (p.name[0] == DIR_NAME_FREE) break;

    // skip deleted entry and entries for . and  ..
    if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.') continue;

    // only list subdirectories and files
    if (!DIR_IS_FILE_OR_SUBDIR(&amp;p)) continue;

    // print any indent spaces
    client.print("&lt;li&gt;&lt;a href=\"");
    for (uint8_t i = 0; i &lt; 11; i++) {
      if (p.name[i] == ' ') continue;
      if (i == 8) {
        client.print('.');
      }
      client.print(p.name[i]);
    }
    client.print("\"&gt;");
    
    // print file name with possible blank fill
    for (uint8_t i = 0; i &lt; 11; i++) {
      if (p.name[i] == ' ') continue;
      if (i == 8) {
        client.print('.');
      }
      client.print(p.name[i]);
    }
    
    client.print("&lt;/a&gt;");
    
    if (DIR_IS_SUBDIR(&amp;p)) {
      client.print('/');
    }

    // print modify date/time if requested
    if (flags &amp; LS_DATE) {
       root.printFatDate(p.lastWriteDate);
       client.print(' ');
       root.printFatTime(p.lastWriteTime);
    }
    // print size if requested
    if (!DIR_IS_SUBDIR(&amp;p) &amp;&amp; (flags &amp; LS_SIZE)) {
      client.print(' ');
      client.print(p.fileSize);
    }
    client.println("&lt;/li&gt;");
  }
  client.println("&lt;/ul&gt;");
}

// How big our line buffer should be. 100 is plenty!
#define BUFSIZ 100

void loop()
{
  char clientline[BUFSIZ];
  int index = 0;
  
  Client client = server.available();
  if (client)
  {    
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    
    // reset the input buffer
    index = 0;
    
    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        
        // If it isn't a new line, add the character to the buffer
        if (c != '\n' &amp;&amp; c != '\r')
        {
          clientline[index] = c;
          index++;
          // are we too big for the buffer? start tossing out data
          if (index &gt;= BUFSIZ) 
            index = BUFSIZ -1;
          
          // continue to read more data!
          continue;
        }
        
        // got a \n or \r new line, which means the string is done
        clientline[index] = 0;
        
        // Print it out for debugging
        Serial.println(clientline);
        
        // Look for substring such as a request to get the root file
        if (strstr(clientline, "GET / ") != 0)
        {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          // print all the files, use a helper to keep it clean
          client.println("&lt;h2&gt;Files:&lt;/h2&gt;");
          ListFiles(client, LS_SIZE);
        }
        else if (strstr(clientline, "GET /") != 0)
        {
          // this time no space after the /, so a sub-file!
          char *filename;
          
          filename = clientline + 5; // look after the "GET /" (5 chars)
          // a little trick, look for the " HTTP/1.1" string and 
          // turn the first character of the substring into a 0 to clear it out.
          (strstr(clientline, " HTTP"))[0] = 0;
          
          // print the file we want
          Serial.println(filename);
          
          digitalWrite(10, HIGH);  // CS W5100
          digitalWrite(4, LOW);    // CS SD
          char ret = file.open(&amp;root, filename, FILE_READ);
          digitalWrite(4, HIGH);    // CS SD
          digitalWrite(10, LOW);  // CS W5100

          if (!ret)
          {
            client.println("HTTP/1.1 404 Not Found");
            client.println("Content-Type: text/html");
            client.println();
            client.println("&lt;h2&gt;File Not Found!&lt;/h2&gt;");
            break;
          }        
          Serial.println("Opened!");

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/plain");
          client.println();
       
          int cnt = 0;
          int c;
          digitalWrite(10, HIGH);  // CS W5100
          digitalWrite(4, LOW);    // CS SD
          c = file.read();
          digitalWrite(4, HIGH);    // CS SD
          digitalWrite(10, LOW);    // CS W5100
          while ( c &gt; 0)
          {
              client.print((char)c);
              digitalWrite(10, HIGH);  // CS W5100
              digitalWrite(4, LOW);    // CS SD
              c = file.read();
              // uncomment the serial to debug (slow!)
              Serial.write(c);
              digitalWrite(4, HIGH);    // CS SD
              digitalWrite(10, LOW);    // CS W5100
              
              cnt++;
          }
          Serial.println();
          Serial.print("Nombre de caracteres lus : ");
          Serial.print(cnt);
          Serial.println();
          file.close();
          Serial.println("Fin de fichier");            
        }
        else
        {
          // everything else is a 404
          client.println("HTTP/1.1 404 Not Found");
          client.println("Content-Type: text/html");
          client.println();
          client.println("&lt;h2&gt;File Not Found!&lt;/h2&gt;");
        }
        Serial.println("break");
        break;
      }
    }
    // give the web browser time to receive the data
    delay(1);
    client.stop();
  }
}

I don't know why but when I mix Sd and Ethernet libraries the Sd is failing. Does anybody tries to use both libraries at the same time? Thank you for your help


ghostface

Tue, 10 Jan 2012 09:57:56 +0000

Hello everyone!!!

Can anyone help me with the following issue?? I have an ARDUINO ETHERNET SHIELD with SD slot and a CHIP KIT UNO 32. I want to use them together if it's possible!

What kind of modifications (hardware and software) are needed in order to make this two boards work together????

If anyone know about the modifications please send me some details about them!!

I appreciate any kind of help or advice!!!

Thank very much in advance!!!

Yours sincerely, BOGDAN.


adamj12b

Fri, 06 Apr 2012 13:57:38 +0000

Hello Everyone,

Im hoping somebody can point me in the right direction.

Im trying to use the MAX32 with the Rev6 Arduino Ethernet shield and have not had any luck yet.

I have cut the reset trace and still nothing.

I am running compiler version 20111221 on my MAC and windows just to make sure.

I have checked the SPI settings to make sure everything was correct and they are.

I have connected the hardware SS pin 53 to the ethernet CS line to make sure thats not the issue either.

I cannot ping the board.

I there something else I have to do to make this work??

-Adam


martinayotte

Wed, 21 Nov 2012 16:19:26 +0000

I've just placed an order on Ebay for a clone of Arduino Ethernet Shield, it is supposed to be a V5, but according to the picture, it look different. I will check when I will receive it if resitors dividers are simply replace by single resistors.

Update : I've receive the shield today, unfortunately, it isn't like the picture, it is a regular v5 ... I guess I will have to do the trick explained in this thread.

Another Update : I've done the reset cut, and I've ran successfully both WebServer and SD CardInfo example without having to hack the resistor dividers. Probably the voltages are still in the proper range. I used a Lexar uSD 8GB.


thinkpeace

Fri, 21 Feb 2014 06:10:20 +0000

Has the Ethernet Shield been tested on the WF32?


thinkpeace

Wed, 05 Mar 2014 02:02:33 +0000

I tested the Ethernet shield R3 with the WF32, and it works OK.

I'm not sure that it would work at the same time as WiFi, but I only need to use one or the other.

To get it to work I did the following 2 things:

1. cut the reset line on the Ethernet R3 near the ISCP connector. 2. added the following lines to the w5100.h located in C:\Program Files(x86)\MPIDE\hardware\pic32\libraries\Ethernet\utility

#elif defined (_BOARD_WF32_)
	inline static void initSS()  { TRISDbits.TRISD4 =  0; };
  inline static void setSS()     { LATDbits.LATD4	=  0; };
  inline static void resetSS()   { LATDbits.LATD4	=  1; };

I added these lines just below the following lines

#elif defined (_BOARD_MEGA_)  //chipKIT definitions for SS pin
	inline static void initSS()  { TRISDbits.TRISD4 =  0; };
  inline static void setSS()     { LATDbits.LATD4	=  0; };
  inline static void resetSS()   { LATDbits.LATD4	=  1; };

The webserver example worked just fine.


davemaster

Sun, 29 Jun 2014 16:54:41 +0000

I tested the Ethernet shield R3 with the WF32, and it works OK. I'm not sure that it would work at the same time as WiFi, but I only need to use one or the other. To get it to work I did the following 2 things: **1. cut the reset line on the Ethernet R3 near the ISCP connector.

  1. added the following lines to the w5100.h located in C:\Program Files**(x86)\MPIDE\hardware\pic32\libraries\Ethernet\utility
#elif defined (_BOARD_WF32_)
inline static void initSS()  { TRISDbits.TRISD4 =  0; };
inline static void setSS()     { LATDbits.LATD4	=  0; };
inline static void resetSS()   { LATDbits.LATD4	=  1; };

I added these lines just below the following lines

#elif defined (_BOARD_MEGA_)  //chipKIT definitions for SS pin
inline static void initSS()  { TRISDbits.TRISD4 =  0; };
inline static void setSS()     { LATDbits.LATD4	=  0; };
inline static void resetSS()   { LATDbits.LATD4	=  1; };

The webserver example worked just fine.

Can you please show your ping connections?

Thanks in advance Best regards.