Get Mac Address on my 9215

I am trying to get my MAC Address.

Right now I could only use this method:

char * NAGetAppBspMacAddress(void);

but it is giving me the default mac address that Digi uses when the NVRAM gets corrupted. It is not giving the right MAC Address.

I tried using
getMacAddress()
and
getDefaultMacAddress()

without success.

I can’t seem to find the correct libraries to use the methods.

If there is some working code example doing this it would be great.

I would have expected getMacAddress to work as it reads directly from FLASH. You could try the following:
write some code that calls customizeReadDevBoardParams(). You pass it a pointer to a devBoardParamsType struct (you must either malloc this or pass it a pointer to a stack or global variable). As always I recommend clearing the structure out before passing it to the API. The field ethernetMac should be the ethernet address of the module or chip. This is described in the API reference guide.

A couple of things:
In appconf.h of your project, if the macro APP_USE_NVRAM is defined as APP_DO_NOT_USE_NVRAM, then customizeReadDevBoardParams returns the NET+OS default values.

If your NVRAM values are crunched (the CRC value calculated does not equal the CRC value carried in NVRAM then customizeReadDevBoardParams will return the NET+OS values.

In appconf.h if the macro APP_USE_NVRAM is set to APP_FOR_MAC_ADDRESS_ONLY then the mac address could be read from appconf.h (default value).

The obvious question is are you sure your NVRAM data was NOT crunched?

1 Like

I solved the problem with customizeReadDevBoardParams().

Thanks!

1 Like