how to change MAC address in MCF52259

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to change MAC address in MCF52259

715 Views
davidslapo
Contributor I

I have gone through most of the files and libraries in code warrior 10.xxx and I can not find a function that will allow me to  change the default device MAC address. Has anyone done this?

Labels (1)
0 Kudos
3 Replies

446 Views
TomE
Specialist II

I don't think the MAC is the compiler's problem.

From the hardware's point of view, the MAC is whatever the software loads into PALR and PAUR.

That is usually handled by the Platform Driver in conjunction with the Ethernet Driver.


Which depends on whatever you're using as an Operating System. Are you using MQX?

The MAC has to be different for each device manufactured, and historically this has been achieved with an EEPROM of some sort. With later chips like the i.MX series, there are "fuses" in the CPU itself that are burned as part of product manufacture with a unique MAC. The MCF52259 has internal FLASH, so the MAC would normally be assigned by the whatever software it in charge of your "production line" and it probably burns the MAC as part of the Bootstrap or Application code.

The problem of getting from the "Example Code" provided by CW to being "Production Ready" is always difficult.

Maybe you should ask this question (or move this thread if you can do that) to a Forum specific to CW or your OS.

Search all the code you're using for "PALR" and "PAUR" as well if you need to reverse-engineer it.

Tom

0 Kudos

446 Views
davidslapo
Contributor I

Tom as far as I know we are using MQX.

I will look into where it gets loaded.

Thank you Tom for your reply.

Dave Slapo

0 Kudos

446 Views
TomE
Specialist II

You should search the MQX forum with keywords like "change default MAC". I found this which might get you started:

https://community.freescale.com/message/347143#347143

It is common, at least in Linux setups to have a separate Bootstrap responsible for getting a unique MAC (from somewhere, either from EEPROM, a FLASH partition or burned in as part of the Boot). The Bootstrap can support network operations (it can load the kernel from TFTP for instance) so it initialises the Ethernet hardware and loads the MAC into it.

When the OS Kernel starts, the Ethernet driver reads the MAC back out of the Ethernet Controller, assuming that the boot has already programmed it.

MQX may do that, or may have a configuration option to do that. Even if it doesn't, it may assume that some of your code has done that. Or it may assume that something has already initialised a global with the MAC, or provided a function to get this information.

Some devices generate the MAC from a separately stored Serial Number, although there are reasons why this isn't a good idea.

You'll have to find what MQX expects, and then should work with it rather than trying to work around it.

I've never used MQX, but a quick serch of NXP's MQX pages finds me the following document, and this part seems to be a good place to start:

Freescale MQX™ RTOS RTCS User's Guide (IPv4 and IPv6), Rev. 2, 04/2015

7.54 ipcfg_init_device()

There are lots of examples in the manual showing calls to:

/* Get the Ethernet address of the device */
ENET_get_mac_address (BSP_DEFAULT_ENET_DEVICE, ENET_IPADDR, enet_address);

But that function isn't documented anywhere. It may be one that pulls the MAC out of the physical chip, assuming something else has put it there.

Good luck.

Tom

0 Kudos