Skip to content

MAC address #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sstaub opened this issue Mar 31, 2018 · 2 comments
Closed

MAC address #9

sstaub opened this issue Mar 31, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@sstaub
Copy link
Contributor

sstaub commented Mar 31, 2018

The build in mac address should used. Following function can used, based on mbed-os/stm32xx_emac.c

`
void stmMAC(uint8_t *mac) {
// Read unic id
#if defined (STM32F2)
uint32_t baseUID = *(uint32_t *)0x1FFF7A10;
#elif defined (STM32F4)
uint32_t baseUID = *(uint32_t *)0x1FFF7A10;
#elif defined (STM32F7)
uint32_t baseUID = *(uint32_t *)0x1FF0F420;
#else
#error MAC address can not be derived from target unique Id
#endif

mac[0] = 0x00;
mac[1] = 0x80;
mac[2] = 0xE1;
mac[3] = (baseUID & 0x00FF0000) >> 16;
mac[4] = (baseUID & 0x0000FF00) >> 8;
mac[5] = (baseUID & 0x000000FF);
return;
}
`

@fpistm fpistm added the enhancement New feature or request label Mar 31, 2018
@fpistm
Copy link
Member

fpistm commented Mar 31, 2018

Hi @sstaub ,
good idea.
Do not hesitate to submit a PR for that or any other contributor ;)

@sstaub
Copy link
Contributor Author

sstaub commented Jun 1, 2018

I did make a PR #11

@sstaub sstaub closed this as completed Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants