IAR: 6.5
Mqx:4.0
Application: Ethernet based code
Need to take the dump of the mii register block and also the eth_phy register block .
Currently using the function eth_phy_reg_dump(int ch, int phy_addr) which part of the eth_phy.c header file
Code part :
int_32 error;
IPCFG_IP_ADDRESS_DATA ip_data;
_enet_address enet_address;
/* runtime RTCS configuration */
_RTCSPCB_init = pcbs;
_RTCS_msgpool_init = msgs;
_RTCS_socket_part_init = sockets;
error = RTCS_create();
if (error == RTCS_OK) {
ip_data.ip = ENET_IPADDR;
ip_data.mask = ENET_IPMASK;
ip_data.gateway = ENET_IPGATEWAY;
ENET_get_mac_address(BSP_DEFAULT_ENET_DEVICE, ENET_IPADDR, enet_address);
ipcfg_init_device(BSP_DEFAULT_ENET_DEVICE, enet_address);
ipcfg_add_dns_ip(BSP_DEFAULT_ENET_DEVICE,LWDNS_server_ipaddr);
printf("\n register dump \n");
eth_phy_reg_dump(0,configPHY_ADDRESS);
// check link status
printf("\nWaiting for ethernet cable plug in ... ");
while(!ipcfg_get_link_active(BSP_DEFAULT_ENET_DEVICE)) {};
printf("Cable connected\n");
The highlighted part of the code need to look into , here the eth_phy_reg_dump function passing the "ch" as 0 and phy_addr as "configPHY_ADDRESS" which is 1 and defined in userconfig.h file .
The function definition of eth_phy_reg_dump(int ch, int phy_addr) as follows:
int eth_phy_reg_dump(int ch, int phy_addr)
{
int j, settings;
printf("\n MII Register Block\n");
printf("--------------------------------");
for (j = 0; j < 32; j++)
{
mii_read(ch, phy_addr, j, &settings);
if (!(j % 4))
printf("\n0x%02X-0x%02X : %04X ", j, j + 3, settings);
else
printf("%04X ", settings);
}
printf("\n");
return 0;
}
problem: when build and download and run the code , on the serial port the out put is :
register dump
and nothing is getting printed , the printf inside eth_phy_reg_dump is not getting printed on the serial port . is dump is happening ?? are we on the right track ,or there is any alternative way to take a dump of MII register block and eth_phy register block , please suggest
hi Martin,
Thanks for the code and it is working fine , need small info , now the ethernet link status is up and the phy register value of 0 to 32 is as follows :
0x00-0x03 : 3000 786D 0022 1513
0x04-0x07 : 01E1 45E1 0005 2001
0x08-0x0B : 0000 0000 0000 0000
0x0C-0x0F : 0000 0000 0000 0000
0x10-0x13 : 0000 0000 0000 0000
0x14-0x17 : 0001 0000 0700 0000
0x18-0x1B : 0000 0000 0000 0000
0x1C-0x1F : 0008 0000 0080 9198
is there a way to cross ever this register value setted proper which register base i need look into it
in the negative cases such as link is down or autonegotiation is failed , so how to use this register dump for debug !
Got the phy transciever datasheet and register stack and checked the operation .
thanks martin for your support
hi Martin,
Thanks for the code and it is working fine , need small info , now the ethernet link status is up and the phy register value of 0 to 32 is as follows :
0x00-0x03 : 3000 786D 0022 1513
0x04-0x07 : 01E1 45E1 0005 2001
0x08-0x0B : 0000 0000 0000 0000
0x0C-0x0F : 0000 0000 0000 0000
0x10-0x13 : 0000 0000 0000 0000
0x14-0x17 : 0001 0000 0700 0000
0x18-0x1B : 0000 0000 0000 0000
0x1C-0x1F : 0008 0000 0080 9198
is there a way to cross ever this register value setted proper which register base i need look into it
in the negative cases such as link is down or autonegotiation is failed , so how to use this register dump for debug !!!