AnsweredAssumed Answered

PING is not stable after porting RTCS ,help.

Question asked by yong liu on Mar 7, 2017

After porting the MQX3.7 to  K60MK60DN512ZVLQ10 ,I "PING" to MCU and find that:

1 when connecting K60 to PC in OFFICE ,"PING" is OK ,even UDP is OK .

2 Then bing a switchboard between them,"PING" is not stable, often come to a timeout.

3 connect two PC each at home ,PING is not stable,often come to a timeout.That's impenetrable~

I have explored this issue for 2 days,and still can't work out.

Key CODE shows below:

#define ENET_IPADDR IPADDR(192,168,1,4)
#define ENET_MASKADDR IPADDR(255,255,255,0)
#define ENET_GATEWAYADDR IPADDR(192,168,1,1)
#define DEMOCFG_DEFAULT_DEVICE BSP_DEFAULT_ENET_DEVICE
void hello_task(uint_32 initial_data)
{
printf("RTSC ICMP IS CONFIG ing... PAGE-312\r\n");
int_32 error;
_enet_address address;//mac eq char[6]
IPCFG_IP_ADDRESS_DATA ip_data;
ip_data.ip = ENET_IPADDR;
ip_data.mask = ENET_MASKADDR;
ip_data.gateway = ENET_GATEWAYADDR;
//step1:create RTCS
error = RTCS_create();
if(error == RTCS_OK)
{
printf("RTCS_create is OK\r\n");
}
else
{
printf("Failed!!");
_task_block();
}

//step2:get mac to address
if(1 == ENET_get_mac_address(DEMOCFG_DEFAULT_DEVICE, ip_data.ip, address))
{
printf("ENET_get_mac_address is OK\n ");
}
else
{
printf("Failed!!");
_task_block();
}

//step3:INIT PHY
error = ipcfg_init_device(DEMOCFG_DEFAULT_DEVICE,address);
if (error == 0)
{
printf (" init ethernet device OK \n");
}
else
{
printf("Failed!!");
_task_block();
}

//step4:bind ip
error = ipcfg_bind_staticip(DEMOCFG_DEFAULT_DEVICE,&ip_data);
if(error == IPCFG_OK )
{
printf("Bind OK \n");

}
else
{
printf("Failed!!");
_task_block();
}

while(1)
{
GPIO_ToggleBit(HW_GPIOE, 6);//ToggleLED
_time_delay(200);
}

 

 

Project is compiled in IAR 6.30, MQX version is 3.7.

Original Attachment has been moved to: MQX_3_7_20170307ping_not_OK.rar

Outcomes