Main Site Documentation

Wiznet5100 lack of factory MAC address = limitation of Fez to hobbyist implementations?


#1

Where’s the MAC?

The WizNet 5100 chips on the Arduino-format shields as well as FEZ Connect are shipped without MAC address, and WizNet’s policy is to sell without MAC with real repercussions for those trying to use them in products as discussed here: http://bbs.circuitcellar.com/phpbb/viewtopic.php?f=30&t=3532

This presents a commercial problem. GHI is leading the way in .Net Micro commercialization and support. However it’s not possible to deploy a product of any volume which uses Ethernet on GHI because of the WizNet. If building even 100 units for sale, it’s not realistic to manually assign the MAC in code as the examples show.

Is there a way around this problem? I’d like to build a platform around the USBizi but I need ethernet with TCP/IP and http support. UDP is not essential.

Thanks in advance for any suggestions. The Netduino with Atmel ATSAM 7X512 comes with 1 MAC Address and uses the lwIP Open Source IP stack (http://en.wikipedia.org/wiki/LwIP) which is also what is used on the Analog Devices Blackfin series chips. This would appear to have advantages. But GHI is so well thought out, there must be a reason for the decision to go wit hteh Wiznet. So what am I missing?

Thanks in advance.


#2

Simply call GHI with your volume order and ask them to include mac addresses with your order.

On small devices with no external memory, using wiznet gives you much more free resources for your application than using lwip. Basically, it is a better option at the same cost.

Finally, reliability for commercial use is ghi’s top priority. This will make your product stand out.


#3

Depends on your volume, of course. Gus’s suggestion is one way - and probably the easiest.

You can also buy 4096 address blocks from IEEE instead:
http://standards.ieee.org/regauth/registry_IAB.html

And there are companies like Microchip that sell EEPROMs with a valid MAC address inside (25AA02E48), so, if you are planning to add EEPROMs to your own design, you can add an EEPROM as well and read out the MAC during initialisation.


#4

I’ve never been sure that the EUI-48 address in those microchip devices were from an approved IEEE unique MAC address pool.

The reason Wiznet don’t provide MAC addresses is purely to reduce the cost. Yes it has the impact of pushing the emphasis back to the end-user for MAC address compliance/collision avoidance. If a lot of these devices are used in “hobby” devices (as a lot must be, in microcontroller scenarios, given the proliferation of arduino shields using them), then there really isn’t a commercial impact to Wiznet, it’s just money saved and the minimal hassle to the end user is that they have to remember to set up a different MAC if they ever had two devices on the network.


#5

Thanks everyone for the thoughtful responses. It does appears GHI is the market leader in .Net, I’d like to use the USBizi chipset on my board. Gus you may remember we’ve spoken a few times. I flew to Seattle for the weekend to work with a friend moving our code from the Digi Connect ME .net over to the Domino wih external WizNet 5100 on an Arduino shield. I did the pin jumper debug switch bypass, no big deal there though we later realized we could do that in code if we got that right.

We are having issues getting the ethernet to work at all. It won’t do ethernet.enable, or WIZnet_W5100.Enable(); The shield I have is a DFRobot Arduino, pretty standard. I think bought it from you directly in the version 3.5 timeframe.

We want to set up the device for DHCP, or a static IP, and if we have to manually assign the MAC that’s no problem. We just need it to have connectivity so we can try to get some work done today.

If we do if(!Ethernet.IsEnabled) to enable the ethernet we get a “system.notsupported” exception. A number of things below are commented out, but this gives an idea what we are trying to do.

using System;
using System.IO.Ports;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Net;
using GHIElectronics.NETMF.Net.Sockets;
using GHIElectronics.NETMF.Net.NetworkInformation;

namespace FezDominoReader
{
    public class Program
    {
        

        public static void Main()
        {
        
            try
            {
                WIZnet_W5100.Enable(SPI.SPI_module.SPI1, Cpu.Pin.GPIO_Pin10, Cpu.Pin.GPIO_Pin9, true);
                if(!Ethernet.IsEnabled)
                {
                    Ethernet.Enable();
                }

                
                byte[] mac = NetworkInterface.PhysicalAddress;
                byte[] mac = { 0x00, 0x26, 0x1C, 0x7B, 0x29,0xE8 };
                //byte[] ip = { 192, 168, 0, 180 };
                //byte[] subnet = { 255, 255, 255, 0 };
                //byte[] gateway = { 192, 168, 0, 1 };
                //NetworkInterface.EnableStaticIP(ip, subnet, gateway, mac);
                //byte[] dns = { 192, 168, 0, 1 };
                //NetworkInterface.EnableStaticDns(dns);

                Dhcp.EnableDhcp(mac, "192.168.0.1");
                string testReq = RequestWebPage(@ "www.yahoo.com", 80, "", "");
                Debug.Print(testReq);
                while(true)
                {
                    Thread.Sleep(500);
                }
            }
            finally
            {
            }
        }

        static Socket ConnectSocket(String server, Int32 port)
        {
            // Get server's IP address.
            IPHostEntry hostEntry = Dns.GetHostEntry(server);
            // Create socket and connect to the server's IP address and port
            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Connect(new IPEndPoint(hostEntry.AddressList[0], port));
            return socket;
        }

        static string RequestWebPage(String server, int port, string pageUrl, string content)
        {
            const Int32 c_microsecondsPerSecond = 1000000;
            // Create a socket connection to the specified server and port.
            using(Socket serverSocket = ConnectSocket(server, port))
            {
                string request = "POST " + pageUrl + " HTTP/1.1\r\n" +
                    "Host: " + server + "\r\nConnection: Close\r\n" +
                    "Content-Type: application/x-www-form-urlencoded\r\n" +
                    "Content-Length: " + content.Length.ToString() + "\r\n\r\n" +
                    content + "\r\n";
                Byte[] bytesToSend = Encoding.UTF8.GetBytes(request);
                serverSocket.Send(bytesToSend, bytesToSend.Length, 0);

                // Allocate a buffer that we'll keep reusing to receive HTML chunks
                Byte[] buffer = new Byte[1024];
                // 'page' refers to the HTML data as it is built up.
                String page = String.Empty;
                // Poll for data until 30 second time out - Returns true for data and connection closed
                while(serverSocket.Poll(30 * c_microsecondsPerSecond, SelectMode.SelectRead))
                {
                    // Read a buffer-sized HTML chunk
                    Int32 bytesRead = serverSocket.Receive(buffer);
                    // If 0 bytes in buffer, then connection is closed
                    if(bytesRead == 0)
                        break;

                    // Append the chunk to the string
                    byte[] justDataBytes = buffer;
                    if(bytesRead != buffer.Length)
                    {
                        justDataBytes = new byte[bytesRead];
                        Array.Copy(buffer, justDataBytes, bytesRead);
                    }
                    page += new string(Encoding.UTF8.GetChars(justDataBytes));
                }
                return page; // Return the complete string
            }
        }
    }
}

/Joe: I fixed the mac address


#6

Please keep new questions in new posts so we can help you better. Also, please “code tag” your code so it is readable. I will modify your post.

Wiznet support only provide what is in GHI’s w5100 dll, which doesn’t include this fucntion. I do not think wiznet chip has it and so GHI have no way of exposing this method.


#7

one workaround to that that has been discussed before is to use the link LED signal and connect that to a digital IO pin, that way when a cable gets connected you can find out (if you use an interrupt capable pin, you can be told).