Skip to main content
Associate II
July 19, 2026
Question

STMU5 best UID to MAC hashing/compression methods

  • July 19, 2026
  • 2 replies
  • 35 views

I’d like to create a mac address using the STM32U5’s 96-bit UID. 
since first byte I’ll use as constant, i need 40 bits to create a unique mac for my devices.
i wonder what’s the best way to create a mac with the least change of collision.
if i use 32 bit wafer coordinates, and 8 bit wafer number for example, how likely am i to get a collision, opposed to other methods?
thank you

2 replies

MClar.3
Associate II
July 19, 2026

This all depends on how many things you are creating and what you are doing with them. 

If it’s just a personal project for use on your own network, then I’d guess you’ve got better chances of winning the lottery than getting a collision from a randomly generated number.

If it’s something you need to be able to connect to another network, Atmel sell some EEPROMs with pre-programmed unique MAC addresses - Look here.

If you’re building a large number of things, you probably need to buy a block from the IEEE - Look here.

danyavinAuthor
Associate II
July 23, 2026

thank you for the replay. its for a device my company already started manufacturing. the devices will sit on our own local network using a switch, with a few devices per network. for now I’ve implemented the MAC from the wafer number and X-Y coordinates.
you think the chances of collision are slim enough, or would you recommend working with the RNG?
 

MClar.3
Associate II
July 23, 2026

Was typing out a reply, and found something way better!

There are things called locally administered addresses - The MAC equivalent of private IP ranges.

There are four huge blocks available:

x2:xx:xx:xx:xx:xx, x6:xx:xx:xx:xx:xx, xa:xx:xx:xx:xx:xx, and xe:xx:xx:xx:xx:xx

I’d break this down into a smaller more manageable block, so you could have a prefix like 02:de:ad:be:ef: and then 256 addresses under this, so 02:de:ad:be:ef:00 to 02:de:ad:be:ef:ff 

Or, if you’ve got wafer coordinates, use a smaller prefix, and a 16 bit number for x-y, so 02:00:xx:xx:yy:yy.

Same caveat applies, though, they shouldn’t be placed anywhere outside your own network.