完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我一直在拉我的头发在这一个,但现在有一些事情继续下去…我一直在使用UDP Bootloader的例子,(基础),发现,当我把它移植到我自己的硬件,它从来没有工作。我仔细地查看了各种不同的雕塑作品。我找不到任何有意义的东西…所以我开始研究“不明智”的事情。在我的设置中,IP是静态的。我添加了ICMP,所以我可以ping这个设备,它工作得很好,所以我们知道IP /以太网都是OK。我发现UDP套接字工作的唯一时间是IPIP地址和网关地址相同的地方。真奇怪。如果网关与IP地址不一样,套接字将返回无效。我花了一些时间调试这个,并且我发现代码没有传递IP地址,但是它通过网关(DATASERAMUDP.C的第159行),恰好在微芯片示例中,网关。Y和IP地址是相同的。哪一个可能是MHC/BSP的默认设置?现在我已经解决了我现在面临的问题,现在我至少可以采取一些行动,但这是一个尴尬的局面。
以上来自于百度翻译 以下为原文 I have been pulling my hair out on this one, but now have something to go on.. I've been using the UDP bootloader example, ( basic ) and found that when ever i ported it onto my own hardware it never worked.. I carefully looked through all the different congfigurations.. i coud'tn find anything that made any sense.. So i started looking at 'non sensible' things. In my setup the IP is static. i've added ICMP so, i can ping the device, and it works fine, so we knew that the IP / ethernet was all ok. What I've found is that the only time that a UDP socket would work is if the IP_Address and the gateway address where identical. Truely odd. If the gateway is not the same as the IP address the socket would return as invalid. I spent some time debugging this, and i've found that the code is not passing the IP address, but its passing the gateway ( line 159 of datastream_udp.c ) udpsocket = TCPIP_UDP_ServerOpen(IP_ADDRESS_TYPE_IPV4, port, (IP_MULTI_ADDRESS*) &laddr); it just so happens that in the microchip examples, the gateway, and the ip address are the same. which might be the default setup from the mhc/bsp? I have sorted out enough now to solve my immediate problem, and i can now at least move on somewhat, but this is bizzare. |
|
相关推荐
2个回答
|
|
除此之外,我已经确认在打开UDP套接字时传递一个空值,而不是指定地址使事情正常运行。(我们只有一个接口,所以它不是真正的问题。)它会发现问题不可能在UDP功能中,而是在它上面的东西。
以上来自于百度翻译 以下为原文 Futher to this, I've confirmed that passing a NULL value when opening the UDP socket, rather than specifing the address causes things to work ok. .( we only have one interface so its not really a problem. ). It would see the problem is unlikely to be in the UDP function, but something above it. udpsocket = TCPIP_UDP_ServerOpen(IP_ADDRESS_TYPE_IPV4, port, NULL ); |
|
|
|
问题是在DATASERAMUDP.C代码中。这是在2.03中提供的,我对MySEFL有点恼火,我没有发现这个更快。如果您在下面的代码片段中看到(这是从第141行),有一个StrucPy将默认网关注册到AdAMP;LADDR,这不应该是默认网关,而是接口地址。这是一个错误,希望他们能在2.04解决这个问题。
以上来自于百度翻译 以下为原文 The problem is in the datastream_udp.c code. which is supplied in harmony 2.03 I'm somewhat annoyed with mysefl that i did'tn spot this faster. If you see in the code snippet below ( this is from line 141 ), there is a strcpy which is cpying the default gateway to the &laddr, This should not be the default gateway but the interface address.. Def a bug, hopefully they will resolve this in 2.04 if (ipAddr.v[0] != 0 && ipAddr.v[0] != 169) // Wait for a Valid IP { IPV4_ADDR laddr; strcpy(_Port_Buffer, BOOTLOADER_UDP_PORT_NUMBER); strcpy(_Message_Buffer, TCPIP_NETWORK_DEFAULT_GATEWAY); TCPIP_Helper_StringToIPAddress(_Message_Buffer, &laddr); uint16_t port = atoi(_Port_Buffer); // udpsocket = TCPIP_UDP_ServerOpen(IP_ADDRESS_TYPE_IPV4, // port, // (IP_MULTI_ADDRESS*) &laddr); // laddr is being set to the gateway address? udpsocket = TCPIP_UDP_ServerOpen(IP_ADDRESS_TYPE_IPV4, port, NULL ); if (udpsocket == INVALID_SOCKET) { return(DRV_HANDLE_INVALID); } connected = true; //BSP_LEDStateSet(BSP_LED_2, BSP_LED_STATE_ON); return(0); //Success } |
|
|
|
只有小组成员才能发言,加入小组>>
5228 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3199 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
770浏览 1评论
658浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
585浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
668浏览 0评论
570浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 09:50 , Processed in 1.218736 second(s), Total 50, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号