NETMF Setup Manual for SH7619 EVB

SH7619 EVB NETMF

6.    How to set the MAC address

The initial value of MAC address is FF.FF.FF.FF.FF.FF.

There are two ways for changing MAC address.

6.1                Using Serial Terminal

Using Serial Terminal, you can change the MAC address without modifying any source code.

1)       Open the Serial terminal and connect the serial port of the SH7619 EVB with PC via Serial cross cable.

2)       Press Enter key

3)       Power on the SH7619 EVB with pressing Enter key.

Please don’t release the Enter key until you can find following message in terminal window.

4)       Enter new MAC address.

If MAC address is expected 1a.e.f.f8.6.f3, type below,

   1a.0e.0f.f8.06.f3

6.2                Modifying source file

You can change the MAC address modifying source code.

1) Change the sequence for getting MAC address.

 Open C:\MicroFrameworkPK_v4_1\DeviceCode\Targets\Native\sh2\DeviceCode\sh7619\Ethernet\SH7619_EDMAC.cpp
So that you can find
RTP_BOOL SH7619_EDMAC_open(PIFACE pi).

 

Please remove all of following codes.

 

int addr = MAC_address_area;

for(i=0; i<macLen; i++)

g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[i] = *(volatile char *)(addr+i);

                 

debug_printf( "MAC Address: %x.%x.%x.%x.%x.%x\r\n", (UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[0],

(UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[1],

(UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[2],

(UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[3],

(UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[4],

(UINT8)g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[5]);

debug_printf( "Do you need to change MAC Address? If yes, press 'Enter' key\r\n" );

c[0] = 0x0;

for (i=0; i<0xff; i++){

DebuggerPort_Read( HalSystemConfig.DebugTextPort, c, 1);

if (c[0] == 0x0d){

    hal_printf( "new MAC Address :" );

while(c[0] == 0x0d) DebuggerPort_Read( HalSystemConfig.DebugTextPort, c, 1);

for(i=0; i<17; ){

Events = Events_WaitForEvents( SYSTEM_EVENT_FLAG_COM_IN, 100 );

    if(Events & SYSTEM_EVENT_FLAG_COM_IN){

Events_Clear( SYSTEM_EVENT_FLAG_COM_IN );

                   DebuggerPort_Read( HalSystemConfig.DebugTextPort, c, 1);

                   Buffer[i] = c[0];

                   i++;

}

}

for (i=0; i<17; i++) hal_printf( "%c",Buffer[i] );

hal_printf( "\r\n");

 

for(i=0; i<macLen; i++) {

Buff[i]=SH7619_EDMAC_AtoH(Buffer[i*3])*0x10;

Buff[i]+=SH7619_EDMAC_AtoH(Buffer[i*3+1]);

}

 

for(i=0; i<macLen; i++) {

                                                      g_NetworkConfig.NetworkInterfaces[NETWORK_INTERFACE_INDEX_SH7619EMAC].macAddressBuffer[i]=Buff[i];

}

 

 

debug_printf( "Updating...\r\n" );

g_AM29DL_16_BS_DeviceTable.InitializeDevice(pBLOCK_CONFIG);

g_AM29DL_16_BS_DeviceTable.EraseBlock(pBLOCK_CONFIG,MAC_address_area);

g_AM29DL_16_BS_DeviceTable.Write(pBLOCK_CONFIG,MAC_address_area,macLen,Buff,0x0);

debug_printf( "Done\r\n" );

 

i=0x100;

}

}

 


2) Set MAC address

 Open MicroFrameworkPK_v4_1\Solutions\SH7619_EVB\DeviceCode\Network\Network_config_SH7619_EVB.cpp
So that you can find g_NetworkConfig.

 

NETWORK_CONFIG g_NetworkConfig =

{

    { TRUE },

    1,      // interface count

    {      

        {                                      

                                                      //0,

             //SOCK_MAKE_IP_ADDR(192,168, 84, 84), /*ip address */ 

             //SOCK_MAKE_IP_ADDR(255,255,255,  0), /*subnet mask*/ 

             //SOCK_MAKE_IP_ADDR(192,168, 84,251), /*gateway    */ 

             //SOCK_MAKE_IP_ADDR(192,168, 84,200), /*dns1       */ 

             //SOCK_MAKE_IP_ADDR(192,168, 84,202), /*dns2       */ 

                                                    

                                                     SOCK_NETWORKCONFIGURATION_FLAGS_DHCP,

            SOCK_MAKE_IP_ADDR(  0,  0,  0,  0), /*ip address */ 

            SOCK_MAKE_IP_ADDR(255,255,255,  0), /*subnet mask*/ 

            SOCK_MAKE_IP_ADDR(  0,  0,  0,  0), /*gateway    */ 

            SOCK_MAKE_IP_ADDR(  0,  0,  0,  0), /*dns1       */ 

            SOCK_MAKE_IP_ADDR(  0,  0,  0,  0), /*dns2       */ 

                                                    

            // SOCK_NETWORKCONFIGURATION_FLAGS_DHCP | SOCK_NETWORKCONFIGURATION_FLAGS_DYNAMIC_DNS | SOCK_NETWORKCONFIGURATION_FLAGS_TYPE__set(SOCK_NETWORKCONFIGURATION_FLAGS_WIRELESS),

            // SOCK_MAKE_IP_ADDR_LITTLEEND(192,168,  84, 9), /*ip address */ 

            // SOCK_MAKE_IP_ADDR_LITTLEEND(255,255,255,  0), /*subnet mask*/ 

            // SOCK_MAKE_IP_ADDR_LITTLEEND(192,168,  84, 251), /*gateway    */ 

            // SOCK_MAKE_IP_ADDR_LITTLEEND(192,168,  84, 200), /*dns1       */ 

            // SOCK_MAKE_IP_ADDR_LITTLEEND(192,168,  84, 202), /*dns2       */ 

            SOCK_NETWORKCONFIGURATION_INTERFACETYPE_ETHERNET,       

            6,              /*mac address length*/                 

            {               /*mac address*/                        

                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

            }                                                       

        },                                                         

    },

};

 

Put the MAC address into above red portion.