Multiple Netduinos within one local Network
#1
Posted 23 November 2012 - 07:45 AM
#2
Posted 23 November 2012 - 08:11 AM
NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and down - and upload files
If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#3
Posted 23 November 2012 - 08:24 AM
#4
Posted 23 November 2012 - 09:28 AM
#5
Posted 23 November 2012 - 09:58 AM
NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and down - and upload files
If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#6
Posted 23 November 2012 - 11:16 AM
#7
Posted 23 November 2012 - 01:25 PM
NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and down - and upload files
If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#8
Posted 24 November 2012 - 12:46 PM
#9
Posted 24 November 2012 - 01:04 PM
Are you working with sockets?
Probably you could post some code? How do you receive the data at the netduinos? Do you keep the sockets open or do you close them sometimes?
I'm also not sure if UDP is supported by netduinos, only worked with TCP/IP.
Greets, Markus
Netduino Plus do support the UDP: I used it without problems, both client and listener.
Cheers
#10
Posted 24 November 2012 - 04:05 PM
This could be because the two netduinos end up having the same MAC address, how is the MAC address set on a netduino, do they come with different MAC addresses from the factory, and if so, where is it stored?
I would like to know the above for the NP2 as well?
- Ulrik
I have a NP2 and cannot set the MAC address, so maybe the OP does indeed have two with same address on LAN. My unit does have an address printed on the back, and MFDeploy does in fact show that address (even without my having explicitly setting it), however my DHCP server clearly shows the request from 00:04:a3:00:00:00 which a Microchip address, presumably a factory default for the ENC28J60.
For now I'm motoring on with my project, but this will have to be fixed at some point...
#11
Posted 24 November 2012 - 06:42 PM
Each board comes with a unique MAC address from the factory. We then attach a removable sticker with this address to the back of the board.This could be because the two netduinos end up having the same MAC address, how is the MAC address set on a netduino, do they come with different MAC addresses from the factory, and if so, where is it stored?
I would like to know the above for the NP2 as well?
Both Netduino Plus 1 and Netduino Plus 2 store the MAC address and IP settings in the NETMF Config flash sector on the MCU.
You can change this value in code or using MFDeploy's Network Configuration options.
Chris
#12
Posted 24 November 2012 - 06:45 PM
This is a glitch in the ENC28J60 driver implementation. We were made aware of this shortly after launch and are working on a firmware update which will address the issue. The ENC28J60 chip should be getting its MAC address from the configuration flash sector.I have a NP2 and cannot set the MAC address, so maybe the OP does indeed have two with same address on LAN. My unit does have an address printed on the back, and MFDeploy does in fact show that address (even without my having explicitly setting it), however my DHCP server clearly shows the request from 00:04:a3:00:00:00 which a Microchip address, presumably a factory default for the ENC28J60.
For now I'm motoring on with my project, but this will have to be fixed at some point...
In the meantime, have you tried setting your MAC address in code?
http://msdn.microsof...y/cc532879.aspx
This won't be necessary for the vast majority of users, and the firmware update should fix the issue for the rest...but in the meantime this should hopefully provide a workaround.
Chris
#13
Posted 24 November 2012 - 11:19 PM
This is a glitch in the ENC28J60 driver implementation. We were made aware of this shortly after launch and are working on a firmware update which will address the issue. The ENC28J60 chip should be getting its MAC address from the configuration flash sector.
Is it possible to read the configuration flash sector from managed code ?
In the meantime, have you tried setting your MAC address in code?
http://msdn.microsof...y/cc532879.aspx
This won't be necessary for the vast majority of users, and the firmware update should fix the issue for the rest...but in the meantime this should hopefully provide a workaround.
No, but if you have two Netduinos on the same physical ethernet segment, none of them will work if they have the same MAC address, and you will have to use the function Chris has linked to, to set the MAC address to different values on each Netduino.
If you don't understand what a physical ethernet segment is, just think of it as a you network.
There is no problem having a lot of netduinos with the same MAC address talk to each other over then internet, as long as they are not on the same physical network.
- Ulrik
#14
Posted 25 November 2012 - 05:08 PM
...
This is a glitch in the ENC28J60 driver implementation....
...
In the meantime, have you tried setting your MAC address in code?
http://msdn.microsof...y/cc532879.aspx
...
Interesting. OK, I did try several things. Basically it's doesn't work in general, but it was still interesting. I'll show you my test code for what it's worth:
public static void Main() { NetworkInterface[] ani = NetworkInterface.GetAllNetworkInterfaces(); foreach ( NetworkInterface ni in ani ) { string strIPorig = ni.IPAddress; byte[] abyMACorig = ni.PhysicalAddress; ni.ReleaseDhcpLease(); string strIPrel = ni.IPAddress; byte[] abyMACset = new byte[] { 0x5c, 0x86, 0x4a, 0x01, 0x23, 0x45 }; //<== I changed last three for this post ni.PhysicalAddress = abyMACset; ni.RenewDhcpLease(); byte[] abyMACnew = ni.PhysicalAddress; string strIPnew = ni.IPAddress; } }
OK, some things:
* network intialization and dhcp has happened before Main, so it's mostly too late to change MAC via application code
* after PhysicalAddress setter, pinging fails to netduino as one might expect
* as you can see I attempted to work around by doing explicit DHCP release/renew around the change. These calls stimulate no actual DHCP activity, alas.
* the PhysicalAddress set action does persist across reboot, however. E.g., upon exist of this program, if I re-run it in the debugger, I have the new MAC address. and DHCP serves up the expected IP I reserved for this experiment.
* upon powercycling, though, this is lost, so it's not that interesting
* I guess if there was a was for the app to detect that it is a cold boot, set the address, do a warm boot, and then detect it is a warm boot and continue running, then that would be a possible work-around.
I would fix the firmware myself, but it is not clear to me how to build it, and I couldn't find anything interesting in the source I downloaded so I probably don't have the full package. I was somewhat expecting the Microchip code for the ENC28J60 somewhere, but couldn't find that either. Obviously I an assuming you are using that code at all, but I think the address is set in StackTsk.h in their code.
Anyway, I can carry on with other aspects of the project for now; I won't require two boards on the same network yet, but eventually I will.
-dave
#15
Posted 28 November 2012 - 05:55 AM
Sorry was ill the last days.
Here some code:
System.Net.Sockets.Socket LVSocket = null; System.Net.IPEndPoint LVEndpoint = null; System.Net.Sockets.Socket uCSocket = null; System.Net.IPEndPoint uCEndpoint = null; // Path of the init File at the Sd Card System.String Path = @"\SD\Config_INIT.txt"; // DEFAULT values if SD Card is not found or not inserted // SETTINGS for Netduino #1 System.String LabViewIP = "192.168.1.20"; System.Int32 NetworkPort = 49001; System.String NetduinoIP = "192.168.001.21"; // SETTINGS for Netduino #2 // System.String LabViewIP = "192.168.1.20"; // System.Int32 NetworkPort = 49002; // System.String NetduinoIP = "192.168.001.22";
The program checks for an config file at the SD Card (works fine)
If no SD Card detected it will continue with:
System.Net.IPAddress IPLabview = System.Net.IPAddress.Parse(LabViewIP); System.Net.IPAddress IPNetduino = System.Net.IPAddress.Parse(NetduinoIP); Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP(NetduinoIP, "255.255.255.0", "192.168.0.0"); if (uCEndpoint == null) { uCSocket = UDPConnector.RecieveSocket(uCSocket); uCEndpoint = UDPConnector.RecievePoint(uCSocket, uCEndpoint, IPNetduino, NetworkPort); } if (LVSocket == null) { LVSocket = UDPConnector.SendSocket(LVSocket); LVEndpoint = UDPConnector.SendPoint(LVSocket, LVEndpoint, IPLabview, NetworkPort); } byte[] Recieved = UDPConnector.getMessage(uCSocket);
BTW I´m using CAT5 cables
#16
Posted 30 November 2012 - 09:15 AM
#17
Posted 04 December 2012 - 01:20 AM
#18
Posted 04 December 2012 - 11:43 AM
#19
Posted 05 December 2012 - 08:06 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users