DHCP

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

DHCP

413件の閲覧回数
ninesun
Contributor II

i use ksdk21, frdmk64 boards. i hope to use function of DHCP. Then i add following program in file lwi_udpecho_freertos.c the example of udp echo:

 

IP4_ADDR(&fsl_netif0_ipaddr, 0,0,0,0);
IP4_ADDR(&fsl_netif0_netmask, 0,0,0,0);
IP4_ADDR(&fsl_netif0_gw, 0,0,0,0);
tcpip_init(NULL, NULL);

netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw, NULL, ethernetif_init, tcpip_input);
netif_set_default(&fsl_netif0);

 


err = dhcp_start(&fsl_netif0);
printf("%s : Started DCHP request (%s)\n", __FUNCTION__, lwip_strerr(err));
for(int i=0; i < 5 && fsl_netif0.dhcp->state != DHCP_STATE_BOUND; i++)
{
printf("%s : Current DHCP State : %d\n", __FUNCTION__, fsl_netif0.dhcp->state);
// Wait a second
vTaskDelay(1000/portTICK_PERIOD_MS);
}
netif_set_up(&fsl_netif0);

 

printf("%s : Interface is up : %d\n", __FUNCTION__, fsl_netif0.dhcp->state);
printf("%s : IP %s\n", __FUNCTION__, ipaddr_ntoa(&fsl_netif0.ip_addr));
printf("%s : NM %s\n", __FUNCTION__, ipaddr_ntoa(&fsl_netif0.netmask));
printf("%s : GW %s\n", __FUNCTION__, ipaddr_ntoa(&fsl_netif0.gw));

udpecho_init();

 

when the program run  at vTaskDelay(1000/portTICK_PERIOD_MS);.

the program is broken. then the program jump to ldr r0 =HardFault_handler:

Can you give some suggestion about it? Thanks

ラベル(1)
0 件の賞賛
0 返答(返信)