If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

teensy 3 MAC address

After a conversation with Paul, I think I've figured out how to access the unique Ethernet media access (MAC) address burnt into the Teensy3. This number will be different on every teensy 3, and isn't overwritten by the bootloader flashing process like the EEPROM is.

Shortly before releasing Teensy 3.0, PJRC registered for an IEEE OUI usable for Ethernet. Every Teensy 3.0 and 3.1 has been programmed with this OUI and an incrementing 24 bit serial number. It was specifically intended for the Ethernet library with Wiznet chips.

If you use cmason's code, I would recommend disabling interrupts within the read() function. You might also want to declare read() as static, to avoid possible conflicts with such a generic function name possibly being used in any other files.

I have been using the version posted by user THT in post #2. The Teensy3 ID has served perfectly as an Ethernet MAC for the WIZ820io so I can register more that one Teensy3 on my network using Bonjour without having to worry about a conflict.

If need be on the Teensy2 et al that have no S/N, you can use the IEEE 'self administered' MAC address range.
If I recall correctly, its a 0x02 in the MSByte.
With that bit on, you can use any bits you wish and no manufacturer's MAC will conflict.

Shortly before releasing Teensy 3.0, PJRC registered for an IEEE OUI usable for Ethernet. Every Teensy 3.0 and 3.1 has been programmed with this OUI and an incrementing 24 bit serial number. It was specifically intended for the Ethernet library with Wiznet chips.

additional changes

Originally Posted by cmason

After a conversation with Paul, I think I've figured out how to access the unique Ethernet media access (MAC) address burnt into the Teensy3. This number will be different on every teensy 3, and isn't overwritten by the bootloader flashing process like the EEPROM is.

Paul: this unique Ethernet MAC address is absolutely perfect for what I am doing, and solves a gigantic issue for me!
--THANK YOU!--
Now all I need to do is write the CDC EEM code and attach it to my IP stack! You rock!

This is not working with Teensy 3.1. Is it supposed to? I was hoping it would help me with using the SD Card and Wiznet820io which work separately but not together despite trying various CS pins. I will post this on a different thread, none of which have helped me get these working together.

Yes, this works on the Teensy 3.1 as well and Ethernet is one of the reason for the existence of the burned in code. This works perfectly with the WIZ820io. I have not tinkered around with SD card stuff yet, but you'll find many references to SD card related problems on the forum.
It depends often on the specific SD card used.

In file included from T3_readmac.ino:1:0:
C:\Users\A123456\Documents\Arduino\libraries\T3Mac/T3Mac.h:4:21: warning: extra tokens at end of #include directive [enabled by default]
#include <Arduino.h>;
^
In file included from C:\Users\A123456\Documents\Arduino\libraries\T3Mac \T3Mac.cpp:1:0:
C:\Users\A123456\Documents\Arduino\libraries\T3Mac \T3Mac.h:4:21: warning: extra tokens at end of #include directive [enabled by default]
#include <Arduino.h>;

In file included from T3_readmac.ino:1:0:
C:\Users\A123456\Documents\Arduino\libraries\T3Mac/T3Mac.h:4:21: warning: extra tokens at end of #include directive [enabled by default]
#include <Arduino.h>;
^
In file included from C:\Users\A123456\Documents\Arduino\libraries\T3Mac \T3Mac.cpp:1:0:
C:\Users\A123456\Documents\Arduino\libraries\T3Mac \T3Mac.h:4:21: warning: extra tokens at end of #include directive [enabled by default]
#include <Arduino.h>;

this one is too easy!
remove the semicolon at the end of the #include line.
(the compiler suggested that this token is too much)