Microchip
直播中

张硕

8年用户 409经验值
私信 关注
[问答]

MHC/BSP的默认设置是什么?

我一直在拉我的头发在这一个,但现在有一些事情继续下去…我一直在使用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)

张玉

2019-1-29 14:55:06
除此之外,我已经确认在打开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 );
举报

张玉

2019-1-29 15:06:38
问题是在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
}

 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分