The Netherlands
Offline
Jr. Member
Karma: 0
Posts: 56
Arduino rocks
|
 |
« on: November 29, 2009, 09:24:55 am » |
As you might know the Ethernet shield comes without a MAC address. You start the Ethernet library with furnishing your own MAC and it's your responsibility to make sure that this MAC address is unique in your network.
Unfortunately if you have more than one Arduino in your network, this means that you need to make a dedicated sketch. Or I should say: you need to alter your sketch for every upload.
I am looking for a way to make this configurable from the outside. The first idea would be to use some pins and hardwire those to +5v or GND creating an binary 'address' for the last byte of the MAC and IP. This would be possible if one had enough pins.
However my current project involves an Ethernet shield (which is not that strange given the question) using pins 10 through 13. Then an LCD is mounted that uses pin 4 through 9 and analog 0. My application uses pin 3 and analog 1 through 5. Leaving only pin 2 (as 0 and 1 are RX/TX and it is not a good idea to hardwire those) which gives not much configuration power...
Are there any thoughts on other options? Are there pins I am forgetting? Is there a technique I am forgetting? Please not that anything that does something with randomisation is not an option (as it would neither guarantee uniqueness nor make it manageble). And while on the subject... why does the Wiznet chip not carry it's own MAC? Would make live so much simpler...
|
|
|
|
|
Logged
|
|
|
|
|
London
Offline
Faraday Member
Karma: 6
Posts: 6226
Have fun!
|
 |
« Reply #1 on: November 29, 2009, 09:34:33 am » |
You could store the mac address in EEPROM. The address can be set from the serial port, and once set, your setup code could check that a valid mac address was available and use it to init the Ethernet library.
|
|
|
|
« Last Edit: November 29, 2009, 09:35:00 am by mem »
|
Logged
|
|
|
|
|
The Netherlands
Offline
Jr. Member
Karma: 0
Posts: 56
Arduino rocks
|
 |
« Reply #2 on: November 29, 2009, 09:55:00 am » |
That is an interesting thought... what I did not yet mention is that the setting of the address must be quite simple, so I can let field engineers do it. Creating some sort of dialog via the Serial would be feasible I'd say. Thanks. Open to other options of course, so enlighten me!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 29
Arduino rocks
|
 |
« Reply #3 on: December 01, 2009, 10:40:56 pm » |
Could you do it like a wireless router setup, where there's a default MAC and IP, you connect to that IP via a web browser, where you edit the values in a form, and then those values get saved to EEPROM and take effect when you reset?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Faraday Member
Karma: 6
Posts: 2504
|
 |
« Reply #4 on: December 01, 2009, 10:55:44 pm » |
+1 for EEPROM.
You could also add a small I2C flash IC, and store the MAC address (and IP, default router, etc, etc) there. Make it a DIP package and the node's identity would be in the flash chip, which could be programmed separately.
-j
|
|
|
|
|
Logged
|
|
|
|
|
The Netherlands
Offline
Jr. Member
Karma: 0
Posts: 56
Arduino rocks
|
 |
« Reply #5 on: December 02, 2009, 05:10:42 am » |
Are the I2C pins not hardwired to other pins (digital/analog)?
|
|
|
|
|
Logged
|
|
|
|
|
London
Offline
Faraday Member
Karma: 6
Posts: 6226
Have fun!
|
 |
« Reply #6 on: December 02, 2009, 06:00:55 am » |
the i2c pins are available when using the Ethernet shield. They are analog pins 4 and 5 (digital pins 18 and 19)
|
|
|
|
« Last Edit: December 02, 2009, 06:01:16 am by mem »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 53
Arduino rocks
|
 |
« Reply #7 on: December 03, 2009, 10:49:54 am » |
You could use a analogue Pin and fit a pd, and by changing the resistor values you would get a new ADC value which could be used to change a section of the mac/ip address. This is a hard wire option if that helps?
I would only read it once at startup, as you dont want voltage changes to affect the operation!
Pete
|
|
|
|
|
Logged
|
|
|
|
|
|