Can you give me a nice solution for the problem below, please ?
At present, I’m working with 3 spider cards, each card has a special functionality, but they have the same sensor equipments: every 30s, these cards will make reading and sending the sensor values to the server via webservice.
I have one question, how to get the identificator of these card in order to differentiate the values of 3 identique sensors wired on 3 different spider cards ?
At this moment, I have manually created an identificator for them, but it’s not a “pro” solution if we work with 50 or 100 cards.
Do you mean something like a serial no?
You could use EWR (ExtendenWeakReference) to write some data directly to the module Flash.
But this data will be deleted, every time you reflash the firmware.
You could add a SD card or Flash module, and store the data there, by this it’s persistent for sure.
How does your “manually created idetificator” look like?
Maybe the serial number can solve my problem, but how to get it by means of .NETMF?
[em]“You could use EWR (ExtendenWeakReference) to write some data directly to the module Flash”[/em] It is clearly better than my method, and I should take attention it after flashing the firmware. But it is not yet a expected “pro” solution. (srry for my exigency !)
In fact, my method for creating manually indentificator is to use the xml file stored in SD card, one xml file for each spider card.
A special method is used for listing insert_SD card event in order to read and save this Id in memory card. But it is not a generic solution because of clumsy user or developer error.
Thanks again your rapid response.
Is there a gadgeteer module by which i can get an identificator or serie number or anthor things ? for example, can ethernet_J11D provide a MAC address ?
Thanks a lot. Using ExtendenWeakReference is a better solution at the moment (thanks Reinhard OstermeierHero for it), i think. If someone can propose another solution, i’m really interested.
Thanks a lot your code. I have just one question, perhaps I don’t understand your code yet.
In the function,
GenerateUniqueMacAddr(object myUniqueId = null),
you said that the string “myUniqueId must to be UNIQUE” and "This would be great if only each board had a UNIQUE SERIAL NUmber ahhhhhh… ". This word UNIQUE means the “UNIQUE SERIAL NUmber” of each board ( if that’s right … i think i’m turning in round… ) ? In the case of “myUniqueId = null”,
var r = new Random();
r.NextBytes(myMac);
could you please give me a double check that your code could generate unique (different) MAC addresses for 100 boards ?
The spider has a unique Mac address each EMX module comes with a sticker that shows the unique Mac address…
As for the cerb family board they all have a unique serial number in the processor.
you can also apply and buy a block of Mac addresses specific to your company… not sure about the minimum number of boards allowed…
Another thing you can try is create your unique string based on the combination of date and time…
Then start each board at different times for example one or few seconds apart, which will create a unique string that you would store in the extended weak memory…
Using my code with the above will guarantee you a unique string per board… using the same code