We created 100 custom PCB around the samd21.

Custom pcb

And I'd like to generate some unique IP/Mac addresses from the Serial number of the samd21.

In the datasheet they say the following

Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses: Word 0: 0x0080A00C Word 1: 0x0080A040 Word 2: 0x0080A044 Word 3: 0x0080A048 The uniqueness of the serial number is guaranteed only when using all 128 bits.

And when I use the teensy 3.2 I use the following library: https://github.com/FrankBoesing/TeensyMAC

Any idea on how to achieve something like that ?


You can use a random MAC address, either with a fixed OUI or a completely random address. There’s online tools for generating them, search ‘random MAC address generator’.

(Maybe not relevant for you, but note that both iOS and Android have moved to using random MAC addresses to thwart tracking of their phones on networks. That’s a different topic.)

If you want your own OUI (vendor ID) you can obtain one from the IEEE for a nominal fee. (Looks like TeensyMAC assigns one so they have you covered there. Use that when you generate the random one with the online tool.)

The IP address is usually handed out by a DHCP server on your network, it’s not pre-assigned in the device. This means you should be implementing a DHCP client so the device can ask for one. TeensyMAC has nothing to do with that, except you need to have an assigned MAC address before you can make a DHCP request so the server can respond to you.

If you don’t want to do DHCP, and instead want to have a fixed IP, then you will need to provide a serial port or some other method to set it when installing the device onto a network. That’s because you don’t get to choose the net/subnet/mask, that’s determined by whoever owns the network. And, IP addresses are not guaranteed to be unique except at the local LAN subnet level.

  • \$\begingroup\$ Thanks for your answer. I actually use a specific protocol (ArtNet) which is bond to the network so that why I need a static IP. Also, my devices are the only ones on the network. \$\endgroup\$ – xavier.seignard Aug 15 '19 at 20:41
  • \$\begingroup\$ It’s a DMX bridge then, right? I still think you should use DHCP, and identify what universe(s) the bridge is dealing with in a different way, say, by assigning a device name (hostname) that you can bind to your universe list. My background is set-top boxes and this is how we dealt with the issue. \$\endgroup\$ – hacktastical Aug 15 '19 at 21:07
  • \$\begingroup\$ Yeah, kindof. But there's no DHCP servers on the network. For the universes, you can setup which board internal universes corresponds to which controller universes; I use a software (MadMapper) or a lighting console as a controller. \$\endgroup\$ – xavier.seignard Aug 15 '19 at 21:23
  • 1
    \$\begingroup\$ That said, I’m kind of interested in DMX, and a way to improve it. \$\endgroup\$ – hacktastical Aug 15 '19 at 21:25
  • \$\begingroup\$ Well ArtNet 4 and sACN are nice improvements, and I feel RDM is pretty useless. \$\endgroup\$ – xavier.seignard Aug 15 '19 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.