
我的板子为神州IV,,,调试UDP client时,调用udp_send(upcb, p)之后,server端也能接收到发送的内容,,但是程序指针跑到了void HardFault_Handler(void)死循环中,,,不知道什么引起的,求解???? void client_init(void) { struct udp_pcb *upcb; struct pbuf *p; err_t ret; uint8_t Sent[]="fanqh test udp client\r\n"; /* Create a new UDP control block */ upcb = udp_new(); /* Connect the upcb */ udp_connect(upcb, IP_ADDR_BROADCAST, UDP_SERVER_PORT); p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM); p->payload = Sent; p->tot_len=p->len = sizeof(Sent); /* Send out an UDP datagram to inform the server that we have strated a client application */ udp_send(upcb, p); /////////////////////////////////////////////////程序执行到这个函数后调到死循环HardFault_Handler{}中 /* Reset the upcb */ udp_disconnect(upcb); /* Bind the upcb to any IP address and the UDP_PORT port*/ ret = udp_bind(upcb, IP_ADDR_ANY, UDP_CLIENT_PORT); /* Set a receive callback for the upcb */ udp_recv(upcb, udp_client_callback, NULL); /* Free the p buffer */ pbuf_free(p); } |
楼主要学会自己解决问题。
谢谢!!!