|
我的板子为神州IV,,,调试UDP client时,调用udp_send(upcb, p)之后,server端也能接收到发送的内容,,但是程序指针跑到了void HardFault_Handler(void)死循环中,,,不知道什么引起的,求解???? void client_init(void)! X4 F/ F& v6 R2 ?+ \( n; m { struct udp_pcb *upcb; struct pbuf *p;. P6 E" i! s: j err_t ret; uint8_t Sent[]="fanqh test udp client\r\n"; /* Create a new UDP control block */: Q2 d$ W+ C2 l2 F upcb = udp_new(); /* Connect the upcb */" B. H! b X! `3 ? udp_connect(upcb, IP_ADDR_BROADCAST, UDP_SERVER_PORT);& {5 [+ F% F8 ], M: p& B p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM);% \& q# _ _$ p. _8 {4 E. h p->payload = Sent; p->tot_len=p->len = sizeof(Sent);. o, S! P! A- ?$ | /* Send out an UDP datagram to inform the server that we have strated a client application */ udp_send(upcb, p); /////////////////////////////////////////////////程序执行到这个函数后调到死循环HardFault_Handler{}中 ! \6 U. ]5 I9 d: f+ ^/ r* ^ /* Reset the upcb */% y! o b0 _4 k 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);2 `0 u- w0 z* c, ]3 G /* Set a receive callback for the upcb */ udp_recv(upcb, udp_client_callback, NULL); ! u% V, t( u$ [/ _ /* Free the p buffer */ pbuf_free(p);3 N% x" U& K/ q$ V9 H# t8 k 4 x- M. o! V" u2 X$ M, b }7 D1 B. a& P, j% K! v F7 \ |
微信公众号
手机版
楼主要学会自己解决问题。
谢谢!!!